First installer version
parent
5c233f6c11
commit
377da58b04
|
@ -0,0 +1,6 @@
|
||||||
|
Types: deb
|
||||||
|
URIs: http://ftp.de.debian.org/debian
|
||||||
|
Suites: buster
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-buster-stable.gpg
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Gunicorn instance to serve repo_api
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
WorkingDirectory=/opt/opengnsys/ogrepository/api
|
||||||
|
ExecStart=/usr/bin/gunicorn -w 4 -b 0.0.0.0:8006 repo_api:app
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
GIT_BRANCH=$1
|
||||||
|
GIT_REPO=https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git
|
||||||
|
INSTALL_DIR=/opt/opengnsys/ogrepository
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
export DEBIAN_FRONTEND
|
||||||
|
|
||||||
|
clone_repository() {
|
||||||
|
local BRANCH=$1
|
||||||
|
git clone -b "$BRANCH" $GIT_REPO /tmp/ogrepository
|
||||||
|
chown -R ogrepository:ogrepository /tmp/ogrepository
|
||||||
|
}
|
||||||
|
|
||||||
|
check_root() {
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_user_ogrepository() {
|
||||||
|
useradd -r -s /bin/bash ogrepository
|
||||||
|
}
|
||||||
|
|
||||||
|
create_directories() {
|
||||||
|
mkdir -p $INSTALL_DIR
|
||||||
|
mkdir -p $INSTALL_DIR/images $INSTALL_DIR/images_trash/ $INSTALL_DIR/bin/ $INSTALL_DIR/etc/ $INSTALL_DIR/log/
|
||||||
|
chown -R ogrepository:ogrepository $INSTALL_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
install_dependencies() {
|
||||||
|
apt update -y
|
||||||
|
apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn
|
||||||
|
}
|
||||||
|
|
||||||
|
install_ext_repo() {
|
||||||
|
cp installer/files/ctorrent.sources /etc/apt/sources.list.d/ctorrent.sources
|
||||||
|
apt update -y
|
||||||
|
}
|
||||||
|
|
||||||
|
install_external_packages() {
|
||||||
|
apt install -y bittorrent bittornado ctorrent
|
||||||
|
}
|
||||||
|
|
||||||
|
install_ogrepo-api_service() {
|
||||||
|
cp -r installer/files/ogrepo-api.service /etc/systemd/system/ogrepo-api.service
|
||||||
|
systemctl enable --now ogrepo-api
|
||||||
|
systemctl start ogrepository
|
||||||
|
}
|
||||||
|
|
||||||
|
install_files() {
|
||||||
|
install bin/* /opt/opengnsys/bin/
|
||||||
|
install bin/clients/* /opt/opengnsys/bin/clients
|
||||||
|
install etc/* /opt/opengnsys/etc/
|
||||||
|
install api/* /opt/opengnsys/api
|
||||||
|
}
|
||||||
|
|
||||||
|
## Main program
|
||||||
|
check_root
|
||||||
|
install_dependencies
|
||||||
|
add_user_ogrepository
|
||||||
|
git_clone_repository "$GIT_BRANCH"
|
||||||
|
create_directories
|
||||||
|
install_ogrepo-api_service
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue