diff --git a/.env.example b/.env.example index 28d690e..f22b049 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,19 @@ +# MYSQL MYSQL_ROOT_PASSWORD=strongpassword MYSQL_DATABASE=whaticket +TZ=America/Fortaleza + +# BACKEND +BACKEND_PORT=8080 +BACKEND_SERVER_NAME=api.mydomain.com +BACKEND_URL=https://api.mydomain.com/ JWT_SECRET=3123123213123 JWT_REFRESH_SECRET=75756756756 + +# FRONTEND FRONTEND_PORT=3000 -TZ=America/Fortaleza +FRONTEND_SERVER_NAME=myapp.mydomain.com +FRONTEND_URL=https://myapp.mydomain.com/ + +# BROWSERLESS MAX_CONCURRENT_SESSIONS=1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9f89ea2..b5c1a76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .docker/data/ +ssl/ .env \ No newline at end of file diff --git a/docker-compose-browserless.yaml b/docker-compose.browserless.yaml similarity index 100% rename from docker-compose-browserless.yaml rename to docker-compose.browserless.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml index 8a3f503..a7a113d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,9 +16,11 @@ services: - DB_NAME=${MYSQL_DATABASE:-whaticket} - JWT_SECRET=${JWT_SECRET:-3123123213123} - JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET:-75756756756} - - BACKEND_URL=${BACKEND_URL:-http://localhost:3000/api} - - FRONTEND_URL=${BACKEND_URL:-http://localhost:3000} + - BACKEND_URL=${BACKEND_URL:-http://localhost:8080} + - FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000} - CHROME_ARGS=--no-sandbox --disable-setuid-sandbox + ports: + - ${BACKEND_PORT:-8080}:3000 networks: - whaticket @@ -29,7 +31,12 @@ services: context: ./frontend dockerfile: ./Dockerfile environment: - - URL_BACKEND=http://backend:3000/ + - URL_BACKEND=backend:3000 + - REACT_APP_BACKEND_URL=${BACKEND_URL:-http://localhost:8080/} + - FRONTEND_SERVER_NAME=${FRONTEND_SERVER_NAME} + - BACKEND_SERVER_NAME=${BACKEND_SERVER_NAME} + volumes: + - ./ssl/:/etc/nginx/ssl/ networks: - whaticket diff --git a/frontend/.docker/add-env-vars.sh b/frontend/.docker/add-env-vars.sh new file mode 100644 index 0000000..6752d0e --- /dev/null +++ b/frontend/.docker/add-env-vars.sh @@ -0,0 +1,27 @@ +_writeFrontendEnvVars() { + ENV_JSON="$(jq --compact-output --null-input 'env | with_entries(select(.key | startswith("REACT_APP_")))')" + ENV_JSON_ESCAPED="$(printf "%s" "${ENV_JSON}" | sed -e 's/[\&/]/\\&/g')" + sed -i "s/