From 25974bf32c3aa6efa85cd3d74ba7188f8cd5479f Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Thu, 23 Jan 2025 11:09:14 +0100 Subject: [PATCH] Formatted the markdowns and moved the venv in `.venv` --- .gitignore | 1 + README.md | 12 +++-- setup.md | 130 ++++++++++++++++++++++++----------------------------- 3 files changed, 67 insertions(+), 76 deletions(-) diff --git a/.gitignore b/.gitignore index 9bad987..402d3e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc db.sqlite3 gunicorn.conf +.venv diff --git a/README.md b/README.md index edf533b..ef55fee 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/setup.md b/setup.md index 13251a5..b8c8f67 100644 --- a/setup.md +++ b/setup.md @@ -1,92 +1,76 @@ ## To fully host the client generator yourself, you will need to following: -
    -
  1. A Github account with a fork of this repo
  2. -
  3. 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
    • -
    -
  4. -
  5. 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 -
  6. -
  7. optional github secrets (for signing the code): -
      -
    • WINDOWS_PFX_BASE64
    • -
    • WINDOWS_PFX_PASSWORD
    • -
    • WINDOWS_PFX_SHA1_THUMBPRINT
    • -
  8. - - -
+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: - +* 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 -``` \ No newline at end of file +```