How to migrate services from stage-/swarm01 to stage-/services-swarm01¶
NOTE: We will change the new swarm clusters' logging soon, and the logs will go to LaaS2, into swarm specific indices instead of the global containers index. There will be a proper announcement about it next year, but be aware of the change as you will have to change your elastalerts/dashboards accordingly!
- Check if you have access to Global Portainer (portainer.service.emarsys.net) and you can access stage-services-swarm01 (replacement for stage-swarm01; swarm01-manager.s.emarsys.com) and services-swarm01 (replacement for swarm01; swarm01-manager.emarsys.net)
- If you do not have, please request access to it via a SysTec Change Request ticket, explaining which Team (please use AD groups if possible) or individual user (AD username) should be given access to!
- Check if stack is in sync with running services (especially image+version and replica count)! If you have any local files, mounted from disk that needs to be created in advance, please reach out to us on Slack (#area-systec) and have them transferred to the new swarms.
- Save stack content (the YAML from Editor tab in your stack) and all environment variables locally in files/editor on your computer before proceeding! Pro tip: use Advanced mode for environment variables to quickly copy and paste them!
Check if you have any external resource in your stack (ingress_default will be automatically available on the new swarms), like secrets and networks that may need to be transferred before.
Collect all Docker repositories you use and request access to them from us before migrating. Without this, you might encounter image download errors ("no such image"). - Adjust stack if needed. Watch out for mount paths and especially Traefik labels!
Here is a possible set of labels to configure Traefik for HTTPS traffic (to a backend listening on a custom port) with a HTTP redirect:traefik.docker.network: ingress_default traefik.http.routers.example-https.rule: 'Host(`example.service.emarsys.net`)' traefik.http.routers.example-https.entrypoints: https traefik.http.routers.example-https.tls: 'true' traefik.http.routers.example-https.service: example traefik.http.routers.example-http.rule: 'Host(`example.service.emarsys.net`)' traefik.http.routers.example-http.entrypoints: http traefik.http.routers.example-http.middlewares: https-redirect@file traefik.http.services.example.loadbalancer.healthcheck.scheme: http traefik.http.services.example.loadbalancer.healthcheck.path: / traefik.http.services.example.loadbalancer.server.port: 8080 - Delete stack on old Portainer
Note: if the service can run in parallel on the 2 swarms, you can also delete it once deployed successfully on the new swarm! - Once removed, deploy it on the Global Portainer with same content and environment variables
- Repeat steps 3-7 for all your stacks (except the ones, that are ancient enough not to be needed any more)
- If you have domains for the services, their target need to be udpated to the new vIPs. Please create a CR ticket listing all migrated domains names both for production and staging. The new targets are: services-swarm01-traefik-vip.vie.emarsys.net and stage-services-swarm01-traefik-vip.vie.emarsys.net
- Please test your application. Is it accessible from the internet? Can it reach every database, cache and other services?
- Update your YAML files in the stacks repository if you had any. Also consider saving your stack files in this repository as backup.
- Check if you have any Kibana saved Searches or dahsboards using fields that are not available/renamed on the new swarm. For example service-name field has been renamed to @docker.service! Do not forget Elastalert rules as well!
- Enjoy the brand new Docker Engine along with the Portainer!
- Adjust your build pipeline if you are using simple-api! All users were migrated to the new swarms, so you can use existing authentication but the URL is changing. For the new services-swarm01 use https://simple-api.service.emarsys.net/services-swarm01/... and for the stage-services-swarm01 https://simple-api.service.emarsys.net/stage-services-swarm01/..., instead of https://swarm01-manager.emarsys.net/simple-api/... and https://swarm01-manager.s.emarsys.com/simple-api/....
- +1: If you are in the mood and want to experience a whole new Kibana (and Elasticsearch) experience, we also recommend migrating to LaaS 2 with a brand new Kibana and features!