Skip to content

Commit 1209639

Browse files
ce quickstart (#300)
* ce quickstart * fix * make stars more prominent and add one to MAIL_SUPPRESS_SEND --------- Co-authored-by: Tomas Mizera <[email protected]>
1 parent 6cc365f commit 1209639

File tree

2 files changed

+118
-3
lines changed

2 files changed

+118
-3
lines changed

scripts/wordlist.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Bing
1010
changesets
1111
CRS
1212
crosshairs
13+
CSRF
1314
CSV
1415
CharlieColleague
1516
DAF
@@ -58,6 +59,7 @@ Lebefure
5859
Leica
5960
LGPL
6061
LGPLv
62+
lockfile
6163
LTR
6264
Lutra
6365
MAN
@@ -72,6 +74,7 @@ Mercedes
7274
Mergin
7375
merginmaps
7476
Multiline
77+
nginx
7578
NDK
7679
OneDrive
7780
NMEA
@@ -109,6 +112,8 @@ RTK
109112
rebranding
110113
SDK
111114
SLA
115+
SMTP
116+
SQLAlchemy
112117
SSH
113118
SVG
114119
SVGs

src/dev/mergince.md

Lines changed: 113 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,116 @@ If you need more functionality than <MainPlatformName /> CE offers, explore our
1212
## How to deploy Mergin Maps CE
1313
**Interested in deploying <MainPlatformName /> CE?** You can start by going to <GitHubRepo id="MerginMaps/mergin" /> on GitHub and read instructions on how to deploy it for your platform.
1414

15+
:::tip
16+
Follow our [Migration Guides](./ce-migration/) to migrate from older versions to the latest version of <MainPlatformName /> CE.
17+
:::
18+
19+
### Start docker containers
20+
Provided that `docker` and `docker-compose` are installed on your host, running Mergin Maps stack should be as simple as running `docker-compose`. However, before doing that you would need to [configure](#configure) your server setup via environment variables in <GitHubRepo desc=".prod.env" id="MerginMaps/mergin/blob/master/.prod.env" /> file.
21+
22+
Once configured, you can run:
23+
```shell
24+
$ mkdir -p projects # or wherever you set it to be
25+
$ sudo chown -R 901:999 ./projects/
26+
$ sudo chmod g+s ./projects/
27+
$ docker-compose -f docker-compose.yml up
28+
```
29+
​​
30+
### Initialise
31+
If server is started for the first time, database needs to be initialised and super-user created (set admin username, password and email):
32+
```shell
33+
$ docker exec merginmaps-server flask init-db
34+
$ docker exec merginmaps-server flask user create <username> <password> --is-admin --email <email>
35+
```
36+
37+
### Configure
38+
There are several application settings which can be changed via <GitHubRepo desc="config variables" id="MerginMaps/mergin/blob/master/.prod.env" />. Some of them have defaults and some of them needs to be modified, particularly those with `fixme` placeholder (marked with asterisks below).
39+
40+
#### Server basics
41+
Settings about your deployment. Variables marked with star ⭐️ need to be modified.
42+
43+
| Variable name | Type | Default | Description |
44+
|--------------------------|-----------|-----------|-------------|
45+
| `CONTACT_EMAIL`⭐️ | string | | Email contact for application administrator. |
46+
| `MERGIN_BASE_URL`⭐️ | string | | Deployment URL where <MainPlatformName /> is hosted. |
47+
| `COLLECT_STATISTICS` | Boolean | `true` | Whether to send usage statistics for application improvements. |
48+
| `SERVICE_ID` | string | | Deployment UUID. Auto-generated on first run. |
49+
50+
51+
#### Security settings
52+
Security settings. Variables marked with star ⭐️ need to be modified.
53+
54+
| Variable name | Type | Default | Description |
55+
|--------------------------|-----------|-----------|-------------|
56+
| `SECRET_KEY`⭐️ | string | | Secret key for authorisation, should be generated strong string. |
57+
| `SECURITY_PASSWORD_SALT`⭐️| string | | Password salt for hashing, should be generated strong string. |
58+
| `BEARER_TOKEN_EXPIRATION`| integer | `43200` | Lifetime of authorisation bearer token in seconds. When expired, user needs to log in again. |
59+
| `WTF_CSRF_ENABLED` | Boolean | `true` | Enable CSRF protection. It is strongly recommended to have this on. |
60+
| `WTF_CSRF_TIME_LIMIT` | integer | `86400` | Lifetime of CSRF token in seconds. When expired, user needs to refresh it. |
61+
62+
#### Database settings
63+
Mergin Maps uses PostgreSQL database to store its data. Variables marked with star ⭐️ need to be modified.
64+
65+
| Variable name | Type | Default | Description |
66+
|---------------------------|-----------|-----------|-------------|
67+
| `DB_APPLICATION_NAME` | string | `mergin` | Comment in database connection string to better identify connection source. |
68+
| `DB_DATABASE` | string |`postgres` | Database to store <MainPlatformName /> tables. |
69+
| `DB_HOST` | string | `db` | Database host. Mapped to docker-compose service name. |
70+
| `DB_PORT` | integer | `5432` | Database port. If non-default should match port exposed in docker-compose file. |
71+
| `DB_USER`⭐️ | string |`postgres` | PostgreSQL user to connect to <MainPlatformName /> database. |
72+
| `DB_PASSWORD`⭐️ | string |`postgres` | PostgreSQL user password. |
73+
| `DB_POOL_MAX_OVERFLOW=10` | integer | `10` | Database `max_overflow` limit for [SQLAlchemy](https://docs.sqlalchemy.org/en/14/core/engines.html). |
74+
| `DB_POOL_SIZE` | integer | `2` | Database pool size for SQLAlchemy. With overflow determines maximum of concurrent connections to database. |
75+
| `DB_POOL_TIMEOUT` | integer | `300` | Database pool timeout for SQLAlchemy. |
76+
77+
#### Sending Emails
78+
​Mergin Maps can connect to SMTP server to send notifications. Also required for password recovery to work. Variables marked with star ⭐️ need to be modified.
79+
80+
| Variable name | Type | Default | Description |
81+
|---------------------------|-----------|-----------|-------------|
82+
| `MAIL_SUPPRESS_SEND`⭐️ | Boolean | `true` | Whether to suppress email sending. |
83+
| `MAIL_BCC`⭐️ | string | | Email address to send copies of all emails sent. Should be system/application administrator. |
84+
| `MAIL_DEFAULT_SENDER`⭐️ | string | | Sender of <MainPlatformName /> emails. Best to have some no-reply address. |
85+
| `MAIL_USERNAME`⭐️ | string | | Connection to SMTP server. |
86+
| `MAIL_PASSWORD`⭐️ | string | | Password for user connecting to SMTP server. |
87+
| `MAIL_PORT`⭐️ | integer | `587` | SMTP mail server port. |
88+
| `MAIL_SERVER`⭐️ | string |`localhost`| SMTP mail server host. |
89+
| `MERGIN_LOGO_URL`⭐️ | string | `null` | Link to logo in emails. |
90+
91+
92+
#### Data synchronisation and user management
93+
​Variables marked with star ⭐️ need to be modified.
94+
95+
| Variable name | Type | Default | Description |
96+
|---------------------------|---------|-------------|---------------------------|
97+
| `GLOBAL_WORKSPACE`⭐️ | string | `mergin` | Namespace (part of URL) for all projects. All projects belong to this single workspace with certain permissions (see below). |
98+
| `GLOBAL_READ` | Boolean | `true` | All registered users have read access to all projects. If false, application admin would need to grant project access to users manually. |
99+
| `GLOBAL_WRITE` | Boolean | `false` | All registered users have write access (can sync) to all projects. |
100+
| `GLOBAL_ADMIN` | Boolean | `false` | All registered users can create/delete projects. |
101+
| `GLOBAL_STORAGE`⭐️ | integer |`10737418240`| Storage limit Mergin Maps can use to store projects (last version) in bytes (default is 10 GB). Should be reasonably large. |
102+
| `LOCAL_PROJECTS` | string |`/data/live` | Directory to store projects on container. Please refer to volume mapping in docker-compose file. |
103+
| `TEMP_DIR` | string | `/data/tmp` | Trash directory for temp files being cleaned regularly. Please refer to volume mapping in docker-compose file. |
104+
| `MAINTENANCE_FILE` | string |`/data/MAINTENANCE`| File to indicate server is in maintenance - read only mode. Please refer to volume mapping in docker-compose file. |
105+
| `BLACKLIST` | string | `.mergin/`, `.DS_Store`, `.directory` | Pattern to ignore when syncing files. |
106+
| `FILE_EXPIRATION` | integer | `172800` | When GeoPackage file was updated with "<NoSpellcheck id="diffable" />" change, original data are being removed (as they can be reconstructed on demand) to save disk space. File lifetime in seconds. |
107+
| `LOCKFILE_EXPIRATION` | integer | `300` | Time in seconds for project being locked while updated. If no change happens to project in such time, lockfile is removed. |
108+
| `MAX_CHUNK_SIZE` | integer | `10485760` | Maximum size of file chunk to be uploaded (and received by server) in bytes. |
109+
|`MAX_DOWNLOAD_ARCHIVE_SIZE`| integer | `1073741824`| Maximum size of project zip archive in bytes for direct download. Too large projects may take too long to download or never complete in one request. |
110+
| `USE_X_ACCEL`⭐️ | Boolean | `false` | Whether to use nginx do serve files. Should be enabled if used with nginx proxy for performance reasons. Read more [here](https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/). |
111+
|`CLOSED_ACCOUNT_EXPIRATION`| integer | `1` | Time in days after user closed his account to all projects and files are permanently deleted. Please note than until user is removed username/email is occupied. |
112+
| `DELETED_PROJECT_EXPIRATION`| integer| `7` | Lifetime in days for deleted project. Expired projects are removed permanently without possibility to restore afterwards. |
113+
| `PROJECT_ACCESS_REQUEST` | integer | `604800` | Lifetime of active project access request in seconds. |
114+
| `TEMP_EXPIRATION` | integer | `7` | Time in days after files in temporary folder are permanently deleted. |
115+
116+
#### Celery asynchronous tasks
117+
​Mergin Maps is using Celery and Redis to perform asynchronous tasks or doing regular jobs.
118+
​​
119+
| Variable name | Type | Default | Description |
120+
|-----------------------|------|---------------------------------|-------------|
121+
|`BROKER_URL` |string|`redis://merginmaps-redis:6379/0`| Connection details to celery message broker. If non-default, it should match definition in `docker-compose` file. |
122+
|`CELERY_RESULT_BACKEND`|string|`redis://merginmaps-redis:6379/0`| Connection details to celery result back-end broker. If non-default, it should match definition in `docker-compose` file. |
123+
124+
15125
## How to opt out of sending statistics
16126
<SinceBadge type="Server" version="2023.2" />
17127
By default, <MainPlatformName /> CE collects anonymous usage information to make the service better. There is a variable named `COLLECT_STATISTICS` that controls if statistics are collected and sent to <MainPlatformNameLink />.
@@ -21,7 +131,8 @@ If you do not want to provide these data, you can opt-out any time by setting th
21131
COLLECT_STATISTICS=false
22132
```
23133

24-
## Mergin Maps CE server is not properly configured
134+
## Mergin Maps CE troubleshooting
135+
### Mergin Maps CE server is not properly configured
25136
Did you get an error that the server is not properly configured?
26137
![CE server not configured error](./ce-server-not-configured.jpg "CE server not configured error")
27138

@@ -30,7 +141,6 @@ Did you get an error that the server is not properly configured?
30141

31142
2. Restart the container with the `MERGIN_BASE_URL` variable
32143

33-
## Migrate to the latest Mergin Maps CE version
34-
To migrate from older <MainPlatformName /> Community Edition to the latest version, follow our [Migration Guides](./ce-migration/).
144+
35145

36146

0 commit comments

Comments
 (0)