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
# 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`
- `<<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`
......
# setup for fiesta-wagon-ingress
server {
listen 443 ssl;
server_name {{projectName}}.dev.bigbang.mil;
server_name xx_project_name_xx.dev.bigbang.mil;
location = /_auth {
internal;
......@@ -21,14 +21,14 @@ server {
# if the dev build server is down, try to serve the production build
error_page 502 = @fallback;
set $ui_proxy {{projectName}}-ui:8080;
set $ui_proxy xx_project_name_xx-ui:8080;
proxy_pass http://$ui_proxy;
}
location @fallback {
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;
}
......@@ -39,7 +39,7 @@ server {
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;
}
}
......@@ -6,7 +6,7 @@ WORKDIR /app
USER node
#set up dependencies
COPY --chown=node:node ./<<projectName>>-api/package.json ./
COPY --chown=node:node ./xx_project_name_xx-api/package.json ./
# 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
......
......@@ -7,7 +7,7 @@ WORKDIR /home/node
USER node
# set up dependencies
COPY --chown=node:node ./<<projectName>>-ui/package.json ./
COPY --chown=node:node ./xx_project_name_xx-ui/package.json ./
# 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
......
......@@ -3,13 +3,13 @@ services:
ingress:
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:
- ./config/ingress.conf:/etc/nginx/fiesta-wagon-ingress.conf
ports:
- 443:443
networks:
- <<projectName>>-net
- xx_project_name_xx-net
extra_hosts:
- "healthcheck.dev.bigbang.mil:127.0.0.1"
healthcheck:
......@@ -20,12 +20,12 @@ services:
users:
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:
- ./users-db:/srv/users/api/db
- ./config/healthcheck.js:/opt/healthcheck/healthcheck.js
networks:
- <<projectName>>-net
- xx_project_name_xx-net
healthcheck:
test: /opt/healthcheck/healthcheck.js http://localhost:8080
timeout: 10s
......@@ -33,8 +33,7 @@ services:
retries: 10
volumes:
<<projectName>>-psql: {}
xx_project_name_xx-psql: {}
networks:
<<projectName>>-net: {}
\ No newline at end of file
xx_project_name_xx-net: {}
services:
<<projectName>>-api:
xx_project_name_xx-api:
image: cosmtrek/air:v1.49.0
container_name: <<projectName>>-api
container_name: xx_project_name_xx-api
working_dir: /app
env_file:
- .env
......@@ -10,7 +10,7 @@ services:
- # container internal port (not exposed to host)
- PORT=8080
- air_wd=/app
- <<dbNameKey>>=<<projectName>>
- <<dbNameKey>>=xx_project_name_xx
- <<dbUserKey>>=databaseUser
- <<dbPassword>>=databasePw1!
- <<dbHost>>=db
......@@ -19,10 +19,10 @@ services:
# debugger port
- "40000:40000"
volumes:
- ./<<projectName>>-api:/app
- ./xx_project_name_xx-api:/app
- ./config/healthcheck.sh:/opt/healthcheck/healthcheck.sh
networks:
- <<projectName>>-net
- xx_project_name_xx-net
depends_on:
db:
condition: service_healthy
......
services:
# backend nodejs API
<<projectName>>-api:
xx_project_name_xx-api:
build:
context: .
dockerfile: Dockerfile.be.dev
container_name: <<projectName>>-api
container_name: xx_project_name_xx-api
volumes:
- ./<<projectName>>-api:/app
- ./xx_project_name_xx-api:/app
- /app/node_modules
user: node
command: bash -c "npm run dev"
......@@ -15,7 +15,7 @@ services:
# container internal port (not exposed to host)
- PORT=8000
# db config
- <<dbNameKey>>=<<projectName>>
- <<dbNameKey>>=xx_project_name_xx
- <<dbUserKey>>=databaseUser
- <<dbPassword>>=databasePw1!
- <<dbHost>>=db
......@@ -23,7 +23,7 @@ services:
tty: true
restart: always
networks:
- <<projectName>>-net
- xx_project_name_xx-net
depends_on:
db:
condition: service_healthy
......
......@@ -2,21 +2,21 @@ services:
db:
image: postgres:11-alpine
container_name: <<projectName>>-db
container_name: xx_project_name_xx-db
entrypoint: /postgres-entrypoint.sh
command: >
-c ssl=on
-c ssl_cert_file=/var/lib/postgresql/ssl/server.crt
-c ssl_key_file=/var/lib/postgresql/ssl/server.key
environment:
- POSTGRES_DB=<<projectName>>
- POSTGRES_DB=xx_project_name_xx
- POSTGRES_USER=databaseUser
- POSTGRES_PASSWORD=databasePw1!
volumes:
- <<projectName>>-psql:/var/lib/postgresql/data/
- xx_project_name_xx-psql:/var/lib/postgresql/data/
- ./config/postgres-entrypoint.sh:/postgres-entrypoint.sh
networks:
- <<projectName>>-net
- xx_project_name_xx-net
ports:
- "5432:5432"
healthcheck:
......
services:
<<projectName>>-ui:
xx_project_name_xx-ui:
build:
context: .
dockerfile: Dockerfile.ui.dev
container_name: <<projectName>>-ui
container_name: xx_project_name_xx-ui
volumes:
- ./<<projectName>>-ui:/home/node
- ./xx_project_name_xx-ui:/home/node
- /home/node/node_modules
command: npx vite --host
environment:
# container internal port (not exposed to host)
- PORT=8080
# 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
tty: true
networks:
- <<projectName>>-net
- xx_project_name_xx-net
healthcheck:
test: curl -f http://localhost:$$PORT
timeout: 10s
retries: 5
start_period: 20s
\ No newline at end of file
start_period: 20s
......@@ -14,4 +14,4 @@ services:
- DOCKERFILE_LOC=Dockerfile
volumes:
- ./:/local-dev
- ./<<projectName>><<subProject>>:/app
- ./xx_project_name_xx<<subProject>>:/app
......@@ -14,4 +14,4 @@ services:
- DOCKERFILE_LOC=Dockerfile
volumes:
- ./:/local-dev
- ./<<projectName>><<subProject>>:/app
- ./xx_project_name_xx<<subProject>>:/app
......@@ -11,5 +11,4 @@ services:
- SCAN_DIR=/app
volumes:
- ./:/local-dev
- ./<<projectName>><<subProject>>:/app
\ No newline at end of file
- ./xx_project_name_xx<<subProject>>:/app
......@@ -13,5 +13,4 @@ services:
- CI_JOB_NAME=npm-unit-tests<<subProject>>
volumes:
- ./:/local-dev
- ./<<projectName>><<subProject>>:/app
\ No newline at end of file
- ./xx_project_name_xx<<subProject>>:/app
......@@ -14,4 +14,4 @@ services:
- TRUFFLEHOG_EXCLUDE_PATHS=<<exclusions>>
volumes:
- ./:/local-dev
- ./<<projectName>><<subProject>>:/app
- ./xx_project_name_xx<<subProject>>:/app
## 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
......@@ -12,10 +12,10 @@
### 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
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.
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
/dist
# fiesta-wagon specific ignores
<<projectName>>-ui/
<<projectName>>-api/
<<projectName>>-docs/
xx_project_name_xx-ui/
xx_project_name_xx-api/
xx_project_name_xx-docs/
users-db/
/reports/
......@@ -31,4 +31,4 @@ pnpm-debug.log*
*.iml
# Other
/tmp/
\ No newline at end of file
/tmp/
# <<projectName>>-local-dev
# xx_project_name_xx-local-dev
## Quickstart
......@@ -8,7 +8,7 @@ Due to the new (as of March 2024) bigbang.mil DNS changes, you must add entries
```aiignore
# add fiesta-wagon-ingress entries to /etc/hosts
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.
......@@ -19,22 +19,22 @@ bash ./scripts/setup.sh
```
### 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
```sh
# start all the <<projectName>> components
# start all the xx_project_name_xx components
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
`<<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:
......@@ -42,7 +42,7 @@ To grant a local user admin permissions, modify the user's JWT to include the fo
{
...,
"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