Skip to content

Commit dd3cf02

Browse files
alsmkrikukissa
andauthored
Clean images on deploy (#317)
Co-authored-by: Riku Rouvila <[email protected]>
1 parent e503d50 commit dd3cf02

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Protect individual certificate endpoint with token
1212
- Kibana disk space alerts now work regardless of your disk device names. Alerts listen devices mounted both to `/` and `/data` (encrypted data partition)
1313
- "Publish release" pipeline now correctly uses the "Branch to build from" value as the branch to be tagged. Previously it tried tagging "master". "Release tag" is also now used as the release version as is instead of it being read from `package.json`.
14+
- Backup process now doesn't require internet connection to download docker images thus working more reliably when internet connections are unreliable. Previously non-active images were cleaned nightly, now we only do it as part of deployment. [#7896](https://github.com/opencrvs/opencrvs-core/issues/7896)
15+
- We make sure that the automatic cleanup job only runs before deployment (instead of cron schedule cleanup).
1416

1517
### Breaking changes
1618

infrastructure/deployment/deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ split_and_join() {
268268
SPLIT=$(echo $text | sed -e "s/$separator_for_splitting/$separator_for_joining/g")
269269
echo $SPLIT
270270
}
271+
cleanup_docker_images()
272+
{
273+
echo "Cleaning up the docker images"
274+
/usr/bin/docker system prune -af | sudo tee -a /var/log/docker-prune.log > /dev/null
275+
}
271276

272277
docker_stack_deploy() {
273278
echo "Deploying this environment: $ENVIRONMENT_COMPOSE"
@@ -379,6 +384,8 @@ configured_ssh "/opt/opencrvs/infrastructure/setup-deploy-config.sh $HOST"
379384

380385
rotate_secrets
381386

387+
cleanup_docker_images
388+
382389
docker_stack_deploy
383390

384391
echo

infrastructure/server-setup/tasks/docker.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
cron:
4646
user: '{{ crontab_user }}'
4747
name: 'cleanup docker images'
48-
minute: '0'
49-
hour: '0'
5048
job: '/usr/bin/docker system prune -af >> /var/log/docker-prune.log'
49+
state: absent
5150

5251
- name: Check if Docker group exists
5352
command: getent group docker

0 commit comments

Comments
 (0)