ol-infrastructure
ol-infrastructure copied to clipboard
bug: semaphore for when db migrations are being run
[Unit]
Description="Obtain an exclusive lock and run database migrations at startup."
Requires=network-online.target
After=consul-template.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/consul lock -timeout=6h -verbose lms_migrations /edx/bin/edxapp-migrate-lms
ExecStart=/usr/local/bin/consul lock -timeout=6h -verbose cms_migrations /edx/bin/edxapp-migrate-cms
RemainAfterExit=True
StandardOutput=journal
StandardError=journal
SyslogIdentifier=migrations
Restart=no
[Install]
WantedBy=multi-user.target
We should only allow database migrations to run one at a time. It is okay for a migration to run again but it isn't okay for them to run simultaneously. We had this simple + neat locking mechanism using consul before but that was lost with moving edxapp into a docker container.