Skip to content

Commit

Permalink
added installer.sh Bash script for Debian distros
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Aug 14, 2024
1 parent 460f93d commit 30cbb81
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ echo "---"
read -e -p "New version: " ver
read -e -p "New dev version: " devver
#sed -i -e "s/PARA_VERSION=.*/PARA_VERSION="\"$ver\""/g" Dockerfile Dockerfile-base && \
sed -i -e "s/$lastver/$ver/g" installer.sh
git add -A && git commit -m "Release v$ver." && git push origin master

mvn --batch-mode -Dtag=v${ver} release:prepare -Dresume=false -DreleaseVersion=${ver} -DdevelopmentVersion=${devver}-SNAPSHOT && \
Expand Down
51 changes: 51 additions & 0 deletions installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -e -x

# Lightsail/DigitalOcean installer script for Ubuntu
VERSION="1.50.2"
PORT="8080"
WORKDIR="/home/ubuntu/para"
mkdir $WORKDIR

JARURL="https://oss.sonatype.org/service/local/repositories/releases/content/com/erudika/para-jar/${VERSION}/para-jar-${VERSION}.jar"
sfile="/etc/systemd/system/para.service"

apt-get update && apt-get install -y wget openjdk-21-jre &&
wget -O para.jar ${JARURL} && \
mv para.jar $WORKDIR && \
chown ubuntu:ubuntu ${WORKDIR}/para.jar && \
chmod +x ${WORKDIR}/para.jar
touch ${WORKDIR}/application.conf && \
chown ubuntu:ubuntu ${WORKDIR}/application.conf

# Feel free to modify the Para configuration here
cat << EOF > ${WORKDIR}/application.conf
para.app_name = "Para"
para.port = 8080
para.env = "production"
EOF

touch $sfile
cat << EOF > $sfile
[Unit]
Description=Para
After=syslog.target
StartLimitIntervalSec=30
StartLimitBurst=2
[Service]
WorkingDirectory=${WORKDIR}
SyslogIdentifier=Para
ExecStart=java -jar -Dconfig.file=application.conf para.jar
User=ubuntu
Restart=on-failure
RestartSec=1s
[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 para.service && \
systemctl start para.service

0 comments on commit 30cbb81

Please sign in to comment.