Skip to content

Commit

Permalink
initial documentation, Dockerfile cleanup, backup, restore, version s…
Browse files Browse the repository at this point in the history
…cripts
  • Loading branch information
mqu committed Jan 25, 2022
1 parent 862c671 commit c02c6cd
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 4 deletions.
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Docker-compose image for diacamma

this documentation mainly come from https://github.com/mgodlewski/dockerfiles/blob/master/diacamma/

http://www.diacamma.org/

## Building

to run Diacamma application, you need to

- install Docker and Docker-compose >= 1.25
- dowload this repository
- build application localy
- modify configuration
- then run application

```
# download application code (docker-compose)
git cone https://github.com/mqu/docker-diacamma.git diacamma
cd diacamma
# build application localy in a docker container
docker-compose build
# edit docker-compose.yml variables
# then run application
docker-compose up -d
# open http://localhost:8100/
# on first run, you can choose any login/password ; that will create a new account for adminstrator
```

## Environment variables
Here are environment possible values

| var | possible values | default | description |
|:------------------------|:------------------------------|:------------------------|:---------------------------------------------------|
| DIACAMMA_TYPE | syndic, asso | asso | run a diacamma-syndic or diacamma-asso instance |
| DIACAMMA_ORGANISATION | any string (no space allowed) | N/A | name for your Diacamma instance |
| DIACAMMA_DATABASE | Refer to Database Section | SQLite used if empty | connection string to the database used by DIACAMMA; Only SQLite has be tested. |
| GUNICORN_EXTRA_CMD_ARGS | See [gunicorn settings](https://docs.gunicorn.org/en/stable/settings.html) | | add extra arguments to gunicorn |

## Data volumes exposed
| path in containers | role |
|:----------------------------------|:-------------------------------------|
| /backups | store backups and restorations files |
| /var/lucterios2/<organisation> | store organisation setup files |

It's strongly recommended to map those path onto your host.

## Building with sticked version

You can build an image with forced version of each component.

| Component | default constaint | package |
|:-------------------|:------------------|:-----------------------------------------------------|
| diacamma-asso | empty (latest) | https://pypi.org/project/diacamma-asso/#history |
| diacamma-syndic | empty (latest) | https://pypi.org/project/diacamma-syndic/#history |
| lucterios-standard | empty (latest) | https://pypi.org/project/lucterios-standard/#history |

Constraint have to be compatible with pip install syntax (refer to https://www.python.org/dev/peps/pep-0440/#version-specifiers for more infos)



## Databases

- only SQLite database is supported and tested now
- building docker with mysql client fails
- don't know how to include postgresql

## Backup and restore

Your diacamma instance must be running. Let's suppose that your container is named `diacamma` as in examples above.

```bash
docker exec diacamma backup
```
This will drop the backup file into your backups volume: `./backups/backup_20180901_20_26_55.lbkf`

In order to restore a backup file just run this command:

```bash
docker exec diacamma restore backup_20180901_20_26_55.lbkf
```

## FIXME

- support : open an issue here: https://github.com/mqu/docker-diacamma/issues

## TODO

- not having many time to support this application on docker.

9 changes: 6 additions & 3 deletions build/diacama-syndic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ RUN set -x ; \
WORKDIR $LUCTERIOS_PATH

RUN set -x ; \
mkdir -p $LUCTERIOS_PATH ; \
mkdir -p $LUCTERIOS_PATH

# create new python "virtualenv" space named "virtual_for_lucterios"
RUN set -x ; \
rm -rf virtual_for_lucterios ; \
python3 -m virtualenv virtual_for_lucterios
Expand All @@ -37,15 +38,17 @@ RUN set -x ; \
. $LUCTERIOS_PATH/virtual_for_lucterios/bin/activate ; \
pip install psycopg2-binary

# mysqlclient -> generate error
# RUN set -x ; \
# . $LUCTERIOS_PATH/virtual_for_lucterios/bin/activate ; \
# pip install mysqlclient

ADD launch_lucterios.sh $LUCTERIOS_PATH
ADD env-lucterios.sh $LUCTERIOS_PATH
ADD bin /usr/local/bin
ADD entrypoint.d /entrypoint.d

RUN ls /entrypoint.d

# RUN ls /entrypoint.d /usr/local/bin

EXPOSE 8100
ENTRYPOINT /entrypoint.d/entrypoint.sh run
Expand Down
3 changes: 3 additions & 0 deletions build/diacama-syndic/bin/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

/bin/bash /entrypoint.d/entrypoint.sh backup $@
3 changes: 3 additions & 0 deletions build/diacama-syndic/bin/restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

/bin/bash /entrypoint.d/entrypoint.sh restore $@
3 changes: 3 additions & 0 deletions build/diacama-syndic/bin/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

/bin/bash /entrypoint.d/entrypoint.sh version $@
7 changes: 7 additions & 0 deletions build/diacama-syndic/env-lucterios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -xv

export LUCTERIOS_INSTALL="21112418"

. $LUCTERIOS_PATH/virtual_for_lucterios/bin/activate
cd $LUCTERIOS_PATH/

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version: '3.6'
# - https://www.diacamma.org/
# - https://syndic.diacamma.org/static/diacamma.syndic/doc_fr/
# - https://github.com/mgodlewski/dockerfiles/tree/master/diacamma
# - https://github.com/mqu/docker-diacamma

# paramétrage: (https://github.com/mgodlewski/dockerfiles/tree/master/diacamma#use-mysql-database)
# - DIACAMMA_TYPE: syndic ou asso
Expand Down Expand Up @@ -51,7 +52,7 @@ services:
app:
<<: *default-settings-std
<<: *default-settings-ressources
image: diacamma:build-local-custom-01
image: local-build/diacamma/v01
# read_only: true
build:
context: ./build/diacama-syndic/
Expand Down
17 changes: 17 additions & 0 deletions infos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
quelques infos utiles pour non spécialiste de python, ...

# Python

liste et version des packets python installés en lien avec l'application Diacamma

```
root@e0df2422b393:/var/lucterios2# pip list | egrep 'lucterios|diacamma'
diacamma-asso 2.6.5.21122115
diacamma-financial 2.6.5.21122915
diacamma-syndic 2.6.5.21122320
lucterios 2.6.5.21122109
lucterios-contacts 2.6.2.21102510
lucterios-documents 2.6.1.21122009
lucterios-standard 2.6.0.21071209
```

0 comments on commit c02c6cd

Please sign in to comment.