Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Environment variables for development docker-compose.dev.yml

FLASK_DEBUG=1

# Mail SMTP connection to maildev

MAIL_SERVER=maildev
MAIL_PORT=1025
MAIL_SUPPRESS_SEND=0
MAIL_USE_TLS=False
MAIL_USE_SSL=False
MAIL_DEFAULT_SENDER=noreply@example.com
79 changes: 48 additions & 31 deletions .prod.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

# Mind that any major change to this file MUST BE reflected in docs


FLASK_APP=application
GEODIFF_LOGGER_LEVEL=2
CONTACT_EMAIL=fixme

# Required for access of your server
#MERGIN_BASE_URL=http://localhost:5000

#DEBUG=FLASK_DEBUG | False
FLASK_DEBUG=0

#LOCAL_PROJECTS=os.path.join(config_dir, os.pardir, os.pardir, 'projects') # for local storage type
LOCAL_PROJECTS=/data

#MAINTENANCE_FILE=os.path.join(LOCAL_PROJECTS, 'MAINTENANCE') # locking file when backups are created
MAINTENANCE_FILE=/data/MAINTENANCE

#SECRET_KEY=NODEFAULT
SECRET_KEY=fixme

#SWAGGER_UI=False # to enable swagger UI console (for test only)

#TEMP_DIR=gettempdir() # trash dir for temp files being cleaned regularly
TEMP_DIR=/data/tmp

#TESTING=False

#VERSION=get_version()


Expand Down Expand Up @@ -58,6 +56,9 @@ DB_PORT=5432

# auth related

#SECRET_KEY=NODEFAULT
SECRET_KEY=fixme

#BEARER_TOKEN_EXPIRATION=3600 * 12 # in seconds

#SECURITY_PASSWORD_SALT=NODEFAULT
Expand All @@ -68,29 +69,37 @@ SECURITY_PASSWORD_SALT=fixme
#WTF_CSRF_TIME_LIMIT=3600 * 24 # in seconds


# for flask mail
# Mail configuration

#MAIL_BCC=NODEFAULT
MAIL_SUPPRESS_SEND=0

#MAIL_DEBUG=MAIL_SUPPRESS_SEND | False
# Sender of emails
# MAIL_DEFAULT_SENDER=fixme@example.com

# SMTP server url address
# MAIL_SERVER=example.smtp.com

# SMTP server port
# MAIL_PORT=587

#MAIL_DEFAULT_SENDER=NODEFAULT
MAIL_DEFAULT_SENDER=fixme
# SMTP server username
# MAIL_USERNAME=

#MAIL_PASSWORD=NODEFAULT
# SMTP server password
# MAIL_PASSWORD=

#MAIL_PORT=587
# Default True
# MAIL_USE_TLS=True

#MAIL_SERVER=localhost
MAIL_SERVER=fixme
# Default False
# MAIL_USE_SSL=False

#MAIL_SUPPRESS_SEND=True
#MAIL_BCC=''

#MAIL_USE_TLS=True
#MAIL_USE_SSL=False
#MERGIN_LOGO_URL= # for link to logo in emails

#MAIL_DEBUG=MAIL_SUPPRESS_SEND | False

#MAIL_USERNAME=NODEFAULT
MAIL_USERNAME=fixme


# data sync
Expand All @@ -108,9 +117,12 @@ MAIL_USERNAME=fixme
#USE_X_ACCEL=False # use nginx (in front of gunicorn) to serve files (https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/)
USE_X_ACCEL=1

# geodif related

# where geodiff lib copies working files
#GEODIFF_WORKING_DIR=$LOCAL_PROJECTS/geodiff_tmp
GEODIFF_WORKING_DIR=/data/geodiff
GEODIFF_LOGGER_LEVEL=2

# celery

Expand All @@ -123,15 +135,20 @@ BROKER_TRANSPORT_OPTIONS={ 'master_name': 'mymaster' }
#CELERY_RESULT_BACKEND=redis://172.17.0.1:6379/0'
CELERY_RESULT_BACKEND=redis://merginmaps-redis:6379/0

#CELERY_RESULT_BACKEND_TRANSPORT_OPTIONS={} # cast=eval
CELERY_RESULT_BACKEND_TRANSPORT_OPTIONS={ 'master_name': 'mymaster' }

#CELERY_ACKS_LATE=False
#CELERY_ACKS_LATE=True

# set to number of cpu
#CELERYD_CONCURRENCY=2

#CELERY_WORKER_CONCURRENCY=1 # set to number of cpu in case of prefork or to higher number in case of gevent pool
CELERYD_CONCURRENCY=2
# Deprecated from 2024.7.0, use CELERYD_CONCURRENCY instead after 2024.7.0
# CELERY_WORKER_CONCURRENCY=1

#CELERYD_PREFETCH_MULTIPLIER=4
#CELERYD_PREFETCH_MULTIPLIER=4

# Deprecated from 2024.7.0, use CELERYD_PREFETCH_MULTIPLIER instead after 2024.7.0
#CELERY_WORKER_PREFETCH_MULTIPLIER=4

#CELERY_ROUTES={} # split tasks into separate queues

Expand All @@ -149,15 +166,15 @@ CLOSED_ACCOUNT_EXPIRATION=1

# for links generated in emails and callbacks

#MERGIN_BASE_URL=http://localhost:5000

#MERGIN_LOGO_URL= # for link to logo in emails
# Statistics related

#COLLECT_STATISTICS True

#SERVICE_ID # should be random uuid

# global workspace related bits

# GLOBAL_WORKSPACE mergin

# GLOBAL_STORAGE 1024 * 1024 * 1024
Expand All @@ -172,10 +189,10 @@ GLOBAL_STORAGE=10737418240
# toggle registration form to create new users
#USER_SELF_REGISTRATION=False

# what type of server is running, e.g. community edition or enterprise edition
#SERVER_TYPE=ce

# Gunicorn server socket
PORT=5000

GEVENT_WORKER=True
# Deprecated from 2024.7.0, replacement is to set GEVENT_WORKER=True
NO_MONKEY_PATCH=False

16 changes: 16 additions & 0 deletions development.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Watching the type definitions is also useful to pick up any changes to imports o

## Running locally in a docker composition

If you want to run the whole stack locally, you can use the docker. Docker will build the images from yout local files and run the services.

```shell
# Run the docker composition with the current Dockerfiles
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
Expand All @@ -72,6 +74,20 @@ docker exec -it merginmaps-server flask init-db
docker exec -it merginmaps-server flask user create admin topsecret --is-admin --email admin@example.com
```

To check if application is running, you can use following mand to verify you installation:

```shell
docker exec -it merginmaps-server flask server check
```

To check if emails are sending correctly, you can use following mand to verify you installation:

```shell
docker exec -it merginmaps-server flask server send-check-email --email admin@example.com
```

In docker-compose.dev.yml is started maildev/maildev image that can be used to test emails (see [https://github.com/maildev/maildev/](https://github.com/maildev/maildev/)). In localhost:1080 you can see the emails sent by the application in web interface.

## Running tests
To launch the unit tests run:
```shell
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,36 @@ services:
build:
context: ./server
dockerfile: Dockerfile
env_file:
- .prod.env
- .dev.env
celery-beat:
image: celery-beat
build:
context: ./server
dockerfile: Dockerfile
env_file:
- .prod.env
- .dev.env
celery-worker:
image: celery-worker
build:
context: ./server
dockerfile: Dockerfile
env_file:
- .prod.env
- .dev.env
web:
image: merginmaps-frontend
build:
context: ./web-app
dockerfile: Dockerfile
maildev:
image: maildev/maildev
container_name: merginmaps-maildev
restart: always
ports:
- 1080:1080
- 1025:1025
networks:
- merginmaps
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ services:
restart: always
env_file:
- .prod.env
environment:
- GEVENT_WORKER=0
- NO_MONKEY_PATCH=1
volumes:
- ./server/entrypoint.sh:/app/entrypoint.sh
depends_on:
Expand All @@ -57,6 +60,9 @@ services:
user: 901:999
env_file:
- .prod.env
environment:
- GEVENT_WORKER=0
- NO_MONKEY_PATCH=1
volumes:
- ./projects:/data
- ./server/entrypoint.sh:/app/entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion server/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ flask-login = "==0.6.2"
bcrypt = "==4.2.0"
wtforms = {extras = ["email"],version = "==3.1.2"}
flask-wtf = "==1.0.1"
flask-mail = "==0.9.1"
flask-mail = "==0.10.0"
safe = "==0.4"
flask-migrate = "==2.6.0" # 3.1.0
wtforms-json = "==0.3.5"
Expand Down
Loading