-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-setup
executable file
·131 lines (117 loc) · 5.97 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
minioAccessKeyId=$(cat /dev/urandom | base64 | head -c 64)
minioSecretKey=$(cat /dev/urandom | base64 | head -c 64)
postgresPassword=$(openssl rand -hex 64)
encryptionKey=$(openssl rand -hex 32)
utilsSecret=$(openssl rand -hex 32)
publicIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo "Hey, let's get started setting up Outline on-premise."
echo
echo "First up: Do you have a fully qualified domain pointed at this server?"
echo
echo "If you have a domain that points to your Outline server, the installation script can request a HTTPS certificate from LetsEncrypt automatically. If you do not provide one, a self-signed certificate will be used instead."
echo
echo "Now is a good time to point your fully qualified domain at this 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 no hostname was entered then default to the public ip address
if [ -z "$hostname" ]; then
if [ -z "$publicIpAddress" ]; then
echo "IP address could not be determined and a hostname was not provided, sorry we have to exit."
exit 1
fi
hostname=$publicIpAddress
fi
# If an env file exists then back it up in case they accidentally reran this
# script, and then create a new blank file
if [ -f ./docker.env ]; then
mv docker.env docker.env.$(date +"%Y-%m-%d_%H-%M-%S")
fi
touch docker.env
echo "## Enterprise License" >> docker.env
echo "# Obtain a license key by contacting support, hello@getoutline.com" >> docker.env
echo "LICENSE_KEY=" >> docker.env
echo '' >> docker.env
echo '## Set node environment to production' >> docker.env
echo 'NODE_ENV=production' >> docker.env
echo 'DEBUG=events,emails,mailer,utils,commands,server,services' >> docker.env
echo '' >> docker.env
echo '## Encryption key for passwords etc in the database' >> docker.env
echo "SECRET_KEY=${encryptionKey}" >> docker.env
echo '' >> docker.env
echo '## Access key for admin utilities over API' >> docker.env
echo "UTILS_SECRET=${utilsSecret}" >> docker.env
echo '' >> docker.env
echo '## Storage credentials' >> docker.env
echo '# If you want to connect to a Postgres database on another host make sure' >> docker.env
echo '# to use SSL and comment out or remove the PGSSLMODE line below' >> docker.env
echo "DATABASE_URL=postgres://user:${postgresPassword}@postgres:5432/outline" >> docker.env
echo 'PGSSLMODE=disable' >> docker.env
echo '' >> docker.env
echo "POSTGRES_USER=user" >> docker.env
echo "POSTGRES_PASSWORD=${postgresPassword}" >> docker.env
echo '' >> docker.env
echo 'REDIS_URL=redis://redis:6379' >> docker.env
echo '' >> docker.env
echo '## Nginx server' >> docker.env
echo "WEBSOCKET=true" >> docker.env
echo "ACCESS_LOG=stdout" >> docker.env
if [ "$hostname" == "$publicIpAddress" ]; then
echo "STAGE=local" >> docker.env
echo "# Change '${hostname}' to wiki.yourcompany.com to set up SSL" >> docker.env
else
echo "# Change stage=local to use a self-signed SSL certificate" >> docker.env
echo "STAGE=production" >> docker.env
fi
echo "# The fully qualified hostname in the following two variables must match" >> docker.env
echo "DOMAINS=${hostname} -> http://outline:3000" >> docker.env
echo "URL=https://${hostname}" >> docker.env
echo '' >> docker.env
echo "# Third party signin credentials, at least one of EITHER Google OR Slack is" >> docker.env
echo "# required for a working installation or you'll have no sign-in options." >> docker.env
echo "" >> docker.env
echo "# To configure Slack auth, you'll need to create an Application at" >> docker.env
echo "# => https://api.slack.com/apps" >> docker.env
echo '#' >> docker.env
echo '# When configuring the Client ID, add a redirect URL under "OAuth & Permissions":' >> docker.env
echo "# https://<URL>/auth/slack.callback" >> docker.env
echo "SLACK_KEY=" >> docker.env
echo "SLACK_SECRET=" >> docker.env
echo '' >> docker.env
echo "# To configure Google auth, you'll need to create an OAuth Client ID at" >> docker.env
echo "# => https://console.cloud.google.com/apis/credentials" >> docker.env
echo '#' >> docker.env
echo "# When configuring the Client ID, add an Authorized redirect URI:" >> docker.env
echo "# https://<URL>/auth/google.callback" >> docker.env
echo "GOOGLE_CLIENT_ID=" >> docker.env
echo "GOOGLE_CLIENT_SECRET=" >> docker.env
echo '' >> docker.env
echo "## File Storage" >> docker.env
echo "MINIO_ROOT_USER=${minioAccessKeyId}" >> docker.env
echo "MINIO_ROOT_PASSWORD=${minioSecretKey}" >> docker.env
echo "MINIO_REGION_NAME=us-east-1" >> docker.env
echo '' >> docker.env
echo "# For details on setting up Outline to use AWS S3 instead of Minio, see:" >> docker.env
echo "# https://wiki.generaloutline.com/share/125de1cc-9ff6-424b-8415-0d58c809a40f" >> docker.env
echo "# Set AWS_S3_FORCE_PATH_STYLE to true if using minio, false if using S3" >> docker.env
echo "AWS_S3_FORCE_PATH_STYLE=true" >> docker.env
echo "AWS_ACCESS_KEY_ID=${minioAccessKeyId}" >> docker.env
echo "AWS_SECRET_ACCESS_KEY=${minioSecretKey}" >> docker.env
echo "AWS_REGION=us-east-1" >> docker.env
echo "AWS_S3_UPLOAD_BUCKET_URL=https://mybucketname.s3.us-east-1.amazonaws.com" >> docker.env
echo "AWS_S3_UPLOAD_BUCKET_NAME=mybucketname" >> docker.env
echo "AWS_S3_UPLOAD_MAX_SIZE=26214400" >> docker.env
echo "AWS_S3_ACL=private" >> docker.env
echo '' >> docker.env
echo "# To support sending outgoing transactional emails such as 'document updated' or" >> docker.env
echo "# 'youve been invited' you'll need to provide authentication for an SMTP server." >> docker.env
echo "# This is optional and not included in this package." >> docker.env
echo "SMTP_HOST=" >> docker.env
echo "SMTP_PORT=" >> docker.env
echo "SMTP_USERNAME=" >> docker.env
echo "SMTP_PASSWORD=" >> docker.env
echo "SMTP_FROM_EMAIL=" >> docker.env
echo "SMTP_REPLY_EMAIL=" >> docker.env
echo '' >> docker.env
echo "All done, to enter your license key and set up authentication take a look in docker.env"