Node.js REST service for the BadgeHub
Make sure Docker is installed and running.
Before running, copy the .env.example
into .env
cp .env.example .env
and fill out the details.
Then start the Docker containers by typing
docker compose up --detach
Then visit http://localhost:8001/ for the development BadgeHub homepage.
Visit http://localhost:8002/ for the pgAdmin interface.
Use password badgehub
to connect to the BadgeHub database server.
Use the OpenAPI (Swagger) documentation to interact with the REST API.
After setting up the development container, you can start it with
docker compose up --detach
The API should now be accessible through localhost:8001
.
And to stop BadgeHub
docker compose down
Or, to stop BadgeHub and delete all volumes (to start fresh)
docker compose down --volumes
Container commands like stop
, start
, restart
and logs
can also be sent to one of the containers from the compose file. For example
docker compose restart node
will restart the node container only.
At the moment, this is the database schema:
In production, use the production docker compose file docker-compose-production.yml
.
The NODE_ENV
environment file is set to production
, there's no watcher and
PM2 is used to run Node.js multithreaded.
The first time, a Docker container is created. Make sure the dist
directory
contains the latest build to be copied to the container.
Also the public
directory and package.json
and package-lock.json
will
be copied.
To start:
docker compose --file docker-compose-production.yml up --detach
Then visit http://localhost:9001/ for the production BadgeHub homepage and http://localhost:9002/ for PG_Admin, the UI for the database.
To wind down:
docker compose --file docker-compose-production.yml down