Demo/Solution Deployment
When a customer wants a webshop they pull a demo via: https://order.dandomain.dk/Order/ShopDemo/#!/. This will trigger a deployment of a new tenant in our system. The deployment happens on deploy1.shopfactory.io (https://netadmin.zitcom.dk/servers/31510) and is running in Docker containers.
The application deploys the new tenants from: https://gitlab.group.team.blue/hostedshop/proj/deploy. This application is actually just a CLI but it has one command that listens to a RabbitMQ queue for new tenant deployment requests.
Deployment
When a new commit is pushed to master. A new container image is created along with new phar's. If you want to deploy your changes to "demo deployers" you have to run the "Production" in the GitLab CI pipeline.
- Go to https://gitlab.group.team.blue/hostedshop/proj/deploy/-/pipelines
- Click newest pipeline.
- Run "production deploy" part on the right.
Use Cases:
How to trigger a re-deploy for a failed tenant deployment?
Sometimes demo deployment can fail due to varying reasons. When this happens we want to trigger a re-deploy of a demo solution, to do this:
# SSH into codedeploy1
$ ssh smartweb@codedeploy1.shopfactory.io
# Normally a demo deploy's fails half way so you need to delete it in ShopFactory first
# OBS OBS OBS: This command deletes ALL files and database for the tenant, so be very careful and make sure you are hitting the right tenant.
$ sw-deploy shopfactory:solution-delete [tenant]
# Queues a new demo deploy job
$ sw-deploy service:test --host rabbitmq1.shopfactory.io --user deploy --pass [rabbitmq-password] --vhost /shopfactory [tenant] [cluster-id]
[rabbitmq-password] = https://netadmin.zitcom.dk/passwords/13803
How to change what cluster a demo is deployed on
You should just change the cluster number in hs/smartweb_api.php
hs/smartweb_api.php
source/api/hs/smartweb_api.php
# Change the number in the end of this line
Line 98: $deployShopfactoryCluster = $_POST['shopfactoryCluster'] ?? 8;
Debugging:
Logs: All logs is shipped to https://my.papertrailapp.com/groups/11424132/events?q=program%3Adeployer_deployer - look for errors there.
Docker debugging
# See running containers
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
62fb1d097695 gliderlabs/logspout:v3.2.13 "/bin/logspout syslo…" 7 months ago Up 3 weeks 80/tcp log_sender
3b71899af005 smartweb/deploy:7f22a07 "/cli/bin/sw-deploy …" 7 months ago Up 2 weeks deployer_deployer_38
d9feb664747a smartweb/deploy:7f22a07 "/cli/bin/sw-deploy …" 7 months ago Up 2 weeks deployer_deployer_37
99171ba84ee3 smartweb/deploy:7f22a07 "/cli/bin/sw-deploy …" 7 months ago Up 2 weeks deployer_deployer_36
9d7caabafbf9 alpine:3.8 "sh -c 'while true; …" 2 years ago Up 3 weeks log_sender_repeator
# See log output
docker logs deployer_deployer_38
....
2021-11-23 13:07:42.521099: /usr/bin/mysql -h s1c8mysql4.shopfactory.io -u sfadmin -p****** shop82697 < /resources/sql/migrations/20211109_HS-4397.sql
2021-11-23 13:07:42.531408: Applied patch 20211109_HS-4397 to shop82697
2021-11-23 13:07:42.531857: /usr/bin/mysql -h s1c8mysql4.shopfactory.io -u sfadmin -p****** shop82697 < /resources/sql/migrations/20211122_HS-4240.sql
2021-11-23 13:07:42.561115: Applied patch 20211122_HS-4240 to shop82697
2021-11-23 13:07:42.562392: Updates solution specific values of several tables
2021-11-23 13:07:42.581189: Copies solution from the system database onto the solutions database
2021-11-23 13:07:42.581861: Copies contact information from the system database onto the solutions database
2021-11-23 13:07:42.584669: Running Post-hooks
2021-11-23 13:07:42.585986: Successfully deployed solution shop82697
--------------------------------