|
| 1 | +# Quick start guide |
| 2 | + |
| 3 | +In this quick start guide you will set up one way synchronization between a new Mergin project and your existing bucket (MinIO or S3). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- MinIO/AWS S3 bucket |
| 8 | +- docker engine |
| 9 | + |
| 10 | +## 1. Create a bucket |
| 11 | +Create a public bucket if you do not have one. |
| 12 | + |
| 13 | +## 2. Create an empty mergin project |
| 14 | +Go to [Mergin](https://public.cloudmergin.com/) website and create a new blank project. |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +You should see there are not any files there. |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +and your full project name for later will be `<username>/<project-name>`, e.g. `john/media-sync` |
| 23 | + |
| 24 | +## 3. Set up QGIS project |
| 25 | +Create a new QGIS project, add some layer (e.g. notes). Add few points and make sure you reference some pictures in attributes |
| 26 | +(e.g. photo). Create additional column for new URL where files would be copied to (e.g. external_url). Your project may look like this: |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +Upload your project to Mergin, either via web browser or [mergin plugin](https://github.com/lutraconsulting/qgis-mergin-plugin). |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +You have now your project ready in Mergin. |
| 35 | + |
| 36 | + |
| 37 | +## 4. Start syncing |
| 38 | +Download and run media-sync docker image with configuration based on above (you will need to tweak that): |
| 39 | + |
| 40 | +``` |
| 41 | +$ sudo docker run -it \ |
| 42 | + --name mergin-media-sync \ |
| 43 | + -e MERGIN__USERNAME=test000 \ |
| 44 | + -e MERGIN__PASSWORD=myStrongPassword \ |
| 45 | + -e MERGIN__PROJECT_NAME=test000/media-sync \ |
| 46 | + -e DRIVER=minio \ |
| 47 | + -e MINIO__ENDPOINT="minio-server-url" \ |
| 48 | + -e MINIO__ACCESS_KEY=access-key \ |
| 49 | + -e MINIO__SECRET_KEY=secret-key \ |
| 50 | + -e MINIO__BUCKET=destination-bucket \ |
| 51 | + -e MINIO__SECRET=1 \ |
| 52 | + -e OPERATION_MODE=copy \ |
| 53 | + -e REFERENCE__FILE=survey.gpkg \ |
| 54 | + -e REFERENCE__TABLE=notes \ |
| 55 | + -e REFERENCE__LOCAL_PATH_FIELD=photo \ |
| 56 | + -e REFERENCE__DRIVER_PATH_FIELD=external_url \ |
| 57 | + mergin-media-sync python3 media_sync_daemon.py |
| 58 | +``` |
| 59 | +and you should see photos copied from your Mergin project to the bucket: |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +and your references in QGIS project updated: |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +In order to stop syncing simply stop docker container. |
| 68 | + |
0 commit comments