You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To contribute to the MapSwipe back-end please create dedicated feature branches based on the `dev` branch. After the changes create a Pull Request of the `feature` branch into the `dev` branch on GitHub:
29
+
30
+
```bash
31
+
git checkout dev
32
+
git checkout -b featureA
33
+
# Hack away ...
34
+
git commit -am 'Describe changes.'
35
+
git push -u origin featureA
36
+
# Create a Pull Request from feature branch into the dev branch on GitHub.
37
+
```
38
+
39
+
> Note: If a bug in production (master branch) needs fixing before a new versions of MapSwipe Workers gets released (merging dev into master branch), a hotfix branch should be created. In the hotfix branch the bug should be fixed and then merged with the master branch (and also dev).
40
+
41
+
42
+
### Style Guide
43
+
44
+
This project uses [black](https://github.com/psf/black) and [flake8](https://gitlab.com/pycqa/flake8) to achieve a unified style.
45
+
46
+
Use [pre-commit](https://pre-commit.com/) to run `black` and `flake8` prior to any git commit. `pre-commit`, `black` and `flake8` should already be installed in your virtual environment since they are listed in `requirements.txt`. To setup pre-commit simply run:
47
+
48
+
```
49
+
pre-commit install
50
+
```
51
+
52
+
From now on `black` and `flake8` should run automatically whenever `git commit` is executed.
23
53
24
54
25
55
## License
26
56
27
57
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details
Create a Python virtual environment and activate it. Install MapSwipe Workers using pip:
16
-
17
-
```bash
18
-
python -m venv venv
19
-
source venv/bin/activate
20
-
pip install --editable .
21
-
```
3
+
This document describes how to setup Python MapSwipe Workers locally without using the provided Dockerfile for development purposes.
22
4
23
5
24
6
## Feature Branch
25
7
26
-
To contribute to the MapSwipe back-end please create dedicated feature branches from dev:
8
+
To contribute to the MapSwipe back-end please create dedicated feature branches based on the `dev` branch:
27
9
28
10
```bash
29
11
git checkout dev
30
12
git checkout -b featureA
31
-
git commit -am 'add new project type'
13
+
# Hack away ...
14
+
git commit -am 'Describe changes.'
32
15
git push -u origin featureA
33
-
git request-pull origin/dev featureA
16
+
# Create a Pull Request from feature branch into the dev branch on GitHub.
34
17
```
35
18
36
-
> Note: If a bug in production (master branch) needs fixing before a new versions of MapSwipe Workers gets released (merging dev into master branch), a hotfix branch should be created. In the hotfix branch the bug should be fixed and then merged back with master and also dev.
19
+
> Note: If a bug in production (master branch) needs fixing before a new versions of MapSwipe Workers gets released (merging dev into master branch), a hotfix branch should be created. In the hotfix branch the bug should be fixed and then merged with the master branch (and also dev).
Copy file name to clipboardExpand all lines: docs/source/dev_setup.md
+54-32Lines changed: 54 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,47 +1,69 @@
1
1
# Development Setup
2
2
3
-
In this document some tips and workflows for development are loosely collected. Those are independend of the production setup and Docker. A working Firebase Project (including Firebase Functions and Database Rules) is presupposed.
3
+
In this document some tips and workflows for development are loosely collected. Those are independend of the production setup using Docker. A working Firebase Project (including Firebase Functions and Database Rules) is presupposed.
4
4
5
5
6
-
1. Install GDAL (python-gdal)
7
-
2. Setup virtual environment with system-site-packages enabled (To get access to GDAL)
8
-
-`python3 -m venv --system-site-packages venv`
9
-
3. Activate virtual environment
10
-
-`source venv/bin/activate`
11
-
4. Install mapswipe_workers
12
-
-`pip install -e .`
13
-
5. Configure MapSwipe Workers as described in the section 'MapSwipe Workers Setup' in the [Setup](setup.md) chapter
14
-
- Make sure configuration and data paths are created and permissions are set as described in the next section [Configuration and data path](#Configurationa_and_data_path).
15
-
- Move the configuration (`config/configuration.json`) and the Service Account Key (`config/serviceAccountKey.json`) to `/usr/share/config/mapswipe_workers/`
Alternatively you can change the PATH variables in `definitions.py` to your desired path. Except of the path for logs. This is defined in `logging.cfg`.
61
+
Or set up your own using the `initdb.sql` file inthe `postgres/` folder
40
62
41
63
42
64
## Logging
43
65
44
-
Mapswipe workers logs are generated using the Python logging module of the standard library (See [Official docs](https://docs.python.org/3/library/logging.html) or this [Tutorial](https://realpython.com/python-logging/#the-logging-module). The configuration file of the logging module is located at `mapswipe_workers/logging.cfg`. With this configuration a logger object is generated in the `definitions` module (`mapswipe_workers.definitions.py`) and is imported in other modules to write logs.
66
+
Mapswipe workers logs are generated using the Python logging module of the standard library (See [Official docs](https://docs.python.org/3/library/logging.html) or this [Tutorial](https://realpython.com/python-logging/#the-logging-module). The configuration file of the logging module is located at `~/.config/mapswipe_workers/logging.cfg`. With this configuration a logger object is generated in the `definitions` module (`mapswipe_workers/definitions.py`) and is imported by other modules for writing logs.
45
67
46
68
```python
47
69
from mapswipe_workers.definitions import logger
@@ -50,12 +72,12 @@ logger.waring('warning')
50
72
51
73
# Include stack trace in the log
52
74
try:
53
-
print(something)
75
+
do_something()
54
76
except Exception:
55
-
logger.exception('something')
77
+
logger.exception('Additional information.')
56
78
```
57
79
58
-
Default logging level is Warning. To change the logging level edit the configuration (`mapswipe_workers/logging.cfg`).
80
+
Default logging level is Info. To change the logging level edit the configuration. Logs are written to STDOUT and `~/.local/share/mapswipe_workers/mapswipe_workers.log`.
59
81
60
82
Per default logging of third-party packages is disabled. To change this edit the definition module (`mapswipe_workers/defintions.md`). Set the `disable_existing_loggers` parameter of the `logging.config.fileConfig()`functionto False.
Copy file name to clipboardExpand all lines: docs/source/installation.md
+5-17Lines changed: 5 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -251,28 +251,16 @@ certbot certonly \
251
251
--non-interactive
252
252
```
253
253
254
+
> Note: Certbot systemd timer for renewal of certificate will not work for standalone certificates because the service (docker nginx) which occupies port 80 has to be stopped before renewal.
254
255
255
-
Enable and start Certbot systemd timer for renewal of certificates:
256
+
For certificate renewal a cronjob is used:
256
257
257
258
```bash
258
-
systemctl enable certbot.timer
259
-
systemctl start certbot.timer
260
-
# To check if certbot.timer is enabled run:
261
-
systemctl list-units --type timer | grep certbot
262
-
```
263
-
264
-
Add renewal post hook to reload nginx after certificate renwal:
0 commit comments