Skip to content

Commit

Permalink
Merge branch 'master' of forgemia.inra.fr:in-sylva-development/in-syl…
Browse files Browse the repository at this point in the history
…va.infrastructure
  • Loading branch information
anatolicvs committed Aug 20, 2020
2 parents ecdf064 + 10950aa commit b89ec93
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 42 deletions.
24 changes: 14 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

Usage(){
echo "##############$0 USAGE########################"
echo "Script $0 -k <ssh_key_file> -t {dev|prod} <-d domain_name>"
echo "Script $0 -k <ssh_key_file> -e {dev|prod} <-d domain_name>"
echo "Use it to build in-sylva docker infrastructure"
echo "##############################################"
echo "$0 -k id_rsa -t dev"
echo "$0 -k id_rsa -e dev"
echo " * Starts building for development; "
echo "$0 -k id_rsa -t prod -d w3.avignon.inra.fr/bas_insylva/ -s 147.100.20.44 -p 8081"
echo "$0 -k id_rsa -e prod -d w3.avignon.inra.fr/bas_insylva/ -ip 147.100.20.44 -p 8081"
echo " * The portal page would be accessible with URL: http://w3.avignon.inra.fr/bas_insylva/portal/"
echo " * The login page will be http://147.100.20.44:8081"
echo "##############################################"
echo "Args:"
echo "-k <ssh_key_file>: mandatory. id_rsa keyfile should exits in ~/.ssh/ user directory "
echo "-t {dev|prod}: mandatory. If <prod> deployment is choosen, you must precise -d argument"
echo "-d domain_name: mandatory in production deployment. Precise the base URL which will be use to contact application."
echo "-e {dev|prod}: mandatory. Switching environment. If <prod> deployment is choosen, you must precise -d argument"
echo "-d domain_name: mandatory in production deploiement. Precise the base URL which will be use to contact application."
echo " domain_name should appear as <domain>/<path1>/<path2>/"
echo " Example: w3.avignon.inra.fr/bas_insylva/portal/"
echo "-s <ip address>: mandatory in production deployment. Precise the ip address of the server (used for direct access to search application in production mode)"
echo "-p <port number>: mandatory in production deployment. Precise the port number of the server (used for direct access to login application in production mode)"
echo "-ip <ip address>: mandatory in production deploiement. Precise the ip address of the server (used for direct access to search application in production mode)"
echo "-p <port number>: mandatory in production deploiement. Precise the port number of the server (used for direct access to login application in production mode)"
echo "##############################################"
exit
}
Expand All @@ -40,7 +40,7 @@ while [ $# != 0 ];do
KEY=$1
echo "Key file: $KEY"
fi;;
-t)
-e)
shift
case $1 in
dev) MODE=dev;;
Expand All @@ -54,7 +54,7 @@ while [ $# != 0 ];do
shift
DOMAIN=$1
echo "INFO: using $DOMAIN as domaine name";;
-s)
-ip)
shift
LOGINSERVER=$1
echo "INFO: server used is $LOGINSERVER";;
Expand All @@ -67,7 +67,7 @@ while [ $# != 0 ];do
done

if [ -z $MODE ]; then
echo "ERROR: the -t option is mandatory. Check Usage and relaunch"
echo "ERROR: the -e option is mandatory. Check Usage and relaunch"
Usage
exit
fi
Expand Down Expand Up @@ -160,11 +160,15 @@ echo -n "Enter the name of docker image you want to build locally: (ex:gatekeepe

read imageName

# accepting image name with uppercase: converting them to lower !
imageName=$(echo "$imageName" | tr '[:upper:]' '[:lower:]')

if [ "$imageName" == "" ]
then
set $"all"
fi


case $imageName in
"gatekeeper")
sh ./gatekeeper/build.sh $KEY
Expand Down
41 changes: 41 additions & 0 deletions data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,47 @@ CREATE TABLE IF NOT EXISTS profile_specifications(
updatedAt timestamp
);

CREATE TABLE unblurred_sites
(
id SERIAL PRIMARY KEY,
userid integer NOT NULL,
x real NOT NULL,
y real NOT NULL,
geom geometry,
blurring_rule character(30) COLLATE pg_catalog."default" NOT NULL,
new_point boolean
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

COMMENT ON TABLE unblurred_sites
IS 'Spatial table containing unblurred coordinates';

CREATE OR REPLACE FUNCTION add_geom_from_x_y()
RETURNS TRIGGER
LANGUAGE PLPGSQL
AS $add_geom_from_x_y$
BEGIN
IF NEW.new_point=true THEN
UPDATE unblurred_sites SET
new_point=false,
geom = ST_SetSRID(ST_MakePoint(NEW.x, NEW.y), 4326)
WHERE id=NEW.id;
END IF;
RETURN NEW;
END;
$add_geom_from_x_y$ ;

DROP TRIGGER IF EXISTS tr_add_geom on unblurred_sites;
CREATE TRIGGER tr_add_geom
AFTER INSERT
ON unblurred_sites
FOR EACH ROW
EXECUTE PROCEDURE add_geom_from_x_y();


\connect keycloak

update REALM set ssl_required = 'NONE' where id = 'master';
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ services:
IN_SYLVA_GRANT_TYPE: "password"
IN_SYLVA_REALM: "in-sylva"
ports:
- 8081:8080
- 8081:8081
links:
- gatekeeper
- keycloak
Expand Down
4 changes: 3 additions & 1 deletion login/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ EXPOSE 8080

WORKDIR /app/in-sylva.user.login/

CMD [ "pm2-runtime", "npm","--", "start" ]
CMD [ "pm2-runtime", "npm","--", "start" ]

# CMD npm run start
1 change: 1 addition & 0 deletions portal/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REACT_APP_IN_SYLVA_GATEKEEPER_HOST=/gatekeeper
REACT_APP_IN_SYLVA_SOURCE_MANAGER_HOST=/source-manager
REACT_APP_IN_SYLVA_KEYCLOAK_HOST=/keycloak
REACT_APP_IN_SYLVA_LOGIN_HOST=http://localhost:8081
REACT_APP_IN_SYLVA_CLIENT_ID=in-sylva.user.app
REACT_APP_IN_SYLVA_GRANT_TYPE=password
REACT_APP_IN_SYLVA_REALM=in-sylva
Expand Down
1 change: 1 addition & 0 deletions portal/.env_generic
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REACT_APP_IN_SYLVA_GATEKEEPER_HOST=/gatekeeper
REACT_APP_IN_SYLVA_SOURCE_MANAGER_HOST=/source-manager
REACT_APP_IN_SYLVA_KEYCLOAK_HOST=/keycloak
REACT_APP_IN_SYLVA_LOGIN_HOST=http://localhost:8081
REACT_APP_IN_SYLVA_CLIENT_ID=in-sylva.user.app
REACT_APP_IN_SYLVA_GRANT_TYPE=password
REACT_APP_IN_SYLVA_REALM=in-sylva
Expand Down
30 changes: 15 additions & 15 deletions search/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ server {
proxy_pass http://backend_search/;
}

location /login/_next/static/ {
autoindex on;
# location /login/_next/static/ {
# autoindex on;
# /app/in-sylva.user.login/.next/static/G-XKPGgjYNxek_SDdSj9a/pages
alias /app/in-sylva.user.login/.next/static;
}
# alias /app/in-sylva.user.login/.next/static;
#}

location /login/ {
proxy_pass http://login:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

sub_filter_once off;
proxy_set_header Accept-Encoding "";
}
# location /login/ {
# proxy_pass http://login:8080/;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;

# sub_filter_once off;
# proxy_set_header Accept-Encoding "";
#}


location /source-manager/ {
Expand Down
30 changes: 15 additions & 15 deletions search/nginx/nginx_generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ server {
proxy_pass http://backend_search/;
}

location /login/_next/static/ {
autoindex on;
# location /login/_next/static/ {
# autoindex on;
# /app/in-sylva.user.login/.next/static/G-XKPGgjYNxek_SDdSj9a/pages
alias /app/in-sylva.user.login/.next/static;
}
# alias /app/in-sylva.user.login/.next/static;
#}

location /login/ {
proxy_pass http://login:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

sub_filter_once off;
proxy_set_header Accept-Encoding "";
}
# location /login/ {
# proxy_pass http://login:8080/;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;

# sub_filter_once off;
# proxy_set_header Accept-Encoding "";
#}


location /source-manager/ {
Expand Down

0 comments on commit b89ec93

Please sign in to comment.