mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-09 11:48:20 +00:00
Update README and document WSGI file more.
This commit is contained in:
parent
ae46e6d382
commit
bec8233aad
46
README.md
46
README.md
@ -69,17 +69,16 @@
|
|||||||
# Deployment
|
# Deployment
|
||||||
|
|
||||||
> **NOTE: This tutorial assumes you have a working DLU server instance and**
|
> **NOTE: This tutorial assumes you have a working DLU server instance and**
|
||||||
> **some knowledge of Linux**
|
> **some knowledge of command line interfaces on your chosen platform**
|
||||||
|
|
||||||
|
|
||||||
**It is highly recommended to setup a reverse proxy via nginx or some other tool and use ssl to secure your nexus dashboard instance**
|
**It is highly recommended to setup a reverse proxy via Nginx or some other tool and use SSL to secure your Nexus Dashboard instance if you are going to be opening it up to any non-LANs**
|
||||||
* [How to setup nginx](https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-on-ubuntu-22-04)
|
* [How to setup Nginx](https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-on-ubuntu-22-04)
|
||||||
* [How to use certbot for ssl](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04)
|
* [How to use certbot for SSL](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04)
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
docker run -d \
|
docker run -d \
|
||||||
-e APP_SECRET_KEY='<secret_key>' \
|
-e APP_SECRET_KEY='<secret_key>' \
|
||||||
-e APP_DATABASE_URI='mysql+pymysql://<username>:<password>@<host>:<port>/<database>' \
|
-e APP_DATABASE_URI='mysql+pymysql://<username>:<password>@<host>:<port>/<database>' \
|
||||||
@ -89,7 +88,6 @@ docker run -d \
|
|||||||
-v /path/to/unpacked/client:/app/luclient:rw \
|
-v /path/to/unpacked/client:/app/luclient:rw \
|
||||||
-v /path/to/cachedir:/app/cache:rw \
|
-v /path/to/cachedir:/app/cache:rw \
|
||||||
aronwk/nexus-dashboard:latest
|
aronwk/nexus-dashboard:latest
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* `/app/luclient` must be mapped to the location of an unpacked client
|
* `/app/luclient` must be mapped to the location of an unpacked client
|
||||||
@ -106,37 +104,41 @@ Please Reference `app/settings_exmaple.py` to see all the variables
|
|||||||
* APP_DATABASE_URI (Must be provided)
|
* APP_DATABASE_URI (Must be provided)
|
||||||
* Everything else is optional and has defaults
|
* Everything else is optional and has defaults
|
||||||
|
|
||||||
## Manual
|
## Manual Linux Installation
|
||||||
|
|
||||||
Thanks to [HailStorm32](https://github.com/HailStorm32) for this manual install guide!
|
Thanks to [HailStorm32](https://github.com/HailStorm32) for this manual install guide!
|
||||||
|
|
||||||
### Setting Up The Environment
|
### Setting Up The Environment
|
||||||
First you will want to install the following packages by executing the following commands
|
First you will want to install the following packages by executing the following commands presuming you are on a Debian based system.
|
||||||
|
|
||||||
`sudo apt-get update`
|
`sudo apt-get update`
|
||||||
|
|
||||||
`sudo apt-get install -y python3 python3-pip sqlite3 git unzip libmagickwand-dev`
|
`sudo apt-get install -y python3 python3-pip sqlite3 git unzip libmagickwand-dev`
|
||||||
|
|
||||||
> *Note: If you are having issues with installing `sqlite3`, change it to `sqlite`*
|
> *Note: If you are having issues with installing `sqlite3`, change it to `sqlite`*
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Next we will clone the repository. You can clone it anywhere, but for the purpose of this tutorial, we will be cloning it to the home directory.
|
Next you will want to clone the repository. You can clone it anywhere, but for the purpose of this tutorial, we will be cloning it to the home directory.'
|
||||||
|
<br></br>
|
||||||
|
|
||||||
`cd` *make sure you are in the home directory*
|
Run `cd ~` to ensure that you are currently in the home directory then run the following command to clone the repository into our home directory
|
||||||
`git clone https://github.com/DarkflameUniverse/NexusDashboard.git`
|
`git clone https://github.com/DarkflameUniverse/NexusDashboard.git`
|
||||||
|
|
||||||
You should now have a directory called `NexusDashboard`
|
You should now have a directory called `NexusDashboard` present in your home directory
|
||||||
|
|
||||||
### Setting up
|
### Setting up
|
||||||
|
|
||||||
Rename the example settings file
|
Rename the example settings file
|
||||||
`cp ~/NexusDashboard/app/settings_example.py ~/NexusDashboard/app/settings.py`
|
`cp ~/NexusDashboard/app/settings_example.py ~/NexusDashboard/app/settings.py`
|
||||||
|
|
||||||
Now let's open the settings file we just created and configure some of the settings
|
Now let's open the settings file we just created and configure some of the settings with nano as it is a simple text editor that is easy to use
|
||||||
`vim ~/NexusDashboard/app/settings.py`
|
`nano ~/NexusDashboard/app/settings.py`
|
||||||
>*Feel free to use any text editor you are more comfortable with instead of vim*
|
>*Obviously you can replace this with a text editor of your choice, nano is just the most simple to use out of the ones available by default on most Linux distros*
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Inside this file is where you can change certain settings like user registration, email support and other things. In this tutorial I will only be focusing on the bare minimum to get up and running, but feel free to adjust what you would like
|
Inside this file is where you can change certain settings like user registration, email support and other things. In this tutorial we will only be focusing on the bare minimum to get up and running, but feel free to adjust what you would like to fit your needs.
|
||||||
|
|
||||||
>*Note: Enabling the email option will require further setup that is outside the scope of this tutorial*
|
>*Note: There are options in here that are related to email registration and password recovery among other features however those require extra setup not covered by this tutorial*
|
||||||
|
|
||||||
The two important settings to configure are `APP_SECRET_KEY` and `APP_DATABASE_URI`
|
The two important settings to configure are `APP_SECRET_KEY` and `APP_DATABASE_URI`
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ Put the two folders in `~/NexusDashboard/app/luclient`
|
|||||||
Unzip the `brickdb.zip` in place
|
Unzip the `brickdb.zip` in place
|
||||||
`unzip brickdb.zip`
|
`unzip brickdb.zip`
|
||||||
|
|
||||||
Remove the `.zip` after you have unzipped it
|
Remove the `.zip` file after you have unzipped it, you can do that with
|
||||||
`rm brickdb.zip`
|
`rm brickdb.zip`
|
||||||
|
|
||||||
In the `luclient` directory you should now have a file structure that looks like this
|
In the `luclient` directory you should now have a file structure that looks like this
|
||||||
@ -207,14 +209,14 @@ res
|
|||||||
|
|
||||||
We will also need to copy the `CDServer.sqlite` database file from the server to the `~/NexusDashboard/app/luclient/res` folder
|
We will also need to copy the `CDServer.sqlite` database file from the server to the `~/NexusDashboard/app/luclient/res` folder
|
||||||
|
|
||||||
Once the file is moved over, you will need to rename it to `cdclient.sqlite`
|
Once the file is moved over, you will need to rename it to `cdclient.sqlite`, this can be done with the following command
|
||||||
```bash
|
```bash
|
||||||
mv ~/NexusDashboard/app/luclient/res/CDServer.sqlite ~/NexusDashboard/app/luclient/res/cdclient.sqlite
|
mv ~/NexusDashboard/app/luclient/res/CDServer.sqlite ~/NexusDashboard/app/luclient/res/cdclient.sqlite
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
##### Remaining Setup
|
##### Remaining Setup
|
||||||
Run the following commands one at a time
|
To finish this, we will need to install the python dependencies and run the database migrations, simply run the following commands one at a time
|
||||||
```bash
|
```bash
|
||||||
cd ~/NexusDashboard
|
cd ~/NexusDashboard
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
@ -222,11 +224,11 @@ pip install gunicorn
|
|||||||
flask db upgrade
|
flask db upgrade
|
||||||
```
|
```
|
||||||
##### Running the site
|
##### Running the site
|
||||||
You can run the site with
|
Once all of the above is complete, you can run the site with the command
|
||||||
`gunicorn -b :8000 -w 4 wsgi:app`
|
`gunicorn -b :8000 -w 4 wsgi:app`
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|
||||||
Please use [Editor Config](https://editorconfig.org/)
|
Please use [Editor Config](https://editorconfig.org/) to maintain a consistent coding style between different editors and different contributors.
|
||||||
|
|
||||||
* `flask run` to run local dev server
|
* `python3 -m flask run` to run a local dev server
|
||||||
|
2
entrypoint.bat
Normal file
2
entrypoint.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
python3 -m flask db upgrade
|
||||||
|
python3 wsgi.py
|
16
wsgi.py
16
wsgi.py
@ -1,19 +1,23 @@
|
|||||||
|
from sys import platform
|
||||||
from app import create_app
|
from app import create_app
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|
||||||
|
|
||||||
@app.shell_context_processor
|
@app.shell_context_processor
|
||||||
def make_shell_context():
|
def make_shell_context():
|
||||||
"""Extend the Flask shell context."""
|
"""Extend the Flask shell context."""
|
||||||
return {'app': app}
|
return {'app': app}
|
||||||
|
|
||||||
|
running_directly = __name__ == "__main__"
|
||||||
|
running_under_gunicorn = not running_directly and 'gunicorn' in __name__ and 'linux' in platform
|
||||||
|
|
||||||
if __name__ == '__main__':
|
# Configure development running
|
||||||
|
if running_directly:
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
else:
|
|
||||||
|
# Configure production running
|
||||||
|
if running_under_gunicorn:
|
||||||
import logging
|
import logging
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||||
@ -23,3 +27,7 @@ else:
|
|||||||
file_handler.setFormatter(formatter)
|
file_handler.setFormatter(formatter)
|
||||||
app.logger.addHandler(file_handler)
|
app.logger.addHandler(file_handler)
|
||||||
app.logger.setLevel(gunicorn_logger.level)
|
app.logger.setLevel(gunicorn_logger.level)
|
||||||
|
|
||||||
|
# Error out if nothing has been setup
|
||||||
|
if not running_directly and not running_under_gunicorn:
|
||||||
|
raise RuntimeError('Unsupported WSGI server')
|
||||||
|
Loading…
Reference in New Issue
Block a user