Standard
Install Prerequisites
- Install NodeJS (opens in a new tab)
- Install Rust (opens in a new tab)
- Install
curl
for your system if it's not already present
Install
-
Clone this repo:
git clone https://github.com/TurtIeSocks/Koji.git
-
Install OR-Tools:
⚠️Check the OR-Tools Prerequisites (opens in a new tab)
For example, on Ubuntu 20.04:
sudo apt update sudo apt install -y build-essential cmake lsb-release
sudo chmod +x or-tools/install.sh && ./or-tools/install.sh
-
Create a new schema in your database for Kōji
-
Copy the env file:
cd server && cp .env.example .env
-
Edit the env file:
nano .env
:# Required # Your Golbat or RDM database SCANNER_DB_URL="mysql://rdm_user:rdm_password@127.0.0.1:3306/rdm_database" # Your Flygon database - leave commented out for RDM # UNOWN_DB_URL="mysql://unown_user:unown_password@127.0.0.1:3306/flygon_database" # Your Koji database KOJI_DB_URL="mysql://koji_user:koji_password@127.0.0.1:3306/koji_database" # Your Koji API bearer token and client password KOJI_SECRET="your_super_secret_password" # Optional # Host machine HOST="0.0.0.0" # Host port PORT="8080" # Start latitude on initial load START_LAT="0" # Start longitude on initial load START_LON="0" # Max database connections MAX_CONNECTIONS=100 # Nominatim URl used for searching and importing geofences from OSM # highly recommended using your own NOMINATIM_URL="https://nominatim.openstreetmap.org" # Logging level LOG_LEVEL="info" # error | warn | info | debug | trace
-
Compile the client:
cd ../client && yarn install && yarn build
-
Compile the server:
cd ../server && cargo run -r # you might have to also install pkg-config (`apt install pkg-config`)
-
Optionally install PM2 (opens in a new tab) to run the server in the background:
npm install pm2 -g pm2 start "cargo run -r" --name koji # from the /server folder
Updating
-
Pull update
git pull
-
Recompile OR-Tools
./or-tools/install.sh
-
Recompile Client
cd client && yarn install && yarn build
-
Recompile Server
cd ../server && cargo run -r
-
If using pm2
pm2 restart koji