Fixes nginx stupid. Adds back deploy url. Totally refactors docker-compose.
This commit is contained in:
parent
650bb8f6f1
commit
47d1c7fe88
|
@ -24,11 +24,14 @@ COPY --from=builder /crc-bpmn/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
||||||
RUN chmod +x ./entrypoint.sh
|
RUN chmod +x ./entrypoint.sh
|
||||||
|
|
||||||
|
# Fix for Angular routing
|
||||||
|
RUN echo "pushstate: enabled" > /etc/nginx/html/Staticfile
|
||||||
|
|
||||||
# The entrypoint.sh script will run after the container finishes starting.
|
# The entrypoint.sh script will run after the container finishes starting.
|
||||||
# Substitutes environment variables in nginx configuration and index.html,
|
# Substitutes environment variables in nginx configuration and index.html,
|
||||||
# then starts/reloads nginx.
|
# then starts/reloads nginx.
|
||||||
ENTRYPOINT ["./entrypoint.sh", \
|
ENTRYPOINT ["./entrypoint.sh", \
|
||||||
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
|
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
|
||||||
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0", \
|
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0", \
|
||||||
"/etc/nginx/html", \
|
"/etc/nginx/html", \
|
||||||
"true"]
|
"true"]
|
||||||
|
|
|
@ -2,81 +2,70 @@ version: "3.3"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
container_name: db
|
container_name: db
|
||||||
image: sartography/cr-connect-db:$E2E_TAG
|
image: sartography/cr-connect-db:dev
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=crc_user
|
- POSTGRES_USER=rrt_user
|
||||||
- POSTGRES_PASSWORD=crc_pass
|
- POSTGRES_PASSWORD=rrt_pass
|
||||||
- POSTGRES_MULTIPLE_DATABASES=crc_test,crc_dev,pb_test,pb
|
- POSTGRES_MULTIPLE_DATABASES=rrt
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "pg_isready"]
|
test: ["CMD", "pg_isready"]
|
||||||
timeout: 20s
|
timeout: 20s
|
||||||
retries: 10
|
retries: 10
|
||||||
pb:
|
|
||||||
container_name: pb
|
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
image: sartography/protocol-builder-mock:$E2E_TAG
|
|
||||||
environment:
|
|
||||||
- UPGRADE_DB=true
|
|
||||||
- DB_HOST=db
|
|
||||||
- DB_PORT=5432
|
|
||||||
- DB_PASSWORD=crc_pass
|
|
||||||
- DB_USER=crc_user
|
|
||||||
- DB_NAME=pb_test
|
|
||||||
- PORT0=5001
|
|
||||||
- APPLICATION_ROOT=/
|
|
||||||
- CORS_ALLOW_ORIGINS=localhost:5000,backend:5000
|
|
||||||
ports:
|
|
||||||
- "5001:5001"
|
|
||||||
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
|
|
||||||
|
|
||||||
ldap:
|
|
||||||
container_name: ldap
|
|
||||||
image: tuxmonteiro/ldap-mock
|
|
||||||
ports:
|
|
||||||
- "3890"
|
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
container_name: backend
|
container_name: backend
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- pb
|
image: sartography/cr-connect-workflow:dev
|
||||||
- ldap
|
|
||||||
image: sartography/cr-connect-workflow:$E2E_TAG
|
|
||||||
environment:
|
environment:
|
||||||
- UPGRADE_DB=true
|
- APPLICATION_ROOT=/api
|
||||||
- RESET_DB=true
|
|
||||||
- LDAP_URL=ldap:3890
|
|
||||||
- PB_BASE_URL=http://pb:5001/v2.0/
|
|
||||||
- DB_HOST=db
|
|
||||||
- DB_PORT=5432
|
|
||||||
- DB_PASSWORD=crc_pass
|
|
||||||
- DB_USER=crc_user
|
|
||||||
- DB_NAME=crc_test
|
|
||||||
- PORT0=5000
|
|
||||||
- APPLICATION_ROOT=/
|
|
||||||
- CORS_ALLOW_ORIGINS=localhost:5002,bpmn:5002,localhost:4200,frontend:4200
|
- CORS_ALLOW_ORIGINS=localhost:5002,bpmn:5002,localhost:4200,frontend:4200
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=rrt
|
||||||
|
- DB_PASSWORD=rrt_pass
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_USER=rrt_user
|
||||||
|
- LDAP_URL=ldap.virginia.edu
|
||||||
|
- PB_ENABLED=false
|
||||||
|
- PORT0=5000
|
||||||
|
- RESET_DB=true
|
||||||
|
- UPGRADE_DB=true
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
command: ./wait-for-it.sh pb:5001 -t 0 -- ./docker_run.sh
|
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
|
||||||
|
|
||||||
# # Uncomment for debugging
|
bpmn:
|
||||||
# bpmn:
|
container_name: bpmn
|
||||||
# container_name: bpmn
|
depends_on:
|
||||||
# depends_on:
|
- db
|
||||||
# - db
|
- backend
|
||||||
# - pb
|
image: bpmn:local
|
||||||
# - ldap
|
# image: sartography/cr-connect-bpmn:dev
|
||||||
# - backend
|
environment:
|
||||||
# image: sartography/cr-connect-bpmn:$E2E_TAG
|
- API_URL=http://localhost:5000/api/v1.0
|
||||||
# environment:
|
- BASE_HREF=/bpmn/
|
||||||
# - API_URL=http://localhost:5000/v1.0
|
- DEPLOY_URL=/bpmn/
|
||||||
# - BASE_HREF=/
|
- HOME_ROUTE=home
|
||||||
# - HOME_ROUTE=home
|
- PORT0=5002
|
||||||
# - IRB_URL=http://localhost:5001/
|
- PRODUCTION=false
|
||||||
# - PORT0=5002
|
ports:
|
||||||
# - PRODUCTION=false
|
- "5002:5002"
|
||||||
# ports:
|
|
||||||
# - "5002:5002"
|
frontend:
|
||||||
|
container_name: frontend
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- backend
|
||||||
|
image: frontend:local
|
||||||
|
# image: sartography/cr-connect-frontend:dev
|
||||||
|
environment:
|
||||||
|
- API_URL=http://localhost:5000/api/v1.0
|
||||||
|
- BASE_HREF=/app/
|
||||||
|
- DEPLOY_URL=/app/
|
||||||
|
- HOME_ROUTE=home
|
||||||
|
- PORT0=4200
|
||||||
|
- PRODUCTION=false
|
||||||
|
ports:
|
||||||
|
- "4200:4200"
|
||||||
|
|
|
@ -43,12 +43,17 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find & replace BASE_HREF in all files in the nginx html directory
|
# Find & replace BASE_HREF in all files in the nginx html directory
|
||||||
if [[ "$2" == *"BASE_HREF"* ]]; then
|
if [[ "$2" == *"BASE_HREF"* ]] && [[ "$2" == *"DEPLOY_URL"* ]]; then
|
||||||
# Add trailing slash to $BASE_HREF if needed
|
# Add trailing slash to $BASE_HREF if needed
|
||||||
length=${#BASE_HREF}
|
length=${#BASE_HREF}
|
||||||
last_char=${BASE_HREF:length-1:1}
|
last_char=${BASE_HREF:length-1:1}
|
||||||
[[ $last_char != "/" ]] && BASE_HREF="$BASE_HREF/"; :
|
[[ $last_char != "/" ]] && BASE_HREF="$BASE_HREF/"; :
|
||||||
|
|
||||||
|
# Add trailing slash to $DEPLOY_URL if needed
|
||||||
|
length=${#DEPLOY_URL}
|
||||||
|
last_char=${DEPLOY_URL:length-1:1}
|
||||||
|
[[ $last_char != "/" ]] && DEPLOY_URL="$DEPLOY_URL/"; :
|
||||||
|
|
||||||
# The third parameter is the absolute path to the nginx html directory
|
# The third parameter is the absolute path to the nginx html directory
|
||||||
if [[ $num_args -ge 3 ]]; then
|
if [[ $num_args -ge 3 ]]; then
|
||||||
# Replace all instances of __REPLACE_ME_WITH_BASE_HREF__ with $BASE_HREF
|
# Replace all instances of __REPLACE_ME_WITH_BASE_HREF__ with $BASE_HREF
|
||||||
|
@ -58,6 +63,14 @@ if [[ "$2" == *"BASE_HREF"* ]]; then
|
||||||
echo 'Replacing base href...'
|
echo 'Replacing base href...'
|
||||||
# Wait a few seconds in case find | sed needs more time
|
# Wait a few seconds in case find | sed needs more time
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
# Replace all instances of __REPLACE_ME_WITH_DEPLOY_URL__ with $DEPLOY_URL
|
||||||
|
find "$3" \( -type d -name .git -prune \) -o -type f -print0 | \
|
||||||
|
xargs -0 sed -i 's@__REPLACE_ME_WITH_DEPLOY_URL__@'"$DEPLOY_URL"'@g'
|
||||||
|
|
||||||
|
echo 'Replacing deploy url...'
|
||||||
|
# Wait a few seconds in case find | sed needs more time
|
||||||
|
sleep 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,10 @@ server {
|
||||||
listen $PORT0;
|
listen $PORT0;
|
||||||
|
|
||||||
location $BASE_HREF/ {
|
location $BASE_HREF/ {
|
||||||
root /etc/nginx/html;
|
alias /etc/nginx/html/;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
try_files $uri$args $uri$args/ $BASE_HREF/index.html =404;
|
try_files $uri$args $uri$args/ $uri $uri/ $BASE_HREF/index.html;
|
||||||
|
rewrite ^([^.]*[^/])$ $1/ permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
include /etc/nginx/extra-conf.d/*.conf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"build:prod": "ng build --configuration=production --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__",
|
"build:prod": "ng build --configuration=production --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__",
|
||||||
"build:staging": "ng build --configuration=staging --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__",
|
"build:staging": "ng build --configuration=staging --prod --base-href=__REPLACE_ME_WITH_BASE_HREF__ --deploy-url=__REPLACE_ME_WITH_DEPLOY_URL__",
|
||||||
"build:test": "ng build --configuration=test",
|
"build:test": "ng build --configuration=test",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",
|
"test:coverage": "ng test --codeCoverage=true --watch=false --browsers=ChromeHeadless",
|
||||||
|
|
Loading…
Reference in New Issue