manage migrations when deploy rails app with AWS Elastic Beanstalk - amazon-web-services

AWS Elastic Beanstalk is easy to use for deploying rails app on Amazon EC2. By set RAILS_SKIP_MIGRATIONS as true, eb won't run the migrations itself so I can manage migrations myself.
However,SSH to the EC2 instance that created by Beanstalk, I can't find the deployed rails app in the home directory.Then I don't know where to manually rake the migrations.
I wonder why the rails app can't be found on the EC2 instance since the instance is the web server to host the app. Is it hidden somewhere? And how should I manually rake the migrations?
Thanks

Try take a look at /var/app/current.

I think you can't find rake, because elastic beanstalk run ruby environment in virtual environment - rvm. Try to find in the directory /opt environment variables which set up ruby environment for current terminal. I'm not sure for ruby, but for python you should do: source /opt/python/current/env.

Related

How to add a SQLite database in AWS?

I have created a flask application that uses a sqlite database in local system. It works fine.
I wanted to deploy this application on AWS on Elastic Beanstalk service. The application is deployed successfully using GitHub actions and Elastic Beanstalk. However, when I try to access the database, it shows Internal Server Error.
I know that to locally create the database, we need to run the following 3 commands -
flask db init
flask db migrate -m "Message"
flask db upgrade
But where should I mention and run these commands in Elastic BeanStalk? Should I mention them in the main.yml file?

Deploying a web application for Selenium testing on AWS EC2

I have a web application that uses Selenium in backend to run few scripts when invoked by user. I want to deploy this web app on AWS.
Here are my findings so far:
I can have a windows EC2 instance created and then I can install tomcat, firefox and all the necessary stuff. Then using putty or any other client, I can deploy my war and start tomcat.
I can directly make use of Elastic Beanstalk and deploy my war file there itself but then, there is no windows EC2 available for beanstalk and I don't know how to install firefox there and make my application work.
What is the best way to achieve this and what steps should I follow. I want to install a specific firefox version to be able to make it run with my selenium scripts.
There are two separate things here:
Deployment of web application on AWS cloud
Run the selenium tests against your web application
According to me, you should first think of deploying a web application to AWS cloud. There are many ways by which you can get it deployed to AWS cloud with below services:
Spin a new AWS EC2 instance, install all required software and deploy the web application.
Use AWS elastic beanstalk service with either with tomcat or docker.
Use AWS ECS if you prefer docker
According to me, second option will be quick for you with tomcat environment option. If you select tomcat environment, then your platform will be Tomcat 8 Java 8 on 64bit Amazon Linux.
Now, here comes the second part. You can have below options for your browser environments.
Spin a new separate AWS EC2 instances with correct AMI and install your specific browsers on these instances.
If you prefer SaaS, then you can take a look at browserstack or SauceLabs for remote environment.
If you have CI(jenkins/travis/Circle CI), then make use of that infrastructure to luanch your tests with either option from the above.

How to tailor rest service with docker tomcat in AWS Elastic Beanstalk

Hi I am new to docker and am trying to understand how to deploy rest service in tomcat using docker container in AWS.
Basically, any rest service requires a server so I am able to deploy my war file in the tomcat app folder which is installed in an EC2 instance.
But when I go for EB applications with docker it wants me to provide a docker zip file( obviously containing the dockerfile in it). So my dockerfile should specify that i am using openjdk, then should install tomcat and setup environment variables. This part i understood.
Next transfer the war file to this tomcat location in docker.
I am stuck here how should i do this. Should i copy the war file in the docker image export ? Or is there a way to avoid this? I am looking for a way that i can build the source file using maven and deploy it to Elastic beanstalk with docker and tomcat.
Please excuse me for this confusing question and dumbness but I have read a lot of articles and I am completely confused so asking for help here.

How can automatic deploy yii2 app when Elastic Beanstalk instance is terminated and created a new instance

Currently I have setup my yii2 website on AWS Elastic beanstalk. I followed following steps :
Created Elastic Beanstalk app and environment : Platform PHP 7.0, RDS database
Created SSH connection from EC2 instance of elastic beanstalk using putty with .pem file
In Apache folder I have cloned my yii2 git repo using (sudo git clone repo_url) command
Installed composer using this link https://gist.github.com/asugai/6694502
Run command : (sudo composer install) in my repo folder
Edited common/config/main-local.php and made db connection
And run migration using (sudo php yii migrate)
Setup a domain for this elastic beanstalk app
Now I don't know how should I proceed further and I am facing following problems :
Elastic Balance loader is creating new instance and terminating current one when it fails or health goes in severe.
Due this, my all data in that instance is lost. To make it work I am doing all steps again and again manually.
How can I make my domain https (SSL certified)
How can make easy process to pull new changes from git
I already have a working site in nodeJS. which is using elastic beanstalk, elastic balance loader, RDS(postgres), S3 bucket, cloudfront for Route 53, SSL certificate (https), code pipeline, code commit. And AWSCLI at local to deploy nodeJS app.
my question is about I want to use same flow for yii2 advance app.
Can anyone please help me here?
Thanks in advance :)

Deploying Ruby on rails applications using GIT in AWS elastic beanstalk

I am looking at ways to have a setup for complete development and deployment cycle by using Git to have code versions and then transfer a that code(push) into an AWS elastic Beanstalk instance... I would also like to know of any other methods that includes 'rubber' setup. can you please guide me in this regard.
As of November 1, 2012, Elastic Beanstalk now natively supports Rails and Sinatra apps running Ruby 1.8.7 or 1.9.3. Phusion Passenger is the application server. Git deployment is included, and the EB command line tools have been updated.
Here is the announcement:
Here is a good tutorial