Fix line endings in 50-pandora.sh and make *.sh executable
This commit is contained in:
parent
822dd1552f
commit
ce145b158a
0
01-basic.sh
Normal file → Executable file
0
01-basic.sh
Normal file → Executable file
0
02-sahana.sh
Normal file → Executable file
0
02-sahana.sh
Normal file → Executable file
0
10-seeddms.sh
Normal file → Executable file
0
10-seeddms.sh
Normal file → Executable file
134
50-pandora.sh
Normal file → Executable file
134
50-pandora.sh
Normal file → Executable file
@ -1,67 +1,67 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SOURCE_DIR=$(realpath $(dirname "${0}"))
|
SOURCE_DIR=$(realpath $(dirname "${0}"))
|
||||||
|
|
||||||
# Add pandora repository
|
# Add pandora repository
|
||||||
echo "deb http://ppa.launchpad.net/j/pandora/ubuntu zesty main" > /etc/apt/sources.list.d/pandora.list
|
echo "deb http://ppa.launchpad.net/j/pandora/ubuntu zesty main" > /etc/apt/sources.list.d/pandora.list
|
||||||
apt-key add ${SOURCE_DIR}/pandora/pandora.gpg
|
apt-key add ${SOURCE_DIR}/pandora/pandora.gpg
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
apt-get -y update
|
apt-get -y update
|
||||||
apt-get -y --no-install-recommends install gpac poppler-utils rabbitmq-server python3-setuptools python3-pip virtualenv python3-virtualenv python3-pil python3-numpy python3-psycopg2 python3-pyinotify python3-simplejson python3-lxml python3-html5lib python3-ox oxframe ffmpeg mkvtoolnix youtube-dl
|
apt-get -y --no-install-recommends install gpac poppler-utils rabbitmq-server python3-setuptools python3-pip virtualenv python3-virtualenv python3-pil python3-numpy python3-psycopg2 python3-pyinotify python3-simplejson python3-lxml python3-html5lib python3-ox oxframe ffmpeg mkvtoolnix youtube-dl
|
||||||
# python3-dev imagemagick
|
# python3-dev imagemagick
|
||||||
|
|
||||||
# Clone git repositories
|
# Clone git repositories
|
||||||
git clone --depth 1 https://git.0x2620.org/pandora.git /srv/pandora
|
git clone --depth 1 https://git.0x2620.org/pandora.git /srv/pandora
|
||||||
git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs
|
git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs
|
||||||
git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines
|
git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines
|
||||||
git clone --depth 1 https://git.0x2620.org/python-ox.git /srv/pandora/src/python-ox
|
git clone --depth 1 https://git.0x2620.org/python-ox.git /srv/pandora/src/python-ox
|
||||||
|
|
||||||
# Create python virtualenv
|
# Create python virtualenv
|
||||||
virtualenv --system-site-packages -p /usr/bin/python3 /srv/pandora
|
virtualenv --system-site-packages -p /usr/bin/python3 /srv/pandora
|
||||||
cd /srv/pandora/src/oxtimelines && /srv/pandora/bin/python setup.py develop
|
cd /srv/pandora/src/oxtimelines && /srv/pandora/bin/python setup.py develop
|
||||||
cd /srv/pandora/src/python-ox && /srv/pandora/bin/python setup.py develop
|
cd /srv/pandora/src/python-ox && /srv/pandora/bin/python setup.py develop
|
||||||
/srv/pandora/bin/pip install -r /srv/pandora/requirements.txt
|
/srv/pandora/bin/pip install -r /srv/pandora/requirements.txt
|
||||||
|
|
||||||
# Create PostgreSQL user and database
|
# Create PostgreSQL user and database
|
||||||
export PANDORA_PWD=$(head -c 260 /dev/urandom | tr -cd '[:alnum:]' | head -c 26)
|
export PANDORA_PWD=$(head -c 260 /dev/urandom | tr -cd '[:alnum:]' | head -c 26)
|
||||||
envsubst <${SOURCE_DIR}/pandora/tmp/pandora-createdb.sql >/tmp/pandora-createdb.sql
|
envsubst <${SOURCE_DIR}/pandora/tmp/pandora-createdb.sql >/tmp/pandora-createdb.sql
|
||||||
sudo -u postgres psql -f /tmp/pandora-createdb.sql
|
sudo -u postgres psql -f /tmp/pandora-createdb.sql
|
||||||
rm -f /tmp/pandora-createdb.sql
|
rm -f /tmp/pandora-createdb.sql
|
||||||
|
|
||||||
# Configure RabbitMQ
|
# Configure RabbitMQ
|
||||||
export PANDORA_RABBIT_PWD=$(head -c 260 /dev/urandom | tr -cd '[:alnum:]' | head -c 26)
|
export PANDORA_RABBIT_PWD=$(head -c 260 /dev/urandom | tr -cd '[:alnum:]' | head -c 26)
|
||||||
rabbitmqctl add_user pandora ${PANDORA_RABBIT_PWD}
|
rabbitmqctl add_user pandora ${PANDORA_RABBIT_PWD}
|
||||||
rabbitmqctl add_vhost /pandora
|
rabbitmqctl add_vhost /pandora
|
||||||
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
|
rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
|
||||||
export PANDORA_BROKER_URL="amqp://pandora:${PANDORA_RABBIT_PWD}@localhost:5672//pandora"
|
export PANDORA_BROKER_URL="amqp://pandora:${PANDORA_RABBIT_PWD}@localhost:5672//pandora"
|
||||||
|
|
||||||
# Configure Pandora
|
# Configure Pandora
|
||||||
mkdir /srv/pandora/data
|
mkdir /srv/pandora/data
|
||||||
cp /srv/pandora/pandora/config.pandora.jsonc /srv/pandora/pandora/config.jsonc
|
cp /srv/pandora/pandora/config.pandora.jsonc /srv/pandora/pandora/config.jsonc
|
||||||
cp /srv/pandora/pandora/gunicorn_config.py.in /srv/pandora/pandora/gunicorn_config.py
|
cp /srv/pandora/pandora/gunicorn_config.py.in /srv/pandora/pandora/gunicorn_config.py
|
||||||
envsubst <${SOURCE_DIR}/pandora/srv/pandora/pandora/local_settings.py >/srv/pandora/pandora/local_settings.py
|
envsubst <${SOURCE_DIR}/pandora/srv/pandora/pandora/local_settings.py >/srv/pandora/pandora/local_settings.py
|
||||||
|
|
||||||
# Create OS user
|
# Create OS user
|
||||||
adduser --system --group --home /srv/pandora --shell /bin/false pandora
|
adduser --system --group --home /srv/pandora --shell /bin/false pandora
|
||||||
chown -R pandora:pandora /srv/pandora
|
chown -R pandora:pandora /srv/pandora
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
sudo -u pandora /srv/pandora/pandora/manage.py init_db
|
sudo -u pandora /srv/pandora/pandora/manage.py init_db
|
||||||
|
|
||||||
# Install systemd services
|
# Install systemd services
|
||||||
cp /srv/pandora/etc/systemd/system/*.service /etc/systemd/system/
|
cp /srv/pandora/etc/systemd/system/*.service /etc/systemd/system/
|
||||||
cp /srv/pandora/etc/tmpfiles.d/pandora.conf /etc/tmpfiles.d/
|
cp /srv/pandora/etc/tmpfiles.d/pandora.conf /etc/tmpfiles.d/
|
||||||
systemd-tmpfiles --create /etc/tmpfiles.d/pandora.conf
|
systemd-tmpfiles --create /etc/tmpfiles.d/pandora.conf
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
# Create nginx site definition
|
# Create nginx site definition
|
||||||
cp ${SOURCE_DIR}/pandora/etc/nginx/sites-available/pandora /etc/nginx/sites-available/pandora
|
cp ${SOURCE_DIR}/pandora/etc/nginx/sites-available/pandora /etc/nginx/sites-available/pandora
|
||||||
ln -s /etc/nginx/sites-available/pandora /etc/nginx/sites-enabled/pandora
|
ln -s /etc/nginx/sites-available/pandora /etc/nginx/sites-enabled/pandora
|
||||||
|
|
||||||
# Start services
|
# Start services
|
||||||
for SERVICE in "pandora pandora-tasks pandora-encoding pandora-cron pandora-websocketd"; do
|
for SERVICE in "pandora pandora-tasks pandora-encoding pandora-cron pandora-websocketd"; do
|
||||||
systemctl enable ${SERVICE}
|
systemctl enable ${SERVICE}
|
||||||
systemctl start ${SERVICE}
|
systemctl start ${SERVICE}
|
||||||
done
|
done
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
|
0
99-cleanup.sh
Normal file → Executable file
0
99-cleanup.sh
Normal file → Executable file
Loading…
Reference in New Issue
Block a user