Skip to content

Installation

Jokūbas Banaitis edited this page Oct 19, 2025 · 10 revisions

Prerequisites

Installation steps

Initialize Node dependencies

git clone https://github.com/execut4ble/vilnius-hardcore.git
cd vilnius-hardcore
npm i

Set up the database

  1. Create a docker-compose.yml file (use the provided example docker-compose.yml.example)
  2. Edit the file and specify database port, PostgreSQL credentials and database name.
  3. Run npm run db:start to run the database Docker container (or use any other means to run the container, like through Portainer).
  4. Create a .env file containing database credentials (use the provided .env.example file as an example)
  5. Run npm run db:migrate to build the database schema. Agree to execute all statements when asked.

Create a production build

Run npm run build

Start the application

Run the app using pm2. Make sure to set the environment variables:

  • ORIGIN set this to the domain root URL, for example https://hardcore.lt
  • BODY_SIZE_LIMIT sets the maximum allowed file upload size.
  • ADDRESS_HEADER required if Nginx proxy is being used. This will forward client addresses when a comment is posted. If you're using the config below (see Nginx configuration), use the value X-Real-IP.
ADDRESS_HEADER=X-Real-IP BODY_SIZE_LIMIT=5M ORIGIN=mydomain PORT=1337 pm2 start 'node -r dotenv/config build' --name vilnius-hardcore --time

pm2 runs the app in the background and provides some management tools:

# Show running apps
pm2 status

# If you want to see the logs
pm2 logs

# If you want to add it to startup
pm2 save && pm2 startup

At this point the application should be accessible on mydomain:1337 (or similar).

Nginx configuration

vilnius-hardcore comes with a simple Node image server for serving user uploaded pictures, however it is sometimes unstable and may crash, so I recommend using Nginx for serving static image files. If you have an nginx server, you can add the following site configuration.

Note

The client_max_body_size setting should be higher than or equal to the BODY_SIZE_LIMIT environment variable.

Additionally, make sure the application port in proxy_pass matches the .env file

server {
  server_name mydomain.com;

  location / {
                proxy_pass http://127.0.0.1:1337/;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_read_timeout 90;
                client_max_body_size 5M;
        }

 # Serve images from /static/public/uploads
   location /images/ {
     alias /path/to/vilnius-hardcore/static/public/uploads/;
     autoindex off;
     access_log off;
   }
}

Post-install steps

Visit the /crew route on the site to create an admin user