mirror of
https://github.com/michelleDeko/scalelite-run.git
synced 2026-02-05 07:40:55 +01:00
Added script for auto-deployment
This commit is contained in:
13
scripts/README.md
Normal file
13
scripts/README.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Helpers
|
||||||
|
|
||||||
|
## Running automatic updates
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo ln -s /home/ubuntu/scalelite-run/scripts/deploy.sh /usr/local/bin/scalelite-deploy
|
||||||
|
sudo cp /home/ubuntu/scalelite-run/scripts/scalelite-auto-deployer.service /etc/systemd/system/scalelite-auto-deployer.service
|
||||||
|
sudo cp /home/ubuntu/scalelite-run/scripts/scalelite-auto-deployer.timer /etc/systemd/system/scalelite-auto-deployer.timer
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable scalelite-auto-deployer.service
|
||||||
|
sudo systemctl enable scalelite-auto-deployer.timer
|
||||||
|
sudo systemctl start scalelite-auto-deployer.timer
|
||||||
|
```
|
||||||
17
scripts/deploy.sh
Executable file
17
scripts/deploy.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STATUS="Status: Downloaded newer image for blindsidenetwks/scalelite:master"
|
||||||
|
|
||||||
|
new_status=$(sudo docker pull blindsidenetwks/scalelite:master | grep Status:)
|
||||||
|
|
||||||
|
echo $new_status
|
||||||
|
|
||||||
|
if [ "$STATUS" == "$new_status" ]
|
||||||
|
then
|
||||||
|
cd /home/ubuntu/scalelite-run
|
||||||
|
sudo docker-compose down
|
||||||
|
sudo docker rmi $(sudo docker images -f dangling=true -q)
|
||||||
|
sudo docker-compose up -d
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
9
scripts/scalelite-auto-deployer.service
Normal file
9
scripts/scalelite-auto-deployer.service
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=ScaleLite Auto Deployer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash /usr/local/bin/scalelite-deploy
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
Alias=scalelite.service
|
||||||
12
scripts/scalelite-auto-deployer.timer
Normal file
12
scripts/scalelite-auto-deployer.timer
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Runs scalelite-deploy every minute
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
# Time to wait after booting before we run first time
|
||||||
|
OnBootSec=1min
|
||||||
|
# Time between running each consecutive time
|
||||||
|
OnUnitActiveSec=1m
|
||||||
|
Unit=scalelite-auto-deployer.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user