UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Verified Commit 9f7b106e authored by Patrick Tafoya's avatar Patrick Tafoya
Browse files

BULL-3224 - Reducing number of "project name" placeholder patterns.

parent 99ecec24
No related branches found
No related tags found
1 merge request!9Bull 3224 support branches etc
Showing
with 53 additions and 56 deletions
...@@ -4,7 +4,7 @@ This project provides templates used by the fiesta-wagon-bootstrap project to bu ...@@ -4,7 +4,7 @@ This project provides templates used by the fiesta-wagon-bootstrap project to bu
# template placeholder variables to be replaced # template placeholder variables to be replaced
- `<<projectName>>`: the name of the project. Should be all lower case and contain no whitespace. - `xx_project_name_xx`: the name of the project. Should be all lower case and contain no whitespace.
- `<<dbNameKey>>`: the name of the environment variable used to convey the database name depending on the chosen db. For example, postgres would use `PG_DATABASE` - `<<dbNameKey>>`: the name of the environment variable used to convey the database name depending on the chosen db. For example, postgres would use `PG_DATABASE`
- `<<dbUserKey>>`: the name of the environment variable used to convey the database username depending on the chosen db. For example, postgres would use `PG_USER` - `<<dbUserKey>>`: the name of the environment variable used to convey the database username depending on the chosen db. For example, postgres would use `PG_USER`
- `<<dbPassword>>`: the name of the environment variable used to convey the database password depending on the chosen db. For example, postgres would use `PG_PASSWORD` - `<<dbPassword>>`: the name of the environment variable used to convey the database password depending on the chosen db. For example, postgres would use `PG_PASSWORD`
......
# setup for fiesta-wagon-ingress # setup for fiesta-wagon-ingress
server { server {
listen 443 ssl; listen 443 ssl;
server_name {{projectName}}.dev.bigbang.mil; server_name xx_project_name_xx.dev.bigbang.mil;
location = /_auth { location = /_auth {
internal; internal;
...@@ -21,14 +21,14 @@ server { ...@@ -21,14 +21,14 @@ server {
# if the dev build server is down, try to serve the production build # if the dev build server is down, try to serve the production build
error_page 502 = @fallback; error_page 502 = @fallback;
set $ui_proxy {{projectName}}-ui:8080; set $ui_proxy xx_project_name_xx-ui:8080;
proxy_pass http://$ui_proxy; proxy_pass http://$ui_proxy;
} }
location @fallback { location @fallback {
include snippets/proxy-params.conf; include snippets/proxy-params.conf;
set $ui_proxy {{projectName}}-ui:8080; set $ui_proxy xx_project_name_xx-ui:8080;
proxy_pass http://$ui_proxy; proxy_pass http://$ui_proxy;
} }
...@@ -39,7 +39,7 @@ server { ...@@ -39,7 +39,7 @@ server {
include snippets/proxy-params.conf; include snippets/proxy-params.conf;
set $api_proxy {{projectName}}-api:8000; set $api_proxy xx_project_name_xx-api:8000;
proxy_pass http://$api_proxy/api$1$is_args$args; proxy_pass http://$api_proxy/api$1$is_args$args;
} }
} }
...@@ -6,7 +6,7 @@ WORKDIR /app ...@@ -6,7 +6,7 @@ WORKDIR /app
USER node USER node
#set up dependencies #set up dependencies
COPY --chown=node:node ./<<projectName>>-api/package.json ./ COPY --chown=node:node ./xx_project_name_xx-api/package.json ./
# install dependencies # install dependencies
# TODO: It would be vest to ensure npm install has been run before creating the image for the first time, then the if check can be removed # TODO: It would be vest to ensure npm install has been run before creating the image for the first time, then the if check can be removed
......
...@@ -7,7 +7,7 @@ WORKDIR /home/node ...@@ -7,7 +7,7 @@ WORKDIR /home/node
USER node USER node
# set up dependencies # set up dependencies
COPY --chown=node:node ./<<projectName>>-ui/package.json ./ COPY --chown=node:node ./xx_project_name_xx-ui/package.json ./
# install dependencies # install dependencies
# TODO: It would be best to ensure npm install has been run before creating the image for the first time, then the if check can be removed # TODO: It would be best to ensure npm install has been run before creating the image for the first time, then the if check can be removed
......
...@@ -3,13 +3,13 @@ services: ...@@ -3,13 +3,13 @@ services:
ingress: ingress:
image: registry.dso.mil/platform-one/party-bus/fiesta-wagon/fiesta-wagon-ingress:0.2.1 image: registry.dso.mil/platform-one/party-bus/fiesta-wagon/fiesta-wagon-ingress:0.2.1
container_name: <<projectName>>-ingress container_name: xx_project_name_xx-ingress
volumes: volumes:
- ./config/ingress.conf:/etc/nginx/fiesta-wagon-ingress.conf - ./config/ingress.conf:/etc/nginx/fiesta-wagon-ingress.conf
ports: ports:
- 443:443 - 443:443
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
extra_hosts: extra_hosts:
- "healthcheck.dev.bigbang.mil:127.0.0.1" - "healthcheck.dev.bigbang.mil:127.0.0.1"
healthcheck: healthcheck:
...@@ -20,12 +20,12 @@ services: ...@@ -20,12 +20,12 @@ services:
users: users:
image: registry.dso.mil/platform-one/party-bus/fiesta-wagon/fiesta-wagon-users:0.2.2 image: registry.dso.mil/platform-one/party-bus/fiesta-wagon/fiesta-wagon-users:0.2.2
container_name: <<projectName>>-users container_name: xx_project_name_xx-users
volumes: volumes:
- ./users-db:/srv/users/api/db - ./users-db:/srv/users/api/db
- ./config/healthcheck.js:/opt/healthcheck/healthcheck.js - ./config/healthcheck.js:/opt/healthcheck/healthcheck.js
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
healthcheck: healthcheck:
test: /opt/healthcheck/healthcheck.js http://localhost:8080 test: /opt/healthcheck/healthcheck.js http://localhost:8080
timeout: 10s timeout: 10s
...@@ -33,8 +33,7 @@ services: ...@@ -33,8 +33,7 @@ services:
retries: 10 retries: 10
volumes: volumes:
<<projectName>>-psql: {} xx_project_name_xx-psql: {}
networks: networks:
<<projectName>>-net: {} xx_project_name_xx-net: {}
\ No newline at end of file
services: services:
<<projectName>>-api: xx_project_name_xx-api:
image: cosmtrek/air:v1.49.0 image: cosmtrek/air:v1.49.0
container_name: <<projectName>>-api container_name: xx_project_name_xx-api
working_dir: /app working_dir: /app
env_file: env_file:
- .env - .env
...@@ -10,7 +10,7 @@ services: ...@@ -10,7 +10,7 @@ services:
- # container internal port (not exposed to host) - # container internal port (not exposed to host)
- PORT=8080 - PORT=8080
- air_wd=/app - air_wd=/app
- <<dbNameKey>>=<<projectName>> - <<dbNameKey>>=xx_project_name_xx
- <<dbUserKey>>=databaseUser - <<dbUserKey>>=databaseUser
- <<dbPassword>>=databasePw1! - <<dbPassword>>=databasePw1!
- <<dbHost>>=db - <<dbHost>>=db
...@@ -19,10 +19,10 @@ services: ...@@ -19,10 +19,10 @@ services:
# debugger port # debugger port
- "40000:40000" - "40000:40000"
volumes: volumes:
- ./<<projectName>>-api:/app - ./xx_project_name_xx-api:/app
- ./config/healthcheck.sh:/opt/healthcheck/healthcheck.sh - ./config/healthcheck.sh:/opt/healthcheck/healthcheck.sh
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy
......
services: services:
# backend nodejs API # backend nodejs API
<<projectName>>-api: xx_project_name_xx-api:
build: build:
context: . context: .
dockerfile: Dockerfile.be.dev dockerfile: Dockerfile.be.dev
container_name: <<projectName>>-api container_name: xx_project_name_xx-api
volumes: volumes:
- ./<<projectName>>-api:/app - ./xx_project_name_xx-api:/app
- /app/node_modules - /app/node_modules
user: node user: node
command: bash -c "npm run dev" command: bash -c "npm run dev"
...@@ -15,7 +15,7 @@ services: ...@@ -15,7 +15,7 @@ services:
# container internal port (not exposed to host) # container internal port (not exposed to host)
- PORT=8000 - PORT=8000
# db config # db config
- <<dbNameKey>>=<<projectName>> - <<dbNameKey>>=xx_project_name_xx
- <<dbUserKey>>=databaseUser - <<dbUserKey>>=databaseUser
- <<dbPassword>>=databasePw1! - <<dbPassword>>=databasePw1!
- <<dbHost>>=db - <<dbHost>>=db
...@@ -23,7 +23,7 @@ services: ...@@ -23,7 +23,7 @@ services:
tty: true tty: true
restart: always restart: always
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
depends_on: depends_on:
db: db:
condition: service_healthy condition: service_healthy
......
...@@ -2,21 +2,21 @@ services: ...@@ -2,21 +2,21 @@ services:
db: db:
image: postgres:11-alpine image: postgres:11-alpine
container_name: <<projectName>>-db container_name: xx_project_name_xx-db
entrypoint: /postgres-entrypoint.sh entrypoint: /postgres-entrypoint.sh
command: > command: >
-c ssl=on -c ssl=on
-c ssl_cert_file=/var/lib/postgresql/ssl/server.crt -c ssl_cert_file=/var/lib/postgresql/ssl/server.crt
-c ssl_key_file=/var/lib/postgresql/ssl/server.key -c ssl_key_file=/var/lib/postgresql/ssl/server.key
environment: environment:
- POSTGRES_DB=<<projectName>> - POSTGRES_DB=xx_project_name_xx
- POSTGRES_USER=databaseUser - POSTGRES_USER=databaseUser
- POSTGRES_PASSWORD=databasePw1! - POSTGRES_PASSWORD=databasePw1!
volumes: volumes:
- <<projectName>>-psql:/var/lib/postgresql/data/ - xx_project_name_xx-psql:/var/lib/postgresql/data/
- ./config/postgres-entrypoint.sh:/postgres-entrypoint.sh - ./config/postgres-entrypoint.sh:/postgres-entrypoint.sh
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
ports: ports:
- "5432:5432" - "5432:5432"
healthcheck: healthcheck:
......
services: services:
<<projectName>>-ui: xx_project_name_xx-ui:
build: build:
context: . context: .
dockerfile: Dockerfile.ui.dev dockerfile: Dockerfile.ui.dev
container_name: <<projectName>>-ui container_name: xx_project_name_xx-ui
volumes: volumes:
- ./<<projectName>>-ui:/home/node - ./xx_project_name_xx-ui:/home/node
- /home/node/node_modules - /home/node/node_modules
command: npx vite --host command: npx vite --host
environment: environment:
# container internal port (not exposed to host) # container internal port (not exposed to host)
- PORT=8080 - PORT=8080
# this is the url the browser uses, so it needs to be the external url (going through ingress to hit the backend) # this is the url the browser uses, so it needs to be the external url (going through ingress to hit the backend)
- VITE_APP_API_BASE_URL=https://<<projectName>>.dev.bigbang.mil/api - VITE_APP_API_BASE_URL=https://xx_project_name_xx.dev.bigbang.mil/api
stdin_open: true stdin_open: true
tty: true tty: true
networks: networks:
- <<projectName>>-net - xx_project_name_xx-net
healthcheck: healthcheck:
test: curl -f http://localhost:$$PORT test: curl -f http://localhost:$$PORT
timeout: 10s timeout: 10s
retries: 5 retries: 5
start_period: 20s start_period: 20s
\ No newline at end of file
...@@ -14,4 +14,4 @@ services: ...@@ -14,4 +14,4 @@ services:
- DOCKERFILE_LOC=Dockerfile - DOCKERFILE_LOC=Dockerfile
volumes: volumes:
- ./:/local-dev - ./:/local-dev
- ./<<projectName>><<subProject>>:/app - ./xx_project_name_xx<<subProject>>:/app
...@@ -14,4 +14,4 @@ services: ...@@ -14,4 +14,4 @@ services:
- DOCKERFILE_LOC=Dockerfile - DOCKERFILE_LOC=Dockerfile
volumes: volumes:
- ./:/local-dev - ./:/local-dev
- ./<<projectName>><<subProject>>:/app - ./xx_project_name_xx<<subProject>>:/app
...@@ -11,5 +11,4 @@ services: ...@@ -11,5 +11,4 @@ services:
- SCAN_DIR=/app - SCAN_DIR=/app
volumes: volumes:
- ./:/local-dev - ./:/local-dev
- ./<<projectName>><<subProject>>:/app - ./xx_project_name_xx<<subProject>>:/app
\ No newline at end of file
...@@ -13,5 +13,4 @@ services: ...@@ -13,5 +13,4 @@ services:
- CI_JOB_NAME=npm-unit-tests<<subProject>> - CI_JOB_NAME=npm-unit-tests<<subProject>>
volumes: volumes:
- ./:/local-dev - ./:/local-dev
- ./<<projectName>><<subProject>>:/app - ./xx_project_name_xx<<subProject>>:/app
\ No newline at end of file
...@@ -14,4 +14,4 @@ services: ...@@ -14,4 +14,4 @@ services:
- TRUFFLEHOG_EXCLUDE_PATHS=<<exclusions>> - TRUFFLEHOG_EXCLUDE_PATHS=<<exclusions>>
volumes: volumes:
- ./:/local-dev - ./:/local-dev
- ./<<projectName>><<subProject>>:/app - ./xx_project_name_xx<<subProject>>:/app
## Development Environment Setup for golang ## Development Environment Setup for golang
- Ensure a `.env` file exists at the root of `<<projectName>>-local-dev` and has the required properties. Example: - Ensure a `.env` file exists at the root of `xx_project_name_xx-local-dev` and has the required properties. Example:
``` ```
DEBUGGER_ARGS=--continue DEBUGGER_ARGS=--continue
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
### Debugging ### Debugging
If running <<projectName>> via the steps above, debugging is already enabled via Delve. If the env var `DEBUGGER_ARGS` If running xx_project_name_xx via the steps above, debugging is already enabled via Delve. If the env var `DEBUGGER_ARGS`
includes `--continue`, the application will start up and then allow you to attach a debugger. However, if you want to includes `--continue`, the application will start up and then allow you to attach a debugger. However, if you want to
debug any of the initialization/startup steps (e.g. `main()`, etc.), you will have debug any of the initialization/startup steps (e.g. `main()`, etc.), you will have
to remove `--continue` from `DEBUGGER_ARGS` and restart the `<<projectName>>-api` container. This will halt startup until there is a to remove `--continue` from `DEBUGGER_ARGS` and restart the `xx_project_name_xx-api` container. This will halt startup until there is a
debugger attached, allowing you to debug initialization steps in the code. debugger attached, allowing you to debug initialization steps in the code.
To connect your IDE to the running instance, set up your debugger to connect to a Go "remote" or "server" To connect your IDE to the running instance, set up your debugger to connect to a Go "remote" or "server"
......
...@@ -3,9 +3,9 @@ node_modules ...@@ -3,9 +3,9 @@ node_modules
/dist /dist
# fiesta-wagon specific ignores # fiesta-wagon specific ignores
<<projectName>>-ui/ xx_project_name_xx-ui/
<<projectName>>-api/ xx_project_name_xx-api/
<<projectName>>-docs/ xx_project_name_xx-docs/
users-db/ users-db/
/reports/ /reports/
...@@ -31,4 +31,4 @@ pnpm-debug.log* ...@@ -31,4 +31,4 @@ pnpm-debug.log*
*.iml *.iml
# Other # Other
/tmp/ /tmp/
\ No newline at end of file
# <<projectName>>-local-dev # xx_project_name_xx-local-dev
## Quickstart ## Quickstart
...@@ -8,7 +8,7 @@ Due to the new (as of March 2024) bigbang.mil DNS changes, you must add entries ...@@ -8,7 +8,7 @@ Due to the new (as of March 2024) bigbang.mil DNS changes, you must add entries
```aiignore ```aiignore
# add fiesta-wagon-ingress entries to /etc/hosts # add fiesta-wagon-ingress entries to /etc/hosts
127.0.0.1 users.dev.bigbang.mil 127.0.0.1 users.dev.bigbang.mil
127.0.0.1 <<projectName>>.dev.bigbang.mil 127.0.0.1 xx_project_name_xx.dev.bigbang.mil
``` ```
Next, grant execute permissions on the startup.sh file and run the setup script. Next, grant execute permissions on the startup.sh file and run the setup script.
...@@ -19,22 +19,22 @@ bash ./scripts/setup.sh ...@@ -19,22 +19,22 @@ bash ./scripts/setup.sh
``` ```
### Project-specific setup ### Project-specific setup
If your backend uses node.js, run `npm install` in the <<projectName>>-api directory next. If your backend uses node.js, run `npm install` in the xx_project_name_xx-api directory next.
### Startup ### Startup
```sh ```sh
# start all the <<projectName>> components # start all the xx_project_name_xx components
docker compose up docker compose up
``` ```
Access the <<projectName>> UI at https://<<projectName>>.dev.bigbang.mil Access the xx_project_name_xx UI at https://xx_project_name_xx.dev.bigbang.mil
Access the <<projectName>> API Docs at https://<<projectName>>.dev.bigbang.mil/api/docs Access the xx_project_name_xx API Docs at https://xx_project_name_xx.dev.bigbang.mil/api/docs
### Create a user ### Create a user
`<<projectName>>-local-dev` uses Fiesta Wagon Ingress, meaning that you can configure local user JWTs from https://users.dev.bigbang.mil/ `xx_project_name_xx-local-dev` uses Fiesta Wagon Ingress, meaning that you can configure local user JWTs from https://users.dev.bigbang.mil/
To grant a local user admin permissions, modify the user's JWT to include the following `group-full` attribute: To grant a local user admin permissions, modify the user's JWT to include the following `group-full` attribute:
...@@ -42,7 +42,7 @@ To grant a local user admin permissions, modify the user's JWT to include the fo ...@@ -42,7 +42,7 @@ To grant a local user admin permissions, modify the user's JWT to include the fo
{ {
..., ...,
"group-full": [ "group-full": [
"/Platform One/Products/<<projectName>>/IL2/admin" "/Platform One/Products/xx_project_name_xx/IL2/admin"
] ]
} }
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment