-
Notifications
You must be signed in to change notification settings - Fork 206
/
docker_setup
executable file
·97 lines (80 loc) · 4.21 KB
/
docker_setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
postgresPassword=$(cat /dev/urandom | base64 | head -c 64)
retooldbPostgresPassword=$(cat /dev/urandom | base64 | head -c 64)
jwtSecret=$(cat /dev/urandom | base64 | head -c 256)
encryptionKey=$(cat /dev/urandom | base64 | head -c 64)
publicIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo "Hi! I'm here to help you set up a self-hosted Retool."
echo
echo "Just one question: Do you have a fully qualified domain pointed at your Retool server?"
echo
echo "This is an optional question. If you have a domain that points to your Retool server, the installation scripts can request a Let's Encrypt HTTPS certificate for you automatically. If you do not provide one, a self-signed certificate will be used instead."
echo
echo "If you have just created a new cloud server in previous steps, now is a good time to point your fully qualified domain to your server's public address. Make sure the fully qualified domain resolves to the correct IP address before proceeding."
echo
echo "Please type your fully qualified domain below. Press enter to skip."
read -p "Enter it here: (default is your public ip address: ${publicIpAddress}) " hostname
if [ -z "$hostname" ]; then
hostname=$publicIpAddress
fi
if [ -f ./docker.env ]; then
echo "Found existing docker.env file..."
echo "exiting to avoid overwriting existing the configuration file..."
exit 0
fi
touch docker.env
if [ -f ./retooldb.env ]; then
echo "Found existing retooldb.env file..."
echo "exiting to avoid overwriting existing the configuration file..."
exit 0
fi
touch retooldb.env
echo '## For a complete list of all environment variables, see docs.retool.com/docs/environment-variables' >> docker.env
echo '' >> docker.env
echo '## Set node environment to production' >> docker.env
echo 'NODE_ENV=production' >> docker.env
echo '' >> docker.env
echo '## Set the JWT secret for the API server' >> docker.env
echo "JWT_SECRET=${jwtSecret}" >> docker.env
echo '' >> docker.env
echo '## Set and generate postgres credentials' >> docker.env
echo 'POSTGRES_DB=hammerhead_production' >> docker.env
echo 'POSTGRES_USER=retool_internal_user' >> docker.env
echo 'POSTGRES_HOST=postgres' >> docker.env
echo 'POSTGRES_PORT=5432' >> docker.env
echo "POSTGRES_PASSWORD=${postgresPassword}" >> docker.env
echo '' >> docker.env
echo '## Set and generate retooldb postgres credentials' >> docker.env
echo 'RETOOLDB_POSTGRES_DB=postgres' >> docker.env
echo 'RETOOLDB_POSTGRES_USER=root' >> docker.env
echo 'RETOOLDB_POSTGRES_HOST=retooldb-postgres' >> docker.env
echo 'RETOOLDB_POSTGRES_PORT=5432' >> docker.env
echo "RETOOLDB_POSTGRES_PASSWORD=${retooldbPostgresPassword}" >> docker.env
echo '' >> docker.env
echo '## Set and generate retooldb postgres credentials' >> retooldb.env
echo 'POSTGRES_HOST=retooldb-postgres' >> retooldb.env
echo 'POSTGRES_DB=postgres' >> retooldb.env
echo 'POSTGRES_USER=root' >> retooldb.env
echo "POSTGRES_PASSWORD=${retooldbPostgresPassword}" >> retooldb.env
echo 'POSTGRES_PORT=5432' >> retooldb.env
echo '' >> retooldb.env
echo "# Change '${hostname}' to retool.yourcompany.com to set up SSL properly" >> docker.env
echo "DOMAINS=${hostname} -> http://api:3000" >> docker.env
echo '' >> docker.env
echo '## Used to create links for your users, like new user invitations and forgotten password resets' >> docker.env
echo '## The backend tries to guess this, but it can be incorrect if there’s a proxy in front of the website' >> docker.env
echo '# BASE_DOMAIN=https://retool.yourwebsite.com' >> docker.env
echo '' >> docker.env
echo '## Set key to encrypt and decrypt database passwords, etc.' >> docker.env
echo '## This random string value should be stored privately, and should not be changed over the liftetime of the deployment' >> docker.env
echo "ENCRYPTION_KEY=${encryptionKey}" >> docker.env
echo '' >> docker.env
echo "## Google SSO configuration" >> docker.env
echo "# CLIENT_ID={YOUR GOOGLE CLIENT ID}" >> docker.env
echo '' >> docker.env
echo '## License key' >> docker.env
echo 'LICENSE_KEY=EXPIRED-LICENSE-KEY-TRIAL' >> docker.env
echo '' >> docker.env
echo '## Uncomment this line if HTTPS is not set up' >> docker.env
echo '# COOKIE_INSECURE=true' >> docker.env
echo "Cool! Now add your license key in docker.env then run docker-compose up to launch Retool."