Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: digitalocean script #815

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions deploy/do-deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/env bash

set -e

echo "Welcome to Convoy installer"
echo ""

while true; do
echo "Should we setup a TLS certificate for you using Let's Encrypt?"
echo "Select no if you are using this internally and Convoy will not be reachable from the internet. y/n"
read -p "Answer: " yn
case $yn in
[Yy]* ) export USE_SELF_SIGNED_CERT=0; break ;;
[Nn]* ) export USE_SELF_SIGNED_CERT=1; break ;;
* ) echo "Please answer yes or no." ;;
esac
done

read -p "Domain: " DOMAIN
export DOMAIN=$DOMAIN
echo "Ok we'll set up certs for https://$DOMAIN"
echo ""

cd /etc/convoy/

# rewrite caddyfile
export TLS_BLOCK=""
if [[ $USE_SELF_SIGNED_CERT -eq 1 ]]; then
echo "Using a self signed certificate as requested"
export TLS_BLOCK="tls internal"
fi

rm -f Caddyfile
envsubst > Caddyfile <<EOF
$DOMAIN, :80, :443 {
$TLS_BLOCK
reverse_proxy http://web:5005
}
EOF

# update apt cache
echo "Grabbing latest apt caches"
apt update

echo "Grabbing dependencies"
apt install -y jq

# rewrite convoy.json
echo "Setting up convoy.json ..."
echo "$( jq --arg domain "${DOMAIN}" '.host = $domain' convoy.json )" > convoy.json
echo "convoy.json ready"
echo ""
echo ""

echo "Restarting services"

# Drop Docker
docker-compose down

# Start Docker
docker-compose up -d

echo ""
echo "⌛️ Convoy looks up!"
echo ""
echo "🎉🎉🎉 Done! 🎉🎉🎉"
echo ""
echo "To stop the stack run 'docker-compose stop'"
echo "To start the stack again run 'docker-compose start'"