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
This document describes all configuration details used by the python-mapswipe-workers. By the end of this document the following configuration files will be set up:
3
-
4
-
*`.env`
5
-
*`mapswipe_workers/config/configuration.json`
6
-
*`mapswipe_workers/config/serviceAccountKey.json`
7
-
*`manager_dashboard/manager_dashboard/js/app.js`
8
-
*`nginx/nginx.conf`
9
-
10
-
## Google APIs & Services Credentials
11
-
The python-mapswipe workers use a bunch of services provided by Google Cloud Platform. It's best to start to configure all api keys we need later directly from the beginning in Google APIs & Services.
12
-
1. Open [Google APIs & Services > Credentials](https://console.cloud.google.com/apis/credentials)
13
-
2. Create API key for MapSwipe workers:
14
-
* set name of api key to `mapswipe_workers_api_key`
15
-
* set Application restrictions > IP addresses > set IP addresse of mapswipe workers server`
16
-
* set API restrictions > Restrict Key > Identity Toolkit API
17
-
3. Create API key for Manager Dashboard:
18
-
* set name of api key to `manager_dashboard_api_key`
19
-
* set Application restrictions > HTTP referrers > set HTTP referrer of managers dashboard (e.g. `https://dev.mapswipe.org`)
20
-
* set API restrictions > Restrict Key > Identity Toolkit API and Cloud Functions API
21
-
4. Also make sure to configure the API keys for the App side here.
1
+
<!--
22
2
23
3
Then set up a Service Account Key file:
24
4
1. Open [Google Cloud Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)
@@ -28,7 +8,12 @@ Then set up a Service Account Key file:
28
8
3. Download Key as file:
29
9
* select `.json` and save
30
10
11
+
12
+
13
+
14
+
31
15
## Firebase
16
+
32
17
Firebase is a central part of MapSwipe. In our setup we use *Firebase Database*, *Firebase Database Rules* and *Firebase Functions*. In the documentation we will refer to two elements:
33
18
1. `your_project_id`: This is the name of your Firebase project (e.g. *dev-mapswipe*)
34
19
2. `your_database_name`: This is the name of your Firebase database. It is very likely that this will be the same as your Firebase project name as well.)
@@ -67,89 +52,148 @@ The `firebase` module uses the [Firebase Command Line Interface (CLI) Tools](htt
67
52
FIREBASE_TOKEN="your_token"
68
53
```
69
54
70
-
## Postgres
71
-
The `postgres` module initializes a Postgres database. When running Postgres using the provided Dockerfile it will setup the database during the build. A Postgres password has to be defined in an environment file in the same directory as the `docker-compose.yaml` file (root). Add the following line to your `.env` file:
55
+
-->
72
56
73
-
```bash
74
-
POSTGRES_PASSWORD=your_mapswipe_db_password
75
-
```
57
+
# Configuration Reference
76
58
77
-
The `mapswipe_workers` module write data to the Postgres database and generate files for the `api` module based on views in Postgres. You need to provide information on Postgres in your `mapswipe_workers/config/configuration.json`.:
59
+
This document provides details on all required configuration files:
We back up the Postgres database using [Wal-G](https://github.com/wal-g/wal-g) and [Google Cloud Storage](https://console.cloud.google.com/storage). You could also set it up using another cloud storage service.
79
+
You can run the script `test_config.py` to check if you set all the needed variables and file. The script will test the following files:
91
80
92
-
First, create a new cloud storage bucket:
93
-
1. Google Cloud Platform > Storage > Create Bucket
94
-
2. Choose a bucket name, e.g. `your_project_id_postgres_backup`
We need to access Google Cloud Storage. For this we use the previously generated Service Account Key. (Check the *Google APIs and Services Credentials* section again if you don't have it.) Copy the file to `postges/serviceAccountKey.json`.
The environment file (`.env`) contains all variables needed by services running in Docker container.
104
85
105
-
## Nginx
106
-
The `nginx` module serves the MapSwipe API and Manager Dashboard. If you want these point to a specific domain, make sure to set it up. In our setup we use Google domains. Other tools will work similar.
86
+
```.env
87
+
POSTGRES_PASSWORD=password
107
88
108
-
Once you got your domain name add it to `nginx/nginx.conf`:
89
+
# Google Cloud Storage path for backups of Postgres
90
+
WALG_GS_PREFIX=gs://x4m-test-bucket/walg-folder
109
91
92
+
# Token for deployment of Firebase Rules and Functions
To enable SSL for the API and MapSwipe Manager Dashboard we use [Certbot](https://certbot.eff.org/) to issue standalone certificates using [Let's Encrypt](https://letsencrypt.org/).
115
98
116
-
## Imagery
117
-
MapSwipe uses satellite imagery provided by Tile Map Services (TMS). If you are not familiar with the basic concept have a look at [Bing's documentation](https://docs.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system). Make sure to get api keys for the services you would like to use in your app. For each satellite imagery provider add an `api_key` and `url`. You need to provide information on Imagery in your `mapswipe_workers/config/configuration.json`.:
The `mapswipe_workers` module uses sentry to capture exceptions. You can find your project’s DSN in the “Client Keys” section of your “Project Settings” in Sentry. Check [Sentry's documentation](https://docs.sentry.io/error-reporting/configuration/?platform=python) for more information. You need to provide information on Sentry in your `mapswipe_workers/config/configuration.json`.:
138
141
139
-
```json
140
-
"sentry": {
141
-
"dsn": "your_sentry_dsn_value"
142
-
}
142
+
## NGINX
143
+
143
144
```
145
+
server {
146
+
listen 80;
147
+
server_name dev.mapswipe.org;
144
148
145
-
## Slack (optional)
146
-
The `mapswipe_workers` module sends messages to slack when a project has been created successfully, the project creation failed or an exception during mapswipe_workers cli occurred. You need to add a slack token to use slack messaging. You can find out more from [Python slackclient's documentation](https://github.com/slackapi/python-slackclient) how to get it. You need to provide information on Slack in your `mapswipe_workers/config/configuration.json`.:
We back up the Postgres database using [Wal-G](https://github.com/wal-g/wal-g) and [Google Cloud Storage](https://console.cloud.google.com/storage). You could also set it up using another cloud storage service.
187
+
188
+
First, create a new cloud storage bucket:
189
+
1. Google Cloud Platform > Storage > Create Bucket
190
+
2. Choose a bucket name, e.g. `your_project_id_postgres_backup`
We need to access Google Cloud Storage. For this we use the previously generated Service Account Key. (Check the *Google APIs and Services Credentials* section again if you don't have it.) Copy the file to `postges/serviceAccountKey.json`.
0 commit comments