3.9 KiB
3.9 KiB
To fully host the client generator yourself, you will need to following:
- A Github account with a fork of this repo
- A Github fine-grained access token with permissions for your rdgen repository
- login to your github account
- click on your profile picture at the top right, click Settings
- at the bottom of the left panel, click Developer Settings
- click Personal access tokens
- click Fine-grained tokens
- click Generate new token
- give a token name, change expiration to whatever you want
- under Repository acces, select Only select repositories, then pick your rdgen repo
- give Read and Write access to actions and workflows
- Setup environment variables / secrets:
- environment variables on the server running rdgen:
- GHUSER="your github username"
- GHBEARER="your fine-graned access token"
- github secrets (setup on your github account for your rdgen repo):
- GENURL="example.com:8000" *this is the domain and port that your are running rdgen on, needs to be accesible on the internet, depending on how you have this setup the port may not be needed
- environment variables on the server running rdgen:
- optional github secrets (for signing the code):
- WINDOWS_PFX_BASE64
- WINDOWS_PFX_PASSWORD
- WINDOWS_PFX_SHA1_THUMBPRINT
To run rdgen on your server:
open to the directory you want to install rdgen (change /opt to wherever you want)
cd /opt
clone your rdgen repo, change bryangerlach to your github username
open the rdgen directory
cd rdgen
setup a python virtual environment called rdgen
python -m venv rdgen
activate the python virtual environment
source rdgen/bin/activate
install the python dependencies
pip install -r requirements.txt
setup the database
python manage.py migrate
run the server, change 8000 with whatever you want
python manage.py runserver 0.0.0.0:8000
open your web browser to yourdomain:8000
use nginx, caddy, traefik, etc. for ssl reverse proxy
A few notes:
- If you change your repository name, make sure to change the url on lines 161-168 of views.py to reflect the change
- If you are running on http instead of https, make sure to make the change on line 70 of views.py
To autostart the server on boot, you can set up a systemd service called rdgen.service
replace user, group, and port if you need to
replace /opt with wherever you have installed rdgen
save the following file as /etc/systed/system/rdgen.service, and make sure to change GHUSER, GHBEARER
[Unit]
Description=Rustdesk Client Generator
[Service]
Type=simple
LimitNOFILE=1000000
Environment="GHUSER=yourgithubusername"
Environment="GHBEARER=yourgithubtoken"
PassEnvironment=GHUSER GHBEARER
ExecStart=/opt/rdgen/rdgen/bin/python3 /opt/rdgen/manage.py runserver 0.0.0.0:8000
WorkingDirectory=/opt/rdgen/
User=root
Group=root
Restart=always
StandardOutput=file:/var/log/rdgen.log
StandardError=file:/var/log/rdgen.error
# Restart service after 10 seconds if node service crashes
RestartSec=10
[Install]
WantedBy=multi-user.target
then run this to enable autostarting the service on boot, and then start it manually this time:
sudo systemctl enable rdgen.service
sudo systemctl start rdgen.service
and to get the status of the server, run:
sudo systemctl status rdgen.service