Commit f9d3a3ad authored by Romain Loth's avatar Romain Loth

update docs

parent 77f6e167
...@@ -19,27 +19,31 @@ More info in `doc/` directory ...@@ -19,27 +19,31 @@ More info in `doc/` directory
First we need to run the app First we need to run the app
``` ```
# install prerequisites # install prerequisites
> sudo apt install python3 > sudo apt install python3 docker jq
> sudo apt install python3-virtualenv
# start a virtualenv cd $INSTALL_DIR
> virtualenv --python=/usr/bin/python3 setup/regcomex_venv
> source setup/regcomex_venv/bin/activate
# additional requirements # run the database docker
(regcomex_venv) > pip3 install -r setup/requirements.txt docker run --detach --name comex_db \
-v $INSTALL_DIR/data/shared_mysql_data:/var/lib/mysql \
--env="MYSQL_ROOT_PASSWORD=very-safe-pass" mysql
# run the app ---------------------------------------------------------- # get its IP into the env
(regcomex_venv) > gunicorn -b 127.0.0.1:9090 server_comex_registration:app export SQLDOCKERIP=$(docker inspect comex_db | jq -r '.[0].NetworkSettings.IPAddress')
# ----------------------------------------------------------
```
# run the app --------------------------------------------
gunicorn -b 127.0.0.1:9090 server_comex_registration:app
# -------------------------------------------------------
```
The form server is now accessible locally on `127.0.0.1:9090/regcomex` The form server is now accessible locally on `127.0.0.1:9090/regcomex`
(the default ROUTE_PREFIX is /regcomex, but TODO can be changed in config file) **Remarks:**
- the default ROUTE_PREFIX is /regcomex, but TODO can be changed in config file
- the mysql DB needs to be [built first](https://github.com/moma/regcomex/blob/master/setup/dockers/1-create_sql_container.md), but TODO automatize
-------
#### Running via docker #### Running it all via docker
Prerequisites: Prerequisites:
- `docker` - `docker`
- `docker-compose` (>= v. 1.7.0) - `docker-compose` (>= v. 1.7.0)
...@@ -51,15 +55,17 @@ docker build flask_ispcif_light/ -t flask_ispcif_light:latest ...@@ -51,15 +55,17 @@ docker build flask_ispcif_light/ -t flask_ispcif_light:latest
docker run -p 9090 --name comex_flask_test flask_ispcif_light docker run -p 9090 --name comex_flask_test flask_ispcif_light
# run the app + mysql (TODO actually use mysql!)
docker-compose up docker-compose up
``` ```
-------
#### Running in prod #### Running in prod
TODO
Secondly we ask nginx to reverse-proxy our app Secondly we ask nginx to reverse-proxy our app
This is a minimal conf (cf [detailed doc](https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md) for real-life conf) This is a minimal conf (cf [detailed doc](https://github.com/moma/regcomex/blob/master/doc/nginx_conf.md) for real-life conf)
``` ```
# nginx exemple # nginx exemple
server { server {
......
...@@ -21,6 +21,9 @@ export SQLDOCKERIP=$(docker inspect comex_db | jq -r '.[0].NetworkSettings.IPAdd ...@@ -21,6 +21,9 @@ export SQLDOCKERIP=$(docker inspect comex_db | jq -r '.[0].NetworkSettings.IPAdd
mysql -uroot -pvery-safe-pass -h $SQLDOCKERIP -P 3306 mysql -uroot -pvery-safe-pass -h $SQLDOCKERIP -P 3306
# ----------------------------------------------------- # -----------------------------------------------------
# stop it when you're done
docker stop comex_db
# NB # NB
# also now mysqld --initilize created the following files # also now mysqld --initilize created the following files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment