- Fork the repo
- Start a VM based on the "DevOps - Cloud" template
- Register/login to the Docker Hub. Generate your access token
- Login to docker hub from the CLI
docker login --username szatmarizoltanmit
- Build your project as a docker image and publish it to the Docker Hub
docker build -t szatmarizoltanmit/helloworld:latest .
docker push szatmarizoltanmit/helloworld:latest
- Register/login to AWS. This lab fits the Free Tier usage.
- Get your AWS security credentials (Access key and Secret key)
- Generate an SSH key in EC2, if you don't have one.
- Clone the repository to the cloud VM
- Enable the MicroK8S Ingress module and create the /home/cloud/db-init directory
microk8s.enable ingress dns
mkdir /home/cloud/db-init
- Create kubernetes volume
microk8s.kubectl apply -f volume.yml
microk8s.kubectl get pv,pvc
- Start the database POD and service
microk8s.kubectl apply -f db.yml
microk8s.kubectl logs -f pod/dbapp
- Test the database connection then run the database/golf.sql
microk8s.kubectl get all
mysql -u root -p -h dbservice.ip.address golf
- Fine-tune the
DBHOST
environment variable with the IP of the dbservvice and deploy your web application
microk8s.kubectl apply -f web-app.yml
curl httpservice.ip.address:8088/greeting
curl httpservice.ip.address:8088/sql
- Add the Ingress to the deployment
microk8s.kubectl apply -f ingress.yml
curl --insecure https://localhost/sql
- Map the post 443 on the cloud VM to its public interface and check the endpoint using the browser (HTTPS!)
- Create a new EB application and an environment
- Select Java platform, and the default application to deploy.
- Go for the more detailed customization and don't deploy using the default settings
- Set your SSH key to the environment
- Add the environment variable
SERVER_PORT=5000
to your environment - Try to upload your jar file manually
- Check the HTTP endpoint URL
/greeting
- Create your Job in your Jenkins to build the application
- Add the repository
- Add the gradle build step and define the
build
task for it
- Add a new
AWS Elastic beanstalk
build step to your job - Define the AWS credentials using the Jenkins secure credential store
- Set your application and environment name on the configuration panel
- Define the
root object
asbuild/libs/gs-rest-service-0.1.0.jar
- Define the
version label
format as${GIT_COMMIT}
- Save and test your job
- Check the AWS EB console, the Events and also the Application versions.
- Create a new EB application and an environment
- Select Docker platform, and the default application to deploy
- Fine-tune and upload the
Dockerrun.aws.json
file manually as a new deployment - Check the HTTP endpoint URL
/greeting
- Clone your Jenkins job (Create a new one based on the previos one as a template)
- Tune the application and environment name and Replace the
root object
toDockerrun.aws.json
- Save and test your job
- Check the AWS EB console, the Events and also the Application versions.
- Create an RDS database.
- Take care on the network settings: VPC, subnets.
- Grant access from your EB application security groups.
- Set the root password to
devops
, because it is hardwired in the Java code.
- Define the
DBHOST
environment variable in your Java-based EB environment - SSH to the EC2 instance of your Java-based EB environment using the
ec2-user
ssh username and you SSH key. - Clone the repository and load the dataset to your database. If needed you may install the
git
andmysql-client
CLI tools.
sudo yum install -y mysql-client git
- Test your Java-deployment using the
/sql
endpoint.