(The non-Docker way)
Create a new user to run HP
adduser hastypaste --disabled-password
Clone Hasty Paste
git clone https://github.com/enchant97/hasty-paste /opt/
Ensure ownership is correct
chown hastypaste:hasypaste -R /opt/hasty-paste
Login in the new HP user
su - hastypaste
cd into the new installation directory
cd hasty-paste
Use make to create a new Python venv
make py-venv
Active the new venv
source .venv/bin/activate
Run the installation
make py-install
Create a .env file with the following contents
STORAGE__DISK__PASTE_ROOT=data/
TIME_ZONE=America/Denver
NEW_AT_INDEX=true
UI_DEFAULT__EXPIRE_TIME__ENABLE=true
UI_DEFAULT__EXPIRE_TIME__HOURS=0
UI_DEFAULT__EXPIRE_TIME__DAYS=7
Test that HP starts and works
hypercorn 'asgi:paste_bin.main:create_app()' --bind 0.0.0.0:8000 --workers 1
Create a new service file
vim /etc/systemd/system/hastypaste.service
Use the following config
[Unit]
Description=Hasty Paste
After=network.target
StartLimitIntervalSec=2
[Service]
Type=simple
Restart=on-falure
RestartSec=5
WorkingDirectory=/opt/hasty-paste/
VIRTUAL_ENV=/opt/hasty-paste/.venv
User=root
ExecStart=/opt/hasty-paste/.venv/bin/python3 -m hypercorn 'asgi:paste_bin.main:create_app()' --bind 0.0.0.0:8000 --workers 1
ExecStop=/bin/kill -TERM $MAINPID
[Install]
WantedBy=multi-user.target
Reload
systemctl daemon-reload
Enable and start
systemctl enable hastypaste.service
systemctl start hastypaste.service
systemctl stop hastypaste.service
su - hastypaste
cd /opt/hasty-paste/
source .venv/bin/activate
git pull
make py-install
systemctl restart hastypaste.service