#!/sbin/openrc-run

name="AbelBirdnest Stock"
description="AbelBirdnest Stock Next.js standalone server"

directory="/var/www/abelbirdnest-web/AbelBirdNest-Stock/current"
env_file="/var/www/abelbirdnest-web/AbelBirdNest-Stock/.env.production"
command="/bin/sh"
command_args="-lc 'set -a; . \"${env_file}\"; set +a; exec /usr/bin/node server.js'"
command_user="abelbirdnest:abelbirdnest"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"

output_log="/var/log/abelbirdnest-web.log"
error_log="/var/log/abelbirdnest-web.err"

export NODE_ENV="production"
export PORT="3007"
export NODE_OPTIONS="--max-old-space-size=512"

depend() {
  need net
  after postgresql
}
