Frontend web application for the GovStack test platform.
To customize the content of specific pages in your application, you can add your static HTML files to the frontend/content/custom/
directory. This directory is mapped into the Docker container, allowing your application to access and serve these files at runtime. Each HTML file should be named according to the page it represents (e.g., imprint.html
for the Imprint page).
If a custom HTML file is not provided in the custom
directory, the application will automatically fall back to using the default template located in the frontend/content/template/
directory. This ensures that your application can still display content even when custom pages are not available.
- Node.js (Version 16 or greater)
- Yarn
To configure and run the application, navigate to project directory - 'frontend' folder
cd frontend
Create an copy of example.env file.
# Use default environmental variables, which can be adjusted if necessary
mv .env.example .env
and run the following commands:
yarn install
yarn dev
This is a Next.js project bootstrapped with create-next-app
.
The application will run on localhost port 3003 by default.
To run build:
yarn build
To run tests:
yarn test
To run eslint:
yarn lint
Application can be deployed in docker container by running
docker-compose up --build
or
docker-compose up
Less (which stands for Leaner Style Sheets) is a backwards-compatible language extension for CSS.
Every .less
file should be localized in the styles
folder.
To run less-watch-compiler in terminal:
yarn less
Testing application has a simple backend written using express.js.
A more detailed description of the backend's part can be found in /backend/README.md
.
From the main directory (requires running mongoDB):
# Go to the directory
cd backend/
# Use default environmental variables, which can be adjusted if necessary
mv .env.example .env
yarn install
yarn dev
Backend service and monogoDB are also setups automatically
during docker-compose up --build
execution.
Below you will find all the guidelines.
To ensure that the file with translation keys is properly organized, it is worth familiarizing yourself with its rules:
-
JSON keys contain complete translation ID as string. The translation IDs use "." to structure the translations hierarchically
-
keys should be added alphabetically
-
use a
app.
prefix to store translations that are likely to be used throughout the application -
use
my_component.
prefix to store translations that are likely to be used only in this specific componentexample:
"my_component.custom_key"
-
develop a suitable naming scheme: snake_case
example:
"app.page_not_found"
-
avoid duplication of translation keys
-
remove unused translation keys
-
avoid concatenating translations
- Select a suitable plan (e.g., CX22) based on your resource needs.
- Operating System: Use Ubuntu 24.04 or similar.
- Add SSH keys to authenticate users and allow them to deploy the application.
- Use a DNS provider to map IP with domain names.
- Update DNS records to use new IP addresses:
testing.govstack.global -> Server IP
api.testing.govstack.global -> Server IP
- Set up an SSL/TLS certificate to use HTTPS instead of HTTP.
- Connect to the server:
ssh user@<your_server_ip>
- Ensure that Docker and Docker Compose are installed:
sudo apt update && sudo apt upgrade -y sudo apt install git docker docker-compose -y
- Create the
/opt/
directory and fetch thetesting-webapp
repository from GitHub:mkdir -p /opt/ cd /opt/
- Clone the repository:
git clone https://github.com/GovStackWorkingGroup/testing-webapp.git .
- Set up local
.env
files forfrontend
andbackend
directories:cp frontend/.env.example frontend/.env cp backend/.env.example backend/.env
- Fill in the variables based on comments:
Mongo_username
: root- For production, turn Jira config and email notifications to
true
. - Use GitHub for SSO for review users.
- For EU operators: use an email service based in the EU.
- Configure the script to match server credentials, e.g.:
elif [ "${DEPLOY_ENV}" == "prod" ]; then DEPLOYMENT_USER="ubuntu" DEPLOYMENT_HOST="testing.govstack.global" BRANCH="main" else
- Ensure your RSA key is set as default or specify it in the script:
sudo ssh -i your_rsa_key
- Navigate to
/opt/testing-webapp
and run:git fetch git checkout main git reset --hard origin/main git pull origin main
- Build and deploy using Docker Compose:
docker compose -f docker-compose.yml -f docker-compose.prod.yml up --build -d docker image prune -f
- Check running containers:
docker ps
- Inspect logs if needed:
Example:
docker logs <container_name>
docker logs testing-webapp-web-1 docker logs testing-webapp-backend-1
- Verify the database connection with MongoDB.
- Run backend tests.
- Run frontend tests.
- Use Postman to send requests to the API.
- Download from previous server: compliance forms, building block requirements and reports.
- Save static folder
/uploads
that stores documentation and logos - Copy static pages to new instance
Add CircleCI ssh key to the server to allow orbs to deploy application after each Pull Request merge.
- If set up with IP addresses, API may not be accessible on port 5000 without editing Nginx settings.
- Domain names may take up to 24 hours to bind to IP addresses.
- Changing domain names like
testing.govstack.global
requires updates in:docker-compose.yml
docker-compose.prod.yml
- If the application keeps loading, check the backend or database:
- If the database has no records, it may display "Loading more data."
- Do not use root as default user, change default passwords and API key
We use the Git Flow branching model to organize our work:
-
Main Branch (
main
)**: It represents the most stable version of our project, as it's used for production. Direct commits to this branch are not allowed; it's protected. -
Develop Branch (
develop
)**: It acts as an integration branch for features. All new features are branched off fromdevelop
. Direct commits to this branch are not allowed; it's protected. -
Feature Branches (
feature/*
)**: For new features or enhancements. Once development is done, they're merged back intodevelop
. -
Release Branches (
release/*
)**: These are cut fromdevelop
when we're ready for a new production release. When the release is finalized, it's merged into bothmain
anddevelop
. -
Hotfix Branches (
hotfix/*
)**: These are created if there's a severe bug in the production version. They branch off frommain
and are merged back into bothmain
anddevelop
after the fix.
Naming Conventions:
-
Feature Branches:
feature/ticket-ID
- Branches used for new features or enhancements, named according to the ticket or task ID. -
Release Branches**:
release/version
- Branches prepared for production releases, named by the release version. -
Hotfix Branches**:
hotfix/hotfix-name
- Branches used to quickly fix urgent issues in the production environment, named descriptively based on the nature of the hotfix.
Commit Message Convention:
- For each commit use format:
ticket_ID: brief description of the changes
Remember, when creating a new branch, always pull the latest changes from the branch you're basing off to avoid conflicts.