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
db.sqlite3
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)
## 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.
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.

130
setup.md
View File

@@ -1,92 +1,76 @@
## To fully host the client generator yourself, you will need to following:
<ol>
<li>A Github account with a fork of this repo </li>
<li>A Github fine-grained access token with permissions for your rdgen repository
<ul>
<li>login to your github account </li>
<li>click on your profile picture at the top right, click Settings </li>
<li>at the bottom of the left panel, click Developer Settings </li>
<li>click Personal access tokens </li>
<li>click Fine-grained tokens </li>
<li>click Generate new token </li>
<li>give a token name, change expiration to whatever you want </li>
<li>under Repository acces, select Only select repositories, then pick your rdgen repo </li>
<li>give Read and Write access to actions and workflows </li>
</ul>
</li>
<li>Setup environment variables / secrets:
<ul>
<li>environment variables on the server running rdgen:
<ul>
<li>GHUSER="your github username" </li>
<li>GHBEARER="your fine-graned access token" </li>
</ul></li>
<li>github secrets (setup on your github account for your rdgen repo):
<oul>
<li>GENURL="example.com:8000" </li>
*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>
1. A Github account with a fork of this repo
2. 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 access, select Only select repositories, then pick your
rdgen repo
* give Read and Write access to actions and workflows
3. Setup environment variables/secrets:
* environment variables on the server running rdgen:
* GHUSER="your github username"
* GHBEARER="your fine-grained access token"
* github secrets (setup on your github account for your rdgen repo):
* GENURL="example.com:8000" *this is the domain and port that you are
running rdgen on, needs to be accessible on the internet, depending
on how you have this setup the port may not be needed
* 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)
```
# 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
### 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
use nginx, caddy, traefik, etc. for ssl reverse proxy
## A few notes:
<ul>
<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>
<li>If you are running on http instead of https, make sure to make the change on line 70 of views.py</li>
</ul>
* 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/systemd/system/rdgen.service, and make sure to change GHUSER, GHBEARER
replace user, group, and port if you need to replace /opt with wherever you
have installed rdgen save the following file as
/etc/systemd/system/rdgen.service, and make sure to change GHUSER, GHBEARER
```
[Unit]
Description=Rustdesk Client Generator
@@ -96,7 +80,7 @@ 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
ExecStart=/opt/rdgen/.venv/bin/python3 /opt/rdgen/manage.py runserver 0.0.0.0:8000
WorkingDirectory=/opt/rdgen/
User=root
Group=root
@@ -109,7 +93,9 @@ RestartSec=10
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 start rdgen.service
@@ -117,4 +103,4 @@ sudo systemctl start rdgen.service
and to get the status of the server, run:
```
sudo systemctl status rdgen.service
```
```