stated_backend
v1.0.0
Published
```sh docker-compose -f database/docker-compose.yml up # to reapply init.sql: docker-compose -f database/docker-compose.yml up --build API_KEY=XXX DOMAIN=localhost nodemon server.js ``` ## production
Downloads
2
Readme
dev
docker-compose -f database/docker-compose.yml up
# to reapply init.sql: docker-compose -f database/docker-compose.yml up --build
API_KEY=XXX DOMAIN=localhost nodemon server.js
production
- Update the domain name in ../src/api.js and build the front end files according to ../README.md.
- Update the SSL cert paths in backend/server.js according to your domain name.
- Modify backend/deploy.sh script with your server's IP/ domain name and run it to copy source files into the server.
- Install dependencies and initialize database on the server (Ubuntu):
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt-get update
sudo apt-get install postgresql
sudo su - postgres
psql
CREATE USER sdf WITH SUPERUSER PASSWORD 'sdf';
--run commands from init.sql
--CREATE DATABASE dev
--\c dev
\dt
\q
exit
sudo apt-get install -y nodejs qpdf
npm install
sudo npm install -g nodemon
Copy files using the script in scp.sh with your server details. Use tmux (or something similar) for runinng to the node server
sudo NODE_ENV=production DOMAIN=rixdata.net API_KEY=XXX nodemon --ignore 'log/*' server.js
# sudo NODE_ENV=production DOMAIN=gritapp.info nodemon --ignore 'log/*' server.js
Create lets encrypt SSL certificate
sudo apt install certbot
sudo certbot certonly --standalone
Renew lets encrypt certificate
quit node server sudo certbot renew --standalone Stop NginX or Apache if they were used for the cert renewal sudo nginx stop sudo nginx -s quit or sudo service apache2 stop sudo lsof -i :443 sudo kill -9 restart node server