Formatted the markdowns and moved the venv in .venv

This commit is contained in:
Nicola Belluti
2025-01-23 11:09:14 +01:00
parent 7e61b07542
commit 25974bf32c
3 changed files with 67 additions and 76 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.pyc *.pyc
db.sqlite3 db.sqlite3
gunicorn.conf gunicorn.conf
.venv

View File

@@ -1,6 +1,10 @@
## RDGEN is a RustDesk client generator to use with your self-hosted rustdesk server. # RDGen, a RustDesk client generator to use with your self-hosted RustDesk server
## The client generator is currently hosted [here](https://rdgen.crayoneater.org). If you would like to host the generator yourself, see [here](setup.md) The client generator is currently hosted [here](https://rdgen.crayoneater.org).
If you would like to host the generator yourself, see [here](setup.md)
## This client generator is currently integrated into my rustdesk [api server](https://github.com/bryangerlach/rustdesk-api-server), which is a fork of [rustdesk-api-server](https://github.com/kingmo888/rustdesk-api-server). If you are running my api server, then you will still need to fork RDGEN and go through the setup process, but you won't need to actually run the rdgen server.
This client generator is currently integrated into my rustdesk [api
server](https://github.com/bryangerlach/rustdesk-api-server), which is a fork
of [rustdesk-api-server](https://github.com/kingmo888/rustdesk-api-server). If
you are running my api server, then you will still need to fork RDGen and go
through the setup process, but you won't need to actually run the rdgen server.

128
setup.md
View File

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