Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate deployment to UAT upon push to master #1722

Closed
pgwillia opened this issue Jun 18, 2020 · 2 comments
Closed

Automate deployment to UAT upon push to master #1722

pgwillia opened this issue Jun 18, 2020 · 2 comments
Assignees

Comments

@pgwillia
Copy link
Member

We want to be able to merge a PR, move the issue to 'On UAT' and email the ticket owner to seek their feedback. To optimize the feedback cycle we would want UAT to be within a couple minutes of the latest changes.

I looked at watchtower for keeping our deployment up to date

With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.

It can even be used in a docker-compose.yml

version: "3"
services:
  cavo:
    image: index.docker.io/<org>/<image>:<tag>
    ports:
      - "443:3443"
      - "80:3080"
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/.docker/config.json:/config.json
    command: --interval 30

One problem with this approach might be

By default, watchtower will watch all containers. However, sometimes only some containers should be updated.
but there is a workaround to include or exclude using a label

An alternative to this which I used on the discovery deployment is having a cron job update

[deploy@uatsrv01 ~]$ crontab -l
@daily cd /home/deploy/discovery && docker-compose pull && docker-compose up -d

This has been relatively successful Discovery 3.2.2 is the current version and the current version deployed. However this is done daily rather than within minutes of changes.

Originally posted by @pgwillia in #1680 (comment)

@pgwillia
Copy link
Member Author

pgwillia commented Aug 6, 2020

My investigation into whether having watchtower in one docker-compose would impact all docker containers (even those not defined in the same docker-compose). The answer is that it will try to update all running containers

watchtower_1  | time="2020-08-06T00:44:12Z" level=info msg="Starting Watchtower and scheduling first run: 2020-08-06 00:44:42 +0000 UTC m=+31.410428201"
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_nginx_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_worker_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_web_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_solr_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_postgres_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_redis_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /jupiter_watchtower_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /discovery_nginx_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /discovery_mailcatcher_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /discovery_solr_1. Proceeding to next."
watchtower_1  | time="2020-08-06T02:39:39Z" level=info msg="Unable to update container /discovery_mysql_1. Proceeding to next."

@pgwillia
Copy link
Member Author

Add com.centurylinklabs.watchtower.enable=false label to each service that you don't want updated.

service:
  web:
    labels:
     - com.centurylinklabs.watchtower.enable=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant