Last active
April 25, 2017 15:58
-
-
Save sheerun/20d71ae5059f663100dbefc3eb7bf2f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export NAME=ghost | |
export [email protected] | |
export SERVICE=$(mktemp) | |
cat > $SERVICE <<EOF | |
[Unit] | |
Description=Ghost | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
TimeoutStartSec=0 | |
Restart=always | |
ExecStartPre=-/usr/bin/docker stop ghost | |
ExecStartPre=-/usr/bin/docker rm ghost | |
ExecStartPre=/usr/bin/docker pull ghost:latest | |
ExecStart=/usr/bin/docker run --rm --name ghost -p 80:2368 ghost | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
echo "Uploading $NAME service..." | |
rsync $SERVICE $TARGET:/etc/systemd/system/$NAME.service | |
echo "Restarting $NAME service..." | |
ssh $TARGET "systemctl daemon-reload && systemctl restart ghost --no-block" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment