Add ops/README.md

This commit is contained in:
William Mantly 2024-01-08 22:21:40 +00:00
parent 66ccf666b0
commit 3442d09f0b

70
ops/README.md Normal file
View File

@ -0,0 +1,70 @@
## Useage
To get started, clone this repo move to the `nodejs` folder and run `npm install`
`npm install` will install the reuired packaged need to use this codebase.
Once you have the needed packages, you need to set up a local(setrets.js) conf file. For reference,
a sample one can be found at `./ops/conf.js` Use this to file as a templet and place one with your
configuration in `./nodejs/conf/secrets.js`
To execute the app, move to the `./nodejs` directory and run `node index.js`
## Service
A sample systemD service file can be found at `./ops/mc-bot.service`
To use this file, copy it to `/etc/systemd/system`, change `/opt/theta42/mc-cj-bot/index.js`
one the line `ExecStart=/usr/bin/env node /opt/theta42/mc-cj-bot/index.js` file to match where
you have cloned the project.
Once you have the service file in place, run
```bash
systemctl start mc-bot.service
```
Make sure this starts with out errors. Check the status of the service with:
```bash
systemctl status mc-bot.service
```
Once you have a running service, run this command to activate it to start on boot
```bash
systemctl enable mc-bot.service
```
## File structure
```bash
.
├── nodejs // Where the code for the project lives
│   ├── index.js // Entry point for the project
│   ├── package.json // Holds information about the project and what packages are required
│   ├── package-lock.json // Hold what auto install packages(at version) are currently installed
│   ├── conf // Configuration for the project
│   │   ├── base.js // conf file to always be applied
│   │   ├── index.js // code to build and return the conf object
│   │   └── secrets.js // local settings file. This override all other conf files
│   ├── controller // Logic to tie functionality together
│   │   ├── mc-bot.js // Executes and manages the bot(s)
│   │   └── player_list.js // Builds file for daily player list
│   │   ├── commands // Commands players can run on the bot
│   │   │   ├── default.js
│   │   │   ├── fun.js
│   │   │   ├── index.js
│   │   │   ├── invite.js
│   │   │   └── trade.js
│   ├── model // Data interaction classed
│   │   ├── minecraft.js // Abstraction of the Mineflayer class.
│   │   ├── mcaction.js // Class to abstract bot actions and movement, currently unused left for reference
│   │   ├── matrix_quotes.js // Holds list of quotes
│   │   └── pink_quotes.js
│   └── utils // Holds common JS helper functions used in the project
│   └── index.js
└── ops // Operational concerns, like deploy scripts and services
├── conf.js // Sample secret.js file
└── mc-bot.service
```