This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
forked from Erudika/scoold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
executable file
·50 lines (44 loc) · 1.48 KB
/
installer.sh
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
#!/bin/bash
set -e -x
# Lightsail/DigitalOcean installer script for Ubuntu
VERSION="1.50.1"
PORT="8000"
WORKDIR="/home/ubuntu"
JARURL="https://github.com/Erudika/scoold/releases/download/${VERSION}/scoold-${VERSION}.jar"
sfile="/etc/systemd/system/scoold.service"
apt-get update && apt-get install -y wget openjdk-11-jre &&
wget -O scoold.jar ${JARURL} && \
mv scoold.jar $WORKDIR && \
chown ubuntu:ubuntu ${WORKDIR}/scoold.jar && \
chmod +x ${WORKDIR}/scoold.jar
touch ${WORKDIR}/application.conf && \
chown ubuntu:ubuntu ${WORKDIR}/application.conf
# Feel free to modify the Scoold configuration here
cat << EOF > ${WORKDIR}/application.conf
scoold.app_name = "Scoold"
scoold.port = 8000
scoold.env = "production"
scoold.host_url = "http://localhost:8000"
scoold.para_endpoint = "https://paraio.com"
scoold.para_access_key = "app:myapp"
scoold.para_secret_key = ""
scoold.admins = "[email protected]"
EOF
touch $sfile
cat << EOF > $sfile
[Unit]
Description=Scoold
After=syslog.target
[Service]
WorkingDirectory=${WORKDIR}
SyslogIdentifier=Scoold
ExecStart=java -jar -Dconfig.file=application.conf scoold.jar
User=ubuntu
[Install]
WantedBy=multi-user.target
EOF
# This is optional. These rules might interfere with other web server configurations like nginx and certbot.
#iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-port ${PORT} && \
#iptables -t nat -A OUTPUT -p tcp --dport 80 -o lo -j REDIRECT --to-port ${PORT}
systemctl enable scoold.service && \
systemctl start scoold.service