Hello, i had the same wish as you do, and i inspired myself from “Installation with SQLite - Seafile Admin Manual” (cannot add links as a new member) and applied it to a Debian 11 (i’m using sqlite as i have a handful of users, and i decided to skip memcached, just because)
Install system base packages :
- apt-get install -y python3-venv python3 python3-setuptools python3-pip pwgen sqlite3
Install system packages to be able to build some pip packages
- apt-get install -y build-essential python3-dev libffi-dev
Then for the install itself :
- mkdir -p ~/example
- cd ~/example
- tar xf seafile-server_9.0.9_x86-64.tar.gz
- python3 -m venv venv
- source venv/bin/activate
Install (or compile) pip packages
- pip3 install --timeout=3600 django==2.2.* future Pillow pylibmc captcha jinja2 psd-tools django-pylibmc django-simple-captcha pycryptodome==3.12.0 cffi==1.14.0
Run the rest of the install according to the documentation…
Then finally stop everything, both seahub and seafile.
You were still using the venv settings implicitely
Now we want to work without it, so we “deactivate”
- deactivate
This clears the venv environment variables, and ensure the wrapper script actually does its job properly (i.e. applying the venv settings for each command) instead of using your current shell “venv” environment variables, which is what we have been doing so far
Then go back to base folder :
- cd ~/example
Now prepare a wrapper script to apply the venv before each command :
#!/usr/bin/env bash
[ $# -ne 2 ] && exit
[[ "$1" == "seafile.sh" || "$1" == "seahub.sh" ]] || exit
[[ "$2" == "start" || "$2" == "stop" || "$2" == "restart" ]] || exit
BASE=<<set to the absolute path to the folder containing seafile-server-latest and venv>>
source $BASE/venv/bin/activate
$BASE/seafile-server-latest/$1 $2
And put this script into the $BASE folder too (with venv and seafile-server-latest)
Then follow “Start Seafile at System Bootup - Seafile Admin Manual” (again, i cannot link as a new member) :
- Just change ${seafile_dir} in these script as explaing, and set it to the same $BASE folder above (where venv and seafile-server-latest are)
Create the service files :
-
/etc/systemd/system/seafile.service
…
ExecStart=${seafile_dir}/venv-wrapper.sh seafile.sh start
ExecStop=${seafile_dir}/venv-wrapper.sh seafile.sh stop
… -
/etc/systemd/system/seahub.service
…
ExecStart=${seafile_dir}/venv-wrapper.sh seahub.sh start
ExecStop=${seafile_dir}/venv-wrapper.sh seahub.sh stop
…
And finally use and test them :
- sudo systemctl daemon-reload
- sudo systemctl start seafile.service
- ps auxf # to check that it is running
- sudo systemctl start seahub.service
- ps auxf # to check that it is running
- sudo systemctl stop seahub.service
- ps auxf # to check that it stopped
- sudo systemctl stop seafile.service
- ps auxf # to check that it stopped
Now you know the venv-wrapper is working correctly, enable auto-startup :
- sudo systemctl enable seafile.service
- sudo systemctl enable seahub.service
And reboot to verify that it is started automatically
Cheers,
Nicolas