made simple path change and added documentation pt 1

This commit is contained in:
Daniel Schick 2023-10-16 15:34:18 +02:00
parent 0b5063a9bc
commit fe53c85447
2 changed files with 45 additions and 2 deletions

43
misc/Deployment.md Normal file
View File

@ -0,0 +1,43 @@
# System deployment
___
## Prerequisites
## Client
## Database
## Backend / Flask app
In order to not have complicated and error-prone copying manoevers a direct deployment from the repo is used using git.
### File structure
### Steps
1) Created a ssh-key for the user that does the installation on the server following the Github [instructions](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
2) Deploy generated key to the Github user account.
3) In the shell, activate ssh-agent and add the key. For example:
```bash
eval ($ssh-agent)
ssh-add ~/.ssh/od_ed25519
```
4) Change to deployment folder
```bash
cd /var/www/brecal_test
```
5) Perform sparse checkout on the Flask server subtree
```bash
git clone -n git@github.com:puls200/brecal.git <target_folder>
cd <target_folder>
git sparse-checkout set --no-cone src/server
git checkout
```
6) Database credentials are stored outside the web root, we are using /var/www/secure. Here the file ```connection_data.json``` is placed, a different named copy for each instance.

View File

@ -9,7 +9,7 @@ connection_pool = None
def initPool():
try:
config_path = './src/server/BreCal/connection_data.json'
config_path = '../../../../secure/connection_data_test.json'
print (os.getcwd())
if not os.path.exists(config_path):
print ('cannot find ' + config_path)
@ -31,7 +31,7 @@ def initPool():
print(e)
def getPoolConnection():
config_path = './src/server/BreCal/connection_data.json'
config_path = '../../../../secure/connection_data_test.json'
f = open(config_path);
connection_data = json.load(f)
return mysql.connector.connect(**connection_data)