-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
git clone https://github.com/execut4ble/vilnius-hardcore.git
cd vilnius-hardcore
npm i- Create a
docker-compose.ymlfile (use the provided exampledocker-compose.yml.example) - Edit the file and specify database port, PostgreSQL credentials and database name.
- Run
npm run db:startto run the database Docker container (or use any other means to run the container, like through Portainer). - Create a
.envfile containing database credentials (use the provided.env.examplefile as an example) - Run
npm run db:migrateto build the database schema. Agree to execute all statements when asked.
Run npm run build
Run the app using pm2. Make sure to set the environment variables:
-
ORIGINset this to the domain root URL, for example https://hardcore.lt -
BODY_SIZE_LIMITsets the maximum allowed file upload size. -
ADDRESS_HEADERrequired 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 valueX-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).
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;
}
}
Visit the /crew route on the site to create an admin user