1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-24 17:02:25 +00:00

Merge branch 'docker' into 'master'

Docker

See merge request mediatek/med!1
This commit is contained in:
erdnaxe 2020-02-09 13:37:34 +01:00
commit 12f165773c
5 changed files with 57 additions and 10 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
RUN apt update && \
apt install -y gettext nginx uwsgi uwsgi-plugin-python3 && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
ENTRYPOINT ["/code/entrypoint.sh"]
EXPOSE 8000

View File

@ -29,12 +29,20 @@ ainsi qu'un user med et un mot de passe associé.
Voici les étapes à éxecuter pour mysql :
```SQL
CREATE DATABASE club-med;
CREATE USER 'club-med'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON club-med.* TO 'club-med'@'localhost';
CREATE DATABASE med;
CREATE USER 'med'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON med.* TO 'med'@'localhost';
FLUSH PRIVILEGES;
```
Et pour postgresql :
```SQL
CREATE DATABASE med;
CREATE USER med WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE med TO med;
```
## Exemple de groupes de droits
```

8
entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
python manage.py compilemessages
python manage.py makemigrations
sleep 2
python manage.py migrate
# TODO: use uwsgi in production
python manage.py runserver 0.0.0.0:8000

View File

@ -32,10 +32,22 @@ DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'club-med',
'USER': 'club-med',
'PASSWORD': 'CHANGE ME !!!',
'HOST': 'localhost',
},
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'med',
'USER': 'med',
'PASSWORD': 'password_to_store_in_env',
'HOST': 'db',
'PORT': '',
}
}
# or MySQL database for Zamok
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'club-med',
# 'USER': 'club-med',
# 'PASSWORD': 'CHANGE ME !!!',
# 'HOST': 'localhost',
# },
# }

View File

@ -8,4 +8,5 @@ django-reversion==3.0.3
python-stdnum==1.10
djangorestframework==3.9.2
pyyaml==3.13
coreapi==2.3.3
coreapi==2.3.3
psycopg2