-
Notifications
You must be signed in to change notification settings - Fork 35
/
discourse
executable file
·68 lines (50 loc) · 2.04 KB
/
discourse
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
#!/bin/bash
# Discourse Recipe
# Deploy on a DigitalOcean 2GB:
# overcast create cluster discourse
# overcast digitalocean create discourse-do-01 --cluster discourse --size-slug 2gb
# recipes/discourse discourse-do-01
# Deploy on a Linode 2048:
# overcast create cluster discourse
# overcast linode create discourse-linode-01 --cluster discourse
# recipes/discourse discourse-linode-01
###############################################################################
# Configuration:
if [ -z "$1" ]; then
echo "Usage: recipes/discourse [instance]"
exit 1
fi
instance=$1
# Discourse configuration
discourseDevEmails="[email protected]"
discourseHostname="discourse.example.com"
discourseSMTPAddress="smtp.mandrillapp.com"
discourseSMTPPort="587"
discourseSMTPUsername="[email protected]"
discourseSMTPPassword="my.api.key"
###############################################################################
# You shouldn't need to edit anything below.
set -e
echo "Disallowing password access through SSH..."
overcast run $instance harden_ssh
echo "Full system upgrade, installing core packages..."
overcast run $instance install/core
overcast reboot $instance
echo "Configuring iptables to only expose HTTP, HTTPS and SSH..."
overcast expose $instance 22 80 443
echo "Creating SSH key for root that Discourse can use..."
overcast run $instance "ssh-keygen -t rsa -N \"\" -f /root/.ssh/id_rsa"
echo "Installing Docker..."
overcast run $instance install/docker
echo "Installing Discourse..."
overcast run $instance install/discourse_docker \
--env "discourseHostname=\"$discourseHostname\" \
discourseDevEmails=\"$discourseDevEmails\" \
discourseSMTPAddress=\"$discourseSMTPAddress\" \
discourseSMTPPort=\"$discourseSMTPPort\" \
discourseSMTPUsername=\"$discourseSMTPUsername\" \
discourseSMTPPassword=\"$discourseSMTPPassword\""
echo "Starting Discourse..."
overcast run $instance "cd /var/docker; ./launcher start app --skip-prereqs"
echo "Done!"
echo "Your new Discourse instance is ready to go at http://`overcast instance get $instance ip`. Enjoy!"