commit
9f2539af86
3 changed files with 16 additions and 8 deletions
|
|
@ -19,12 +19,19 @@ server folder in the Ghost Writer git repository.
|
||||||
(Ex: `sudo ln -s ~/Ghost-Writer-Online/server /server`)
|
(Ex: `sudo ln -s ~/Ghost-Writer-Online/server /server`)
|
||||||
7. Create a symlink named `ghost-writer.service` in `/etc/systemd/system`
|
7. 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
|
pointing to the service file in the `server` folder of the Ghost Writer Online
|
||||||
repository. (Ex: `sudo ln -s /etc/systemd/system/ghost-writer.service /server/ghost-writer.service`)
|
repository. (Ex: `sudo ln -s /server/ghost-writer.service /etc/systemd/system/ghost-writer.service`)
|
||||||
8. Start the websocket server with `sudo systemctl start ghost-writer`.
|
8. Run `whereis node` and copy the absolute file path of the output
|
||||||
9. Make sure the server is started by running `systemctl status ghost-writer`
|
9. 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
|
||||||
|
10. Reload the systemd daemon with `sudo systemd daemon-reload` to make the
|
||||||
|
changes to the service file take effect.
|
||||||
|
11. Start the websocket server with `sudo systemctl start ghost-writer`
|
||||||
|
12. Make sure the server is started by running `systemctl status ghost-writer`
|
||||||
|
|
||||||
* To restart the server, run `sudo systemctl restart ghost-writer`.
|
* To start the server, run `sudo sustemctl start ghost-writer`
|
||||||
* To stop the server, run `sudo systemctl stop 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`
|
* To access the server logs, run `sudo journalctl -u ghost-writer`
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
|
|
||||||
// Ensure game exists
|
// Ensure game exists
|
||||||
if (!games[data.game_code]) {
|
if (!games[data.game_code]) {
|
||||||
log.debug(`Can't delete game that doesn't exist: ${data.game_code}`);
|
log.debug(`Can't find game with code: ${data.game_code}`);
|
||||||
socket.emit(`GameDeleted`, {
|
socket.emit(`GameDeleted`, {
|
||||||
status: 404,
|
status: 404,
|
||||||
message: `Game with code ${data.game_code} could not be found`,
|
message: `Game with code ${data.game_code} could not be found`,
|
||||||
|
|
@ -21,7 +21,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
let player = game.players.find(x => x.isHost);
|
let player = game.players.find(x => x.isHost);
|
||||||
|
|
||||||
if (player != null && player.socket !== socket) {
|
if (player != null && player.socket !== socket) {
|
||||||
game.log.warn(`${player.name} attempted to delete game.`);
|
game.log.warn(`${player.name} attempted to delete game`);
|
||||||
socket.emit(`GameDeleted`, {
|
socket.emit(`GameDeleted`, {
|
||||||
status: 403,
|
status: 403,
|
||||||
message: `Not allowed to delete a game that you are not the host of.`,
|
message: `Not allowed to delete a game that you are not the host of.`,
|
||||||
|
|
@ -31,7 +31,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Delete game
|
// Delete game
|
||||||
game.log.debug(`Game deleted.`)
|
game.log.info(`Game deleted`)
|
||||||
delete games[data.game_code];
|
delete games[data.game_code];
|
||||||
io.to(game.id).emit(`GameDeleted`, {
|
io.to(game.id).emit(`GameDeleted`, {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ if (Validate.config(conf)) {
|
||||||
log.info(`Found ${hibernatedGames.length} hibernated games`);
|
log.info(`Found ${hibernatedGames.length} hibernated games`);
|
||||||
process.on(`uncaughtException`, processExit);
|
process.on(`uncaughtException`, processExit);
|
||||||
process.on(`SIGINT`, processExit);
|
process.on(`SIGINT`, processExit);
|
||||||
|
process.on(`SIGTERM`, processExit);
|
||||||
};
|
};
|
||||||
|
|
||||||
startWebsocket(conf);
|
startWebsocket(conf);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue