wokoman / applifting-dev-task

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Applifting DevOps Task

These resources will create a 3 manager node Docker Swarm, deploy Traefik, Gitlab, Gitlab Runner and whoami services. With resources under kong-deployment, you can spin up Kong with PostgreSQL, and have it configured with purpose built Docker image.

Prerequisites

  • Debian-based system is presumed
  • Your SSH key being authorized on the hosts
ssh-copy-id -i ~/.ssh/id_rsa user@host

Step-by-step

  1. Run the playbook
ansible-playbook -K -i ansible/applifting-inventory.yml ansible/main.yml
  1. Create two Docker secrets
printf <password> | docker secret create gitlab_root_password -

printf <anotherpassword> | docker secret create kong_postgres_password -
  1. Deploy the stack with Traefik, Gitlab, Gitlab Runner and whoami
docker stack deploy -c applifting-deployment/applifting-stack.yml applifting
  1. Deploy the stack with Kong and whoami
docker stack deploy -c kong-deployment/kong-stack.yml kong
  1. If run for first time, run Kong configuration image when kong_kong service is running
docker run --network=kong_kong-net michalkozakgd/applifting-devops-task:8b864d8a
  1. Register Gitlab Runner
# Find where is Runner deployed
docker service ps applifting_gitlab-runner

# Exec into it on the correct node
docker exec -it <container_id> gitlab-runner register

Used Gitlab CI/CD build variables

  • KONG_CONSUMER_PASSWORD for /whoami basic-auth
  • KONG_PG_PASSWORD for Kong PostgreSQL password
  • SSH_PRIVATE_KEY for SSH key to connect to the Docker Swarm

Ansible Docker Swarm role is forked from Jobin James.

About


Languages

Language:Shell 63.2%Language:Dockerfile 29.2%Language:Ruby 7.7%