This is the steps required to reproduce the actions necessary in completing the devops challenge from the ARCA network.
The objective is to write a shell script to fire up 3 docker containers, respectively of Kibana 6.4.2,
Nginx
and MySQL,
with all instances able to ping each other regardless of deployment environment. Also, Nginx needs to be configured (for immediate access, I presume).
The steps in reproducing the script are documented in the docker.md file.
To run the resulting docker.sh shell script, please follow the steps below:
-
Log in to bash shell with docker installed. Verify with
docker info
. -
Run the command
bash docker.sh
and watch the outputs. Please make sure your environment has access to the internet. This process will take some time. -
You can verify the running containers with
docker ps
. Navigate to port8080
on your host address in a web browser to verify that Nginx is functional. For example,http://localhost:8080
. -
To finish the demo and clean up resources, run the cleanup script with
bash cleanup.sh
. This removes the running containers, but not the base images. To remove all docker images on the system, usedocker rmi $(docker images -q)
.
- WARNING: This will remove all images in your local repo.
I'm required to write a basic cloudformation script to deploy a lone server to a region in AWS on the default VPC. The resulting script is the instance.yml file, and below are the steps to "run" that script:
-
Have AWS cli installed. Version 2 is preferred, but version 1 will do just fine.
-
Configure the CLI with programmatic keys generated from the AWS IAM console. Also configure a default AWS region and a default output format.
-
Run
aws cloudformation deploy --stack-name temp --template-file instance.yml
from your terminal. -
Run
aws cloudformation list-exports |grep Value
for the instance id of the resulting EC2 instance. -
Query the list of instance ids of all running instances with this command:
aws ec2 describe-instances --filters Name=instance-type,Values=t2.micro Name=instance-state-name,Values=running --query "Reservations[].Instances[].InstanceId"
. Verify that the instance id returned in step 4 is included. -
This instance id will be needed in the Python section below. Once done, cleanup with:
aws cloudformation delete --stack-name temp
.
Here, we create two identical Python scripts — one to stop, and another to start the instance created in the previous section. The resulting scripts are power-off and power-on respectively. To run them,
-
Make sure python is installed.
-
Boto3 is a dependency. Install with pip or conda.
-
Replace the the
instances
list in bothpower-off.py
andpower-on.py
to include the instance id of your own instance, exported in the CloudFormation section. -
python power-off.py
will power down the running instance. Verify with step 5 from CloudFormation section. -
python power-on.py
will power up the stopped instance. Verify with step 5 from CloudFormation section. You may need a few seconds for changes to propagate. -
Cleanup the stack with step 6 in the CloudFormation section.
Rewritten for clarity.
Using bash script, Write a script that will automatically provision 3 docker containers running kibana version 6.4.2, nginx server, mysql server separately on each container.Environment:
- container A: kibana version 6.4.2
- container B: nginx server
- container C: mysql server
Acceptance criteria: Solution should be prepared as only one script, which creates three Docker images, runs containers from them, and configures Nginx.
The three docker containers should also be able to ping each other regardless of where they are deployed.
Provide a well documented steps for how to reproduce your work.
- Write a CloudFormation template to provision a server in a default VPC
- Write a python script to start the provisioned server
- Write a python script to stop the provisioned server