webRunes / WRIO-InternetOS

WRIO Internet OS is a platform for developing a machine-readable web featuring automatic data processing.
https://wr.io
Other
18 stars 33 forks source link

Move to Docker deployment in production #643

Open michbil opened 8 years ago

michbil commented 8 years ago

The task is to create automated deployment using docker on the server. Docker image builds are made by the docker hub, sample docker hub is https://hub.docker.com/u/michbil/

Deployment workflow:

  1. Commit is pushed to the production branch of the repository.
  2. Docker hub triggers image build accoring to the dockerfile
  3. Once build is finished docker hub triggers webhook on our server, and triggers image pull and respective service restart.

Link on webhook workflow: Using webhooks and workflow

Server runs docker-compose https://github.com/michbil/Wrio-Docker-Production Webhooks are triggered on server by https://github.com/cpuguy83/dockerhub-webhook-listener

Webhook for titter shoud do approx this to pull latest image from the hub and restart service

docker pull michbil/titter-wrio-app
docker-compose up --no-deps -d titter
AlexeyAnshakov commented 8 years ago

@michbil please add info to wiki

michbil commented 8 years ago

@AlexeyAnshakov done

michbil commented 8 years ago

@umairadeeb Current state of docker migration: automatic deployment working ok. What need to be done:

  1. Make docker demon start upon server reboot
  2. Make docker-compose up -d run upon server reboot
  3. Make webhook listener run upon server reboot /etc/init.d/webhooks
  4. Stop opsworks deamon, cause it not needed right now.
  5. Cleanup monit scripts, because services now monitored by docker, seems that none of them are needed right now.
  6. Move webhook listener to SSL, create service domain, for example webhooks.wrioos.com(consult @AlexeyAnshakov ), create ssl certificate for it using cloudflare and make it work using apache reverse proxy, then close current webhook port
michbil commented 8 years ago

Would also be good if following tasks will be performed in the future:

  1. Dockerize apache, mongo services, so all configuration of the server will be managed by docker.
  2. Automate deploy of docker-compose configurations.
AlexeyAnshakov commented 8 years ago

webhooks.wrioos.com

@umairadeeb you may create it

umairadeeb commented 8 years ago
  1. Make docker demon start upon server reboot
  2. Make docker-compose up -d run upon server reboot
  3. Make webhook listener run upon server reboot /etc/init.d/webhooks
  4. Stop opsworks deamon, cause it not needed right now.
  5. Cleanup monit scripts, because services now monitored by docker, seems that none of them are needed right now.
  6. Move webhook listener to SSL, create service domain, for example webhooks.wrioos.com(consult @AlexeyAnshakov ), create ssl certificate for it using cloudflare and make it work using apache reverse proxy, then close current webhook port

Point number 1, 2, 3, and 6 completed. For point # 4 and 5, I think we should create a separate instance and move our server there instead of using OpsWorks designated instance. For now, we can disable opsworks deployment using travis' configuration file.

Let me know what you guys think.

AlexeyAnshakov commented 8 years ago

For point # 4 and 5, I think we should create a separate instance and move our server there instead

sounds good if it will speed up instance. @umairadeeb , you may stop instance and create a new one in the same region and type.