0
0
Fork 0
Phantom-Ink-Online/server
2021-01-12 14:46:05 -07:00
..
docs Update doc for SendCard 2020-12-27 15:12:05 -07:00
src Update log messages 2021-01-12 14:46:05 -07:00
ghost-writer.service Create service file. 2021-01-09 14:35:36 -07:00
package.json Add Axios as a dependency 2021-01-11 16:35:23 -07:00
pnpm-lock.yaml Add Axios as a dependency 2021-01-11 16:35:23 -07:00
README.md Update clarity of the server README 2021-01-11 17:17:40 -07:00
template.toml Clarity: Add better description 2021-01-11 17:16:13 -07:00
tsconfig.json Change tsc build file 2020-12-24 21:47:17 -07:00

Setup:

  1. cd into this server directory.
  2. Run pnpm install to install all of the required dependencies.
  3. Create a copy of the template.toml file, and name it server.toml.
  4. Edit the server.toml file to adjust the server and game settings.
  5. Run tsc to compile the TypeScript into Javascript. This should create a dist directory.

Using systemd to manage the server:

This app comes with a ghost-writer.service file which is already set up to manage the server, it just requires a little bit of additional setup. If you change any of the symlinking in the steps below, it is your responsibility to figure it out, I will not guarantee support for people who attempt to modify the service file beyond the steps below.

  1. Create a symlink named server in the server root (/) pointing to the server folder in the Ghost Writer git repository. (Ex: sudo ln -s ~/Ghost-Writer-Online/server /server)
  2. Create a symlink named ghost-writer.service in /etc/systemd/system pointing to the service file in the server folder of the Ghost Writer Online repository. (Ex: sudo ln -s /server/ghost-writer.service /etc/systemd/system/ghost-writer.service)
  3. Run whereis node and copy the absolute file path of the output
  4. Edit the ghost-writer.service file to replace change the ExecStart=node dist/main.js to replace node with the file path you copied from the previous step
  5. Reload the systemd daemon with sudo systemd daemon-reload to make the changes to the service file take effect.
  6. Start the websocket server with sudo systemctl start ghost-writer
  7. Make sure the server is started by running systemctl status ghost-writer
  • To start the server, run sudo sustemctl start ghost-writer
  • To restart the server, run sudo systemctl restart ghost-writer
  • To stop the server, run sudo systemctl stop ghost-writer
  • To access the server logs, run sudo journalctl -u ghost-writer

Using a detached terminal:

If you would prefer that the server does not automatically restart and you can more easily output log output to a file, you can run the server by following the below steps:

  1. Make sure you know how to invoke a single command with your preferred method of detaching terminals.
  2. Have the detached terminal's working directory be in the server folder of this repository.
  3. Run node dist/main.js for logging directly to the CLI, or node dist/main.js > output.log for logging to a file named output.log.
  4. Detach your terminal.

Configuration:

All of the configuration for the server is done in the server.toml with explanations in the file. When a value is changed in the config, you will need to restart the server. This is either through systemd (sudo systemctl restart ghost-writer) or through your preferred terminal detacher, by stopping then re-starting the process.