Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Install Museum update script under root ownership

Manav Rathie5c5c6866287
diff --git a/server/scripts/deploy/README.md b/server/scripts/deploy/README.md
index 89b072fc67..c8062663cb 100644
--- a/server/scripts/deploy/README.md
+++ b/server/scripts/deploy/README.md
@@ -47,7 +47,7 @@ sudo tee /root/museum/credentials/tls.cert
sudo tee /root/museum/credentials/tls.key
```
-Copy the service definition and restart script to the new instance. The restart script can remain in the ente user's home directory. Move the service definition to its proper place.
+Copy the service definition and restart script to the new instance, then install them in their system locations.
```sh
# If using nginx
@@ -58,6 +58,8 @@ scp scripts/deploy/museum.service <instance>:
scp scripts/deploy/update-and-restart-museum.sh <instance>:
sudo mv museum.service /etc/systemd/system
+sudo install -o root -g root -m 0755 update-and-restart-museum.sh \
+ /usr/local/sbin/update-and-restart-museum.sh && rm update-and-restart-museum.sh
sudo systemctl daemon-reload
```
@@ -75,7 +77,7 @@ sudo systemctl reload nginx
SSH into the instance and run:
```sh
-./update-and-restart-museum.sh
+sudo /usr/local/sbin/update-and-restart-museum.sh
```
## Rollback
@@ -91,7 +93,7 @@ sudo systemctl restart museum
>
> This doesn't work if there are migrations!
-To reset the local `latest` back to the registry image, run `./update-and-restart-museum.sh` again, or
+To reset the local `latest` back to the registry image, run `sudo /usr/local/sbin/update-and-restart-museum.sh` again, or
```sh
sudo docker pull rg.fr-par.scw.cloud/ente/museum-prod:latest
diff --git a/server/scripts/deploy/update-and-restart-museum.sh b/server/scripts/deploy/update-and-restart-museum.sh
index daac10e363..d53b29da60 100755
--- a/server/scripts/deploy/update-and-restart-museum.sh
+++ b/server/scripts/deploy/update-and-restart-museum.sh
@@ -4,13 +4,13 @@
set -o errexit
-if sudo docker inspect museum >/dev/null 2>&1; then
- sudo docker tag "$(sudo docker inspect -f '{{.Image}}' museum)" rg.fr-par.scw.cloud/ente/museum-prod:previous
+if docker inspect museum >/dev/null 2>&1; then
+ docker tag "$(docker inspect -f '{{.Image}}' museum)" rg.fr-par.scw.cloud/ente/museum-prod:previous
fi
-sudo docker pull rg.fr-par.scw.cloud/ente/museum-prod
+docker pull rg.fr-par.scw.cloud/ente/museum-prod
-sudo systemctl restart museum
+systemctl restart museum
curl -fk --retry 5 --retry-connrefused --retry-delay 1 https://localhost/ping
-sudo systemctl status museum --no-pager
-sudo tail -n 20 /root/var/logs/museum.log
+systemctl status museum --no-pager
+tail -n 20 /root/var/logs/museum.log