Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sam/Deployment Fixes #29

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ yarn-error.log
# Editors:
.DS_Store
.idea/
.vscode/
.vscode/

# Logs:
logs/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary if the output goes to /var/log

10 changes: 10 additions & 0 deletions pm2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"apps": [
{
"name": "server",
"script": "lib/indexApi.js",
"error_file": "logs/server/error.log",
"out_file": "logs/server/out.log"
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server should have a real name, and the output should continue going to /var/log:

{
  "apps": [
    {
      "name": "logsServer",
      "script": "./lib/indexApi.js",
      "out_file": "/var/log/logsServer.log"
    }
  ]
}

Copy link
Contributor

@swansontec swansontec Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, on the production box it's /var/log/logsApi.log, but I think logsServer is a better name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should add this to the readme:

Manage server using pm2

First, install pm2 to run at startup:

yarn global add pm2
pm2 startup # Then do what it says

Next, tell pm2 how to run the server script:

# install:
pm2 start pm2.json
pm2 save

# check status:
pm2 monit
tail -f /var/log/logsServer.log

# manage:
pm2 restart logsServer
pm2 reload logsServer
pm2 stop logsServer