-
-
Save brettpetch/2fb5ed228dca368393d2970a7dc8db03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Run instructions | |
# sudo su - | |
# bash <{curl -sL https://gist.github.com/brettpetch/2fb5ed228dca368393d2970a7dc8db03/raw/5589dff8fd48e172068f213cb3b589df8ccd0616/petio.sh) | |
. /etc/swizzin/sources/functions/os | |
echo "We're going to install Petio... Please wait." | |
echo "making sure wget is installed" | |
apt-get install wget -y | |
echo "Adding mongodb repository" | |
distribution=$(lsb_release -is) | |
codename=$(lsb_release -cs) | |
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - | |
if [[ $distribution == "Ubuntu" ]]; then | |
if [[ $codename =~ ("focal"|"bionic"|"xenial") ]]; then | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/${distribution,,} ${codename}/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list | |
fi | |
elif [[ $distribution == "Debian" ]]; then | |
if [[ $codename =~ ("buster"|"stretch") ]]; then | |
echo "deb http://repo.mongodb.org/apt/${distribution,,} ${codename}/mongodb-org/4.4 main" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list | |
fi | |
fi | |
echo "Updating APT packages" | |
apt-get update | |
echo "installing mongodb" | |
apt-get install -y mongodb-org | |
echo "enabling and staring mongod" | |
systemctl enable --now mongod | |
echo "creating petio user" | |
useradd -M --shell=/bin/false petio | |
echo "installing petio to /opt/" | |
mkdir /opt/Petio | |
echo "downloading..." | |
wget https://petio.tv/releases/latest -O petio-latest.zip | |
unzip petio-latest.zip -d /opt/Petio | |
chown -R petio:petio /opt/Petio | |
chmod +x /opt/Petio/bin/petio-linux | |
cat > /etc/systemd/system/petio.service << PET | |
[Unit] | |
Description=Petio a content request system | |
After=network.target | |
StartLimitIntervalSec=0 | |
[Service] | |
Type=simple | |
Restart=on-failure | |
RestartSec=1 | |
ExecStart=/opt/Petio/bin/petio-linux | |
User=petio | |
[Install] | |
WantedBy=multi-user.target | |
PET | |
if [[ -f /install/.nginx.lock ]]; then | |
echo "Configuring nginx" | |
sleep 10 | |
cat > /etc/nginx/apps/petio.conf << NGX | |
location /petio { | |
include /etc/nginx/snippets/proxy.conf; | |
proxy_pass http://127.0.0.1:7777/petio; | |
} | |
NGX | |
nginx -t | |
systemctl reload nginx | |
echo "nginx config done" | |
if [[ -f /install/.panel.lock ]]; then | |
echo "adding to panel" | |
curl -L "https://github.com/petio-team/petio/raw/master/admin/public/favicon/apple-icon-144x144.png" -o "/opt/swizzin/static/img/apps/petio.png" | |
chown swizzin:swizzin /opt/swizzin/static/img/apps/petio.png | |
cat << EOF >> /opt/swizzin/core/custom/profiles.py | |
class petio_meta(): | |
name = "petio" | |
pretty_name = "petio" | |
baseurl = "/petio" | |
systemd = "petio.service" | |
img = "petio" | |
EOF | |
touch /install/.petio.lock | |
fi | |
fi | |
systemctl daemon-reload | |
systemctl enable --now petio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needed workarounds at time of writing:
After running, go to:
http://<youripaddress>:7777/admin
setup with mongodb set to
localhost:<theoriginalport>
after setup,
sudo systemctl stop petio
sudo nano /opt/Petio/bin/config/config.json
find the bit about
base_path
, set this to/petio
sudo systemctl restart petio
DO NOT RUN THIS TWICE; IT CAN BREAK PANEL
Reading this? Think it's inconvenient to need to go in and add your credentials before we can set baseurl? well, this is for you: petio-team/petio#256