From bbcc194f6afea4627f31c4a6af56829ad63cf486 Mon Sep 17 00:00:00 2001 From: Aytac Ozkan Date: Sat, 12 Sep 2020 21:30:11 +0200 Subject: [PATCH] **readme file is updated. --- .env | 6 +++++- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- data.sql | 12 ++++++------ docker-compose.yml | 19 +++++++++++++------ 4 files changed, 66 insertions(+), 15 deletions(-) diff --git a/.env b/.env index f1099e7..f967f05 100644 --- a/.env +++ b/.env @@ -45,4 +45,8 @@ IN_SYLVA_SMTP_HOST=smtp.gmail.com IN_SYLVA_SMTP_PORT=465 IN_SYLVA_SMTP_SECURE=true IN_SYLVA_EMAIL_TO=philippe.clastre@inrae.fr -IN_SYLVA_EMAIL_FROM=insylva-france-adminSI@renater.fr \ No newline at end of file +IN_SYLVA_EMAIL_FROM=insylva-france-adminSI@renater.fr + + +IN_SYLVA_ADMIN_USERNAME=admin@inrae.fr +IN_SYLVA_ADMIN_PASSWORD=InSylva1465441881 \ No newline at end of file diff --git a/README.md b/README.md index 0fbcdb1..c597e5f 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,48 @@ * docker >= 17.12.0+ * docker-compose -* Run this command `docker-compose --compatibility up -d` -* Run this command for stats of the container (ex: Mem & CPU usage.) `docker stats postgres_container` +## Build + +* To Build the all necessary images regarding of your environment, it could be your machine as development or your host machine as production environment. Follow the example below; + * Starts building for development; + + ```sh + $ sh build.sh -k id_rsa -e dev + ``` + * Starts building for production; + + ```sh + $ sh build.sh -k id_rsa -e prod -d w3.avignon.inra.fr/bas_insylva/ -ip 147.100.20.44 -p 8081 + ``` + +## RUN +* To able to run `Infrastructure`, please follow these stages below; + * Run this command + ```sh + $ docker-compose --compatibility up -d + ``` + * Run this command for stats of the container (ex: Mem & CPU usage.) + ```sh + $ docker stats postgres_container + ``` + +* After build stage is completed, you should configure your 'Keycloak', + * First, please go your PgAdmin (http://$YOUR_IP_OR_LOCALHOST:5050/), then enter the credentials that located in the project root .env file. After login, make your postgresql settings and switch the 'keycloak as your primary database' and run this command as below; + + ```sql + update REALM set ssl_required = 'NONE' where id = 'master'; + ``` + * Second, please go your Keycloak application by following this url ((http://$YOUR_IP_OR_LOCALHOST:7000/keycloak/auth/), then enter the neccessary login credentials that located in the project root .env file, and import the `realm-export.json` it is located in the keycloak folder. + + * After the second step, please run below command to able to create admin user for the system, be aware it is very important, without this account you cannot acces to portal. + + * Finnaly you can access to portal, with these credentials: + * username: admin@inrae.fr + * psswd: + + ```sh + $ curl --location --request POST 'http://$YOUR_IP_OR_LOCALHOST:4000/user/create-system-user' + ``` [![asciicast](https://asciinema.org/a/aoUNfjZ2okPW5WFltYSQqmrsm.svg)](https://asciinema.org/a/aoUNfjZ2okPW5WFltYSQqmrsm) diff --git a/data.sql b/data.sql index dabf538..9f26214 100644 --- a/data.sql +++ b/data.sql @@ -428,20 +428,20 @@ CREATE TABLE IF NOT EXISTS profile_specifications( --This function computes the geom attribute from x and y coordinates --It just returns true when finished -- can be called with a simple command: select -drop table if exists unblurred_sites cascade; +-- drop table if exists unblurred_sites cascade; #You can't drop any table that is not exist previously. CREATE TABLE unblurred_sites ( id SERIAL PRIMARY KEY, userid integer , indexid varchar(120), -- in elasticsearch index_id holds all documents within. The reason of to remove sourceid from the table is simple I do not want to make unnecessary joins through source table. docid varchar(100) , -- in index_id doc_id is symbolize one unique document. - siteid integer, + siteid integer, -- it is useless for me #ozkan x real NOT NULL, y real NOT NULL, geom geometry, blurring_rule character(30) COLLATE pg_catalog."default" NOT NULL, new_point boolean, - --do not delete the line below. + --do not delete the lines below, they are necessary for the ORM createdAt timestamp NOT NULL DEFAULT NOW(), updatedAt timestamp ) @@ -457,7 +457,7 @@ COMMENT ON TABLE unblurred_sites --This function computes the geom attribute from x and y coordinates --It just returns true when finished -- can be called with a simple command: select -DROP FUNCTION add_geom_from_x_y(); +-- DROP FUNCTION add_geom_from_x_y(); CREATE FUNCTION add_geom_from_x_y() RETURNS BOOLEAN LANGUAGE PLPGSQL @@ -568,9 +568,9 @@ SELECT INTO nb_perdus count(lost_id) FROM overlapping; END $$; -\connect keycloak +-- \connect keycloak -update REALM set ssl_required = 'NONE' where id = 'master'; +-- update REALM set ssl_required = 'NONE' where id = 'master'; /* diff --git a/docker-compose.yml b/docker-compose.yml index 3cf39b6..d0ad513 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: ' user: "0" working_dir: /usr/share/elasticsearch - volumes: ['certs:/usr/share/elasticsearch/config/certificates'] + volumes: ["certs:/usr/share/elasticsearch/config/certificates"] es01: container_name: es01 @@ -31,7 +31,12 @@ services: - xpack.security.transport.ssl.verification_mode=certificate - xpack.security.transport.ssl.keystore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12 - xpack.security.transport.ssl.truststore.path=/usr/share/elasticsearch/config/certificates/elastic-certificates.p12 - volumes: ['esdata:/usr/share/elasticsearch/data', 'certs:/usr/share/elasticsearch/config/certificates', 'logs:/var/log'] + volumes: + [ + "esdata:/usr/share/elasticsearch/data", + "certs:/usr/share/elasticsearch/config/certificates", + "logs:/var/log", + ] ulimits: nofile: soft: 65536 @@ -80,7 +85,7 @@ services: - ELASTICSEARCH_HOSTS=http://es01:9200 - ELASTICSEARCH_USERNAME=$ELASTICSEARCH_USERNAME - ELASTICSEARCH_PASSWORD=$ELASTICSEARCH_PASSWORD - volumes: + volumes: - type: volume source: logs target: /var/log @@ -216,7 +221,7 @@ services: networks: - insylva-net restart: unless-stopped - + search-api: image: in-sylva.search.api:latest depends_on: [es01] @@ -288,7 +293,7 @@ services: KEYCLOAK_CREDENTIALS_SECRET: $KEYCLOAK_CREDENTIALS_SECRET IN_SYLVA_reCAPTCHA_SECRET_KEY: $IN_SYLVA_reCAPTCHA_SECRET_KEY - + IN_SYLVA_EMAIL: $IN_SYLVA_EMAIL IN_SYLVA_EMAIL_PASSWORD: $IN_SYLVA_EMAIL_PASSWORD IN_SYLVA_SMTP_HOST: $IN_SYLVA_SMTP_HOST @@ -296,6 +301,9 @@ services: IN_SYLVA_SMTP_SECURE: $IN_SYLVA_SMTP_SECURE IN_SYLVA_EMAIL_TO: $IN_SYLVA_EMAIL_TO IN_SYLVA_EMAIL_FROM: $IN_SYLVA_EMAIL_FROM + + IN_SYLVA_ADMIN_USERNAME: $IN_SYLVA_ADMIN_USERNAME + IN_SYLVA_ADMIN_PASSWORD: $IN_SYLVA_ADMIN_PASSWORD networks: - insylva-net restart: unless-stopped @@ -445,7 +453,6 @@ volumes: certs: portainer_data: logs: - networks: insylva-net: