How to tailor rest service with docker tomcat in AWS Elastic Beanstalk - amazon-web-services

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.

Related

Deploying specific docker services locally when running docker-compose with ECS

I have a docker-compose.yml file that deploys several services to AWS ECS. This works fine. However, there are some services that I don't want deployed to ECS. I would like for these docker containers to run locally instead WHILE the other services are deployed on AWS ECS.
I can't find any documentation on this. What settings would I have to set in my docker-compose.yml file so that a specific service is built and run locally instead of being deployed to AWS ECS?
It sounds like you need to create two separate docker-compose.yaml files. One could be called local-only-compose.yaml or something. When running locally you can pass multiple compose YAML files to docker-compose. When deploying to AWS you could pass only the file with the services you want to deploy to ECS.

how to deploy MEAN stack app on AWS elastic beanstalk?

I'm trying to deploy my mean stack app on AWS using elastic beanstalk but there doesn't seem to be a tutorial good enough that can help me through it.
I would also like to know if I should really deploy it on elastic beanstalk or Lightsail?
Can you share any articles, videos or anything good enough to help me. It will be helpful to a lot of people.
Angular Version : 7
Node Version: 10.14.1
elastic beanstalk will be the option for production while you can use light sail for testing dev enviroment
now if we talk about the deploying Mean stack app
Open Elastic Bean stalk console and you will get option to choose Webserver
Choose web server with apache, tomcat, nginx, configure it as per your requirement
at last you will get option for upload your application
Upload your app using zip file (if dist folder is output then direct deploy dist in elastic beanstalk)

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 properly deploy Docker Compose to Amason EC2 instance?

I'm having docker-compose config with postgres, 2*python, nginx and redis services. Now I'm instantiated an ec2 instance and successfully logged in via .pem file. But I expected, that I can deploy my docker-compose image only with aws-cli commands. My question is should I instantiate ec2 for each of service and how to use ec2 with docker-compose properly?
How you want to design your infrastructure - how many servers, autoscaling, routing, etc - is entirely up to you.
To answer your question though; to deploy a docker-compose.yml file you do so the same as you would on any other server.
docker-compose is a tool made for development and is not made to be used in Production - you should deploy your services with:
docker stack deploy -c your-compose-file.yml your_stack_name
It sounds like this is new to you though; so I should state that there are various options that are available with docker-compose that are not available with docker stack deploy. Often times you can't just use the same compose file as you're using in development.

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 :)