Messenger of Gondor.
hirgon is a web application for scheduling message content.
Messages may be added, deleted, set active, or scheduled to be made active at a later date.
NOTE: this project is still WIP and missing several key features...
- git
- npm
- nodejs
- postgresql
- redis
- make
git clone git@github.com:booksmith-io/hirgon.git
cd hirgon
npm run setup
cp -a .hirgonrc.example .hirgonrc
The configuration file contains the following keys and values:
The app section defines the application specific configuration.
"app": {
"name": "hirgon",
"port": 5000,
"address": "0.0.0.0"
}
nameis required and controls the name of the running appportis required and is the port to bind the app to when running the applicationaddressis required and is the IP address to bind the app to when running the application
The session section defines the development and production session secret keys.
"session": {
"secret": {
"development": "keyboard-cat",
"production": ""
}
}
Both development and production are required for the environment the application is being run.
production is autogenerated when building the docker container.
The database section defines the PostgreSQL connection details.
"database": {
"host": "localhost",
"port": 5432,
"name": "hirgon",
"user": "hirgon",
"password": "hirgon",
"ssl": 0
}
hostis required and is the PostgreSQL host nameportis required and is the PostgreSQL TCP portnameis required and is the database nameuseris required and is the database role/user namepasswordis required and is the database passwordsslis required and takes either 0 or 1 to disable or enable SSL
The ratelimits section controls enabling and configuring ratelimiting per IP.
"ratelimits": {
"enabled": 0,
"requests_threshold": 7,
"block_seconds": 300
}
enabledis required and takes either 0 or 1 to disable or enablerequests_thresholdis required and takes a positive integer for how many requests per second before the IP is blockedblock_secondsis required and takes a positive integer for how many seconds the IP is blocked after reaching therequests_threshold
The redis section defines the Redis connection used for sessions and
distributed ratelimiting.
"redis": {
"host": "localhost",
"port": 6379,
"password": "",
"db": 0,
"tls": 0
}
hostis required and is the Redis host nameportis required and is the Redis TCP portpasswordis optional and may be an empty string when auth is disableddbis required and is the Redis database number (0 or greater)tlsis required and takes either 0 or 1 to disable or enable TLS
The user_agent_blocks section controls enabling and configuring user agents that shouldn't be allowed to access the app.
"user_agent_blocks": {
"enabled": 0,
"user_agents": [
"facebookexternalhit",
"facebookscraper",
"amazonbot",
"Cortex-Xpanse"
]
}
enabledis required takes either 0 or 1 to disable or enableuser_agentsis required and takes an array of user agent strings to match for blocking access- if a user agent in the list is making the request, a 406 (unacceptable) is returned
- the user agent string is case insensitive and can be found anywhere in the user agent string making the request
- the array is required but may be empty
npm run development
npm run upgrade
npm run update_deps
npm run upgrade_database
# development - start in background (detached)
docker-compose --profile dev up -d --build
# development - restart to pick up code changes
docker-compose --profile dev restart
# development - view logs
docker-compose --profile dev logs -f
# production - connects to external postgresql via .hirgonrc
docker-compose --profile prod up -d
For production container orchestration (ECS/Fargate or similar):
- set
HIRGON_DB_*environment variables for remote PostgreSQL - set
HIRGON_REDIS_*environment variables for remote Redis - run migrations in deployment automation before rolling app tasks
- app service tasks never run database patches during container startup
- terminate HTTPS at the frontend load balancer/proxy
cat << EOF > /etc/systemd/system/hirgon.service
[Service]
RuntimeDirectory=hirgon
ExecStart=/path/to/npx pm2-runtime start ecosystem.config.js
WorkingDirectory=/home/hirgon/git/hirgon/
Restart=always
StandardError=syslog
SyslogIdentifier=hirgon
Type=simple
User=hirgon
Group=hirgon
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
systemctl enable hirgon.service
systemctl start hirgon.service
within the appropriate vhost
ProxyPreserveHost on
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
within the appropriate vhost
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
This repo has two github actions installed which help ensure quality of the project.
Both actions run on push and pull_request for the main branch.
The Test action runs two stages. Both stages must pass for the PR to be merged.
The lint stage verifies tidiness through eslint.
The test stage verifies the unit tests all pass.
The Docker Build Test action verifies the docker image and containers build, explicitly using the docker-compose files to ensure they work as expected.
The test verifies several things:
- the server full starts
- the
/loginroute returns without failure - users can be created
- authentication with those users is successful
- expected content is found on
/
The Docker Build Test action must pass for the PR to be merged.
hirgon is Copyright (c) 2025 Blaine Motsinger under the MIT license.
