Remove installation scripts

We now handle production deployment using some ansible playbooks based
on these scripts, so rather than having slightly different versions in
two places, I think it’s safer to remove them for now.
This commit is contained in:
John Lees-Miller 2016-06-02 10:39:21 +01:00
parent 8ea3ed5dbe
commit 465db49a22
6 changed files with 11 additions and 208 deletions

View file

@ -4,21 +4,23 @@ writelatex-git-bridge
Required
--------
* `maven` (for building)
* `jdk-7` (for compiling and running)
* `jdk-8` (for compiling and running)
Installation
------------
### Ubuntu ###
Run `./install` to get dependencies, build, test, package, and make it a service.
Use `sudo service wlgb start` and `sudo service wlgb stop` to start and stop the server.
Install dependencies:
The configuration file will be at `/etc/wlgb/config.json`.
```
sudo apt-get update
sudo apt-get install -y maven
sudo apt-get install -y openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/javac
```
Run `./reinstall` to test, package and install the current version if `./install` has already been run.
Create a config file according to the format below.
Run `./uninstall` to undo what `./install` did.
### Manually ###
Run `mvn package` to build, test, and package it into a jar at `target/writelatex-git-bridge-1.0-SNAPSHOT-jar-with-dependencies.jar`.
Use `java -jar <path_to_jar> <path_to_config_file>` to run the server.
@ -26,7 +28,7 @@ Use `java -jar <path_to_jar> <path_to_config_file>` to run the server.
Runtime Configuration
---------------------
The configuration file is in `.json` format. There is an example at `bin/config.json`.
The configuration file is in `.json` format.
{
"port" (int): the port number,

View file

@ -1,14 +0,0 @@
{
"port": 80,
"rootGitDirectory": "/var/wlgb/git",
"apiBaseUrl": "http://127.0.0.1:60000/api/v0",
"username": "REDACTED",
"password": "REDACTED",
"postbackBaseUrl": "http://127.0.0.1",
"serviceName": "Overleaf",
"oauth2": {
"oauth2ClientID": "clientID",
"oauth2ClientSecret": "oauth2 client secret",
"oauth2Server": "https://www.overleaf.com"
}
}

View file

@ -1,159 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: wlgb
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: writelatex-git-bridge
# Description: Init script for writelatex-git-bridge service
# placed in /etc/init.d.
### END INIT INFO
# Author: Winston Li <winston.li12@imperial.ac.uk>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Writelatex-Git Bridge startup and stop script"
NAME=wlgb
DAEMON=/usr/bin/java
DAEMON_ARGS="-jar /usr/local/sbin/writelatex-git-bridge.jar /etc/wlgb/config.json"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
if [ -f "$PIDFILE" ]; then
echo "WriteLatex-Git Bridge is already started: use service wlgb stop to stop."
return 1;
fi
echo "Starting WriteLatex-Git Bridge..."
start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \
--exec /usr/bin/env LANG="C.UTF-8" $DAEMON -- \
$DAEMON_ARGS >> /var/log/wlgb/out.log 2>> /var/log/wlgb/err.log &
echo "WriteLatex-Git Bridge started."
echo "Config file at /etc/wlgb/config.json"
echo "Log file at /var/log/wlgb/out.log"
echo "Error file at /var/log/wlgb/err.log"
echo
return 0
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
if [ -f "$PIDFILE" ]; then
echo "Stopping Writelatex-Git Bridge..."
start-stop-daemon --stop --quiet --retry=TERM/60/KILL/5 --pidfile $PIDFILE
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
echo "WriteLatex-Git Bridge stopped."
return 0
fi
echo "WriteLatex-Git Bridge is not started: use service wlgb start to start."
return 1
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -1,19 +0,0 @@
installDeps() {
sudo apt-get update
sudo apt-get install -y maven
sudo apt-get install -y openjdk-7-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javac
return 1
}
command -v mvn >/dev/null 2>&1 && command -v /usr/lib/jvm/java-7-openjdk-amd64/bin/javac >/dev/null 2>&1 || installDeps
mvn package &&\
sudo cp ./target/writelatex-git-bridge-1.0-SNAPSHOT-jar-with-dependencies.jar /usr/local/sbin/writelatex-git-bridge.jar &&\
sudo cp ./bin/wlgb /etc/init.d/ &&\
sudo mkdir -p /var/log/wlgb &&\
sudo mkdir -p /etc/wlgb &&\
if [ ! -f /etc/wlgb/config.json ]; then
sudo cp ./bin/config.json /etc/wlgb/
fi &&\
sudo /usr/sbin/update-rc.d -f wlgb defaults

View file

@ -1,3 +0,0 @@
command -v mvn >/dev/null 2>&1 || sudo apt-get install maven
mvn package &&\
sudo mv ./target/writelatex-git-bridge-1.0-SNAPSHOT-jar-with-dependencies.jar /usr/local/sbin/writelatex-git-bridge.jar

View file

@ -1,4 +0,0 @@
sudo rm -f /usr/local/sbin/writelatex-git-bridge.jar &&\
sudo rm -f /etc/init.d/wlgb &&\
sudo rm -rf /etc/wlgb
sudo /usr/sbin/update-rc.d -f wlgb remove