3.2 KiB
Installing NewLeaf
System dependencies
- python3 (v3.7+ ?)
- python3-venv
Prepare
We suggest you create a new user to run NewLeaf as, for security reasons.
# adduser cloudtube
# su cloudtube
Installing
Clone the repo:
$ git clone https://git.sr.ht/~cadence/NewLeaf
$ cd NewLeaf
Create a Python virtual environment, for separating dependencies:
Note: /bin/activate only works with the bash shell. See here for fish shell.
$ python3 -m venv newleaf-venv
$ source newleaf-venv/bin/activate
Install dependencies:
$ pip3 install -r requirements.txt
Set up the configuration. Configuration is read from the filename configuration.py. Copy the sample file to that name, then edit it.
$ cp configuration.sample.py configuration.py
$ $EDITOR configuration.py
All done! Start NewLeaf:
$ python3 index.py
In the future, from a new terminal session, NewLeaf can be started with:
$ cd [installation directory]
$ source newleaf-venv/bin/activate
$ python3 index.py
Updating
$ cd [installation directory]
$ source newleaf-venv/bin/activate
$ git pull
$ pip3 install -r requirements.txt
Then start:
$ python3 index.py
systemd service
If you want to control the services with systemd, you can use these files. This is optional.
This service should be run as the cloudtube user rather than as the system.
You may need to adjust the paths in these files.
As user service
If you find that these processes terminate when you log out, see the documentation for libpam-systemd and logind.conf.
[Unit]
Description=NewLeaf
[Service]
Type=simple
ExecStart=/usr/local/bin/python3 /home/cloudtube/NewLeaf/index.py
WorkingDirectory=/home/cloudtube/NewLeaf
# Restart timing
Restart=always
RestartSec=60
# Disable logs
StandardOutput=null
StandardError=null
SyslogIdentifier=newleaf
[Install]
WantedBy=multi-user.target
Save to ~/.config/systemd/user/newleaf.service.
As system service
[Unit]
Description=NewLeaf
After=network.target
[Service]
Type=simple
ExecStart=/home/cloudtube/newleaf-venv/bin/python3 /home/cloudtube/NewLeaf/index.py
WorkingDirectory=/home/cloudtube/NewLeaf
# Restart timing
Restart=always
RestartSec=60
# Disable logs
StandardOutput=null
StandardError=null
SyslogIdentifier=newleaf
# User to run as
User=cloudtube
[Install]
WantedBy=multi-user.target
Save to /etc/systemd/system/newleaf.service.
Start service
$ systemctl daemon-reload
$ systemctl start newleaf
...and if all is successful...
$ systemctl enable newleaf
nginx reverse proxy
This will allow people to access NewLeaf over HTTPS and without a port number in the URL.
You should do this if:
- You will run a public NewLeaf instance
- You will run a public CloudTube instance (NewLeaf also needs to be public)
If this installation is a test, or for your personal use, you don't need to do this.
Follow the steps on the nginx documentation page →