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

Dragonite Docs #206

Merged
merged 6 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
61 changes: 45 additions & 16 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,52 @@
version: '2'
version: "2"
services:
koji:
image: ghcr.io/turtiesocks/koji:main
container_name: koji
restart: unless-stopped
environment:
# Required
SCANNER_DB_URL: 'mysql://rdm_user:rdm_password@host:3306/rdm_database'
# CONTROLLER_DB_URL: 'mysql://rdm_user:rdm_password@host:3306/flygon_database'
KOJI_DB_URL: 'mysql://koji_user:[email protected]:3306/koji_database'
KOJI_SECRET: 'your_super_secret'
# Optional
#START_LAT: 0
#START_LON: 0
#NOMINATIM_URL: "https://nominatim.openstreetmap.org" # highly recommended using your own
#MAX_CONNECTIONS: 100
#LOG_LEVEL: info # error | warn | info | debug | trace
#mem_limit: 2048G
#mem_reservation: 256M
#cpus: 2
# To escape special characters you must surround the values with single quotes ('')
# Commented out variables are optional

# Your Golbat or RDM database
SCANNER_DB_URL: "mysql://rdm_user:rdm_password@host:3306/rdm_database"

# Your Dragonite (if using) or RDM database (if you're using a hybrid Golbat/RDM setup)
# CONTROLLER_DB_URL: 'mysql://dragonite_user:dragonite_password@host:3306/dragonite_database'

# Your Koji database
KOJI_DB_URL: "mysql://koji_user:[email protected]:3306/koji_database"

# Max Database connections
# MAX_CONNECTIONS: 100

# Your Koji API bearer token and client password
KOJI_SECRET: "your_super_secret"

# Start latitude on initial client load
# START_LAT: 0
# Start longitude on initial client load
# START_LON: 0
# Nominatim URl used for searching and importing geofences from OSM
# NOMINATIM_URL: 'https://nominatim.openstreetmap.org' # highly recommended using your own
# Logging level | error | warn | info | debug | trace
# LOG_LEVEL: info

# Memory limit for docker container
# mem_limit: 2048G
# Memory reservation for docker container
# mem_reservation: 256M
# CPU limit for docker container
# cpus: 2

ports:
- '8080:8080' # change left one for external port
- "8080:8080" # change left one for external port

networks:
default:
name: scanner

# If you want to use a non docker database enable following lines and
# change the Database URL to 'host.docker.internal'
#extra_hosts:
# - "host.docker.internal:host-gateway"
41 changes: 40 additions & 1 deletion docs/pages/client/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ A "project" in Kōji is how you create custom endpoints for distributing your ge
1. Once you've completed those steps, your geofences assigned to this project will now be accessible at `http://{your_koji_url}/api/v1/geofence/feature-collection/ReactMap`
1. Projects don't have to be striclty used with external integrations though. Kōji's client can also import geofences by project so it may be convenient to group them for this reason as well.

<Callout type="info" emoji="💡">
Please see [Integrations](/integrations) for assistance with a specific
project.
</Callout>

## Import existing Projects

1. After logging in, click the `Map` button on the landing page
Expand Down Expand Up @@ -95,4 +100,38 @@ A "project" in Kōji is how you create custom endpoints for distributing your ge
height={600}
/>

1. Repeat for however many projects/files you want to import! The import wizard can import from all sorts of differnet sources, including Nominatim and shape files.
1. Repeat for however many projects/files you want to import! The import wizard can import from all sorts of different sources, including Nominatim and shape files.

## Dragonite Quick Start

1. Complete the above steps to initialize Kōji
1. If you are starting from scratch and have no existing areas
1. Visit the Kōji Map
1. Create a fence
1. Name it and save to Kōji database
1. Visit the Kōji Map
1. Load your fence (if it isn't present)
1. Go to the Calculation tab
1. Select Bootstrap Mode
1. Strategy: Radius (for pokemon), S2 (for forts)
1. Save to Kōji Db: Enabled
1. Save to Scanner db: Enabled
1. Skip Rendering: Enabled
1. Click update
1. Once complete navigate to the Admin portal of Kōji
1. Click "Sync" on the geofence. This will create the Area in Dragonite if it doesn't exist.
1. Click "Sync" on the route. This will push the bootstrap route into Dragonite.
1. Then I add that new fence to my Dragonite project (and to my consumer (poracle/RM/golbat) project if I don't want to split it up).

**In dragonite admin:**

1. Edit the area and set the desired worked count

**Back in koji:**

1. Wait a few hours/a day for the bootstrap to update
1. Load the fence up into Kōji again, run pokemon route (again with save to koji and save to scanner dbs selected) - if I'm doing multiple, I load the fence names into a script (check docs) and call it via api.

**Back in dragonite admin:**

1. Go back into Dragonite Admin, update worker count to appropriate amount, enable quests and set quest hours
6 changes: 3 additions & 3 deletions docs/pages/client/notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ While Kōji does connect directly to your scanner's database, most scanners have
1. In the Admin Panel, navigate to the `projects` page.
1. Edit (or create) a scanner project
1. Set `scanner` to true
1. Add the `api_endpoint` value, a hint is provided for both RDM and Flygon scanner endpoints
1. Add the `api_key` value, a hint is provided for both RDM and Flygon scanner endpoints
1. Add the `api_endpoint` value, a hint is provided for both RDM and Dragonite scanner endpoints
1. Add the `api_key` value, a hint is provided for both RDM and Dragonite scanner endpoints

Now when you click the `Sync` button, either next to the respect project, geofence, or route, Kōji will automatically call this endpoint after saving the changes to the scanner database, making them immediately available to the scanner to use!

### Default Templates

Since most scanners have many other properties associated with their geofences and routes, Kōji provides a way to automatically add these properties to your geofences and routes when they are created.

- If using Flygon, in the Flygon Admin panel create a new `area` named `Default` and set any properties that you want, such as worker counts, to be added to all geofences and routes that are saved from Kōji.
- If using Dragonite, in the Dragonite Admin panel create a new `area` named `Default` and set any properties that you want, such as worker counts, to be added to all geofences and routes that are saved from Kōji.
- If using RDM, you will need to name the files a little differently. For each available instance mode, you will need to take note of its acronym, below is the code that Kōji uses for your reference:

| Mode | Acronym |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Welcome to Kōji!
## Supported Backends

- [Golbat](https://github.com/UnownHash/Golbat) (data)
- [Flygon](https://github.com/UnownHash/Flygon) (instances)
- [Dragonite](https://github.com/UnownHash/Dragonite-Public) (instances)
- [RDM](https://github.com/RealDeviceMap/RealDeviceMap) (data + instances)

## Supported Browsers
Expand Down
90 changes: 37 additions & 53 deletions docs/pages/integrations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { GitHubLogo } from '../components/GitHub'

# External Integrations

In Kōji's architecture, various external integrations primarily leverage HTTP `GET` requests for data retrieval. These integrations can be configured to fetch the latest updates either during the initialization phase of a process or based on a predefined schedule. Additionally, Kōji supports an event-driven approach where it can proactively trigger updates in external services. This mechanism enables synchronization with Kōji's latest state changes, enhancing the responsiveness and efficiency of the integrated systems.

## ReactMap

- Remove the need to have an `areas.json` file by loading your managed geofences straight from Kōji
Expand Down Expand Up @@ -44,6 +46,15 @@ import { GitHubLogo } from '../components/GitHub'
- `config.geofence.path`
- Example: `http://{koji_ip}/api/v1/geofence/poracle/{project_name}`

### Project setup

This is configured inside your Kōji `/admin/project` and will allow hot reloading of your areas within PoracleJS.

```yml
API Endpoint: http://{poraclejs_ip}:{port}/api/geofence/reload
API Key: X-Poracle-Secret:{config.server.apiSecret}
```

### Supported Features

- Polygons ✅
Expand Down Expand Up @@ -87,77 +98,50 @@ import { GitHubLogo } from '../components/GitHub'
- `koji.url`
- Example: `http://{koji_ip}`

### Supported Features

- Polygons ✅
- MultiPolygons ½ (Works, but is downconverted to a Polygon, may produce unexpected results)
- Auto quest, Pokemon, and fort route calculations, both in the admin panel and used server side

<GitHubLogo title="Dragonite" href="https://github.com/UnownHash/Dragonite-Public" />
### Project Setup

## Flygon
Use these values for your "scanner project" if Koji and Dragonite are on the **same** network.

- Syncs all geofences from Kōji to Flygon in the given project at startup
- You must set two config values to use Kōji with Flygon

1. First set your Kōji Bearer Token:

- `koji.bearer_token`
- Your Kōji Bearer token

1. Then set the Kōji url

- `koji.url`
- Example: `http://{koji_ip}`

1. Then set the Kōji project name that you want Flygon to use when calling the API

- `koji.project_name`
- Example: `project_name`

1. Lastly, since Flygon loads all of the areas at startup and overwrites them in the database at startup, there's a config option to enable or disable this behavior.

- `koji.load_at_startup`
- `true` or `false`
```yml
API endpoint: http://{drago_host_ip}:{drago_port}/reload
API key: Leave empty. Dragonite currently does not support authentication
```

### Supported Features

- Polygons ✅
- MultiPolygons ½ (Works, but is downconverted to a Polygon, may produce unexpected results)

<GitHubLogo title="Flygon" href="https://github.com/UnownHash/Flygon" />

## Flygon Admin

- Enable buttons in the dashboard panel to make calls to Kōji to calculate clustered and bootstrapped routes.
- You must set two config values to use Kōji with Flygon Admin
- MultiPolygons ½ (Works, but is down converted to a Polygon, may produce unexpected results)
- Auto quest, Pokemon, and fort route calculations, both in the admin panel and used server side

1. First set your Kōji Bearer Token:
<GitHubLogo
title="Dragonite"
href="https://github.com/UnownHash/Dragonite-Public"
/>

- `koji.bearer_token`
- Your Kōji Bearer token
## Dragonite Admin

1. Then set the Kōji api_endpoint
- Outbound requests from Dragonite Admin are proxied through Dragonite
- Inbound requests from Kōji can be received by Dragonite Admin to update routes and geofences

- `koji.api_endpoint`
- Example: `http://{koji_ip}`
### Project Setup

### Supported Features
Use these values for your "scanner project" if Koji and Dragonite are on **different** networks. This will proxy the request through Dragonite Admin to Dragonite utilizing the api_secret value.

- Bootstrap 70m Circles
- Bootstrap 9x9 S2 Cells
- Pokemon 70m clustered routes
- Quest 78m clustered routes
- Gym 9x9 clustered routes
```yml
API endpoint: http://{drago_admin_host_ip}:{drago_admin_port}/api/reload
API key: X-Dragonite-Admin-Secret:{your_api_secret_value}
```

<GitHubLogo
title="Flygon Admin"
href="https://github.com/UnownHash/Flygon-Admin"
title="Dragonite"
href="https://github.com/UnownHash/Dragonite-Public"
/>

## RealDeviceMap

- [PR 513](https://github.com/RealDeviceMap/RealDeviceMap/pull/513)
- RealDeviceMap (RDM) is marked as depreciated and support will be removed in the future.

* [PR 513](https://github.com/RealDeviceMap/RealDeviceMap/pull/513)

<GitHubLogo
title="RealDeviceMap"
Expand Down
16 changes: 9 additions & 7 deletions docs/pages/setup/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
koji:
image: ghcr.io/turtiesocks/koji:main
container_name: koji
command: 'koji'
restart: unless-stopped
environment:
# To escape special characters you must surround the values with single quotes ('')
Expand All @@ -23,8 +22,8 @@ services:
# Your Golbat or RDM database
SCANNER_DB_URL: 'mysql://rdm_user:rdm_password@host:3306/rdm_database'

# Your Flygon (if using) or RDM database (if you're using a hybrid Golbat/RDM setup)
# CONTROLLER_DB_URL: 'mysql://flygon_user:flygon_password@host:3306/flygon_database'
# Your Dragonite (if using) or RDM database (if you're using a hybrid Golbat/RDM setup)
# CONTROLLER_DB_URL: 'mysql://dragonite_user:dragonite_password@host:3306/dragonite_database'

# Your Koji database
KOJI_DB_URL: 'mysql://koji_user:[email protected]:3306/koji_database'
Expand Down Expand Up @@ -54,11 +53,14 @@ services:
ports:
- '8080:8080' # change left one for external port

networks:
default:
name: scanner

# Optional: Might be required if your database is also hosted in docker
# network_mode: "host"
# extra_hosts:
# - "host.docker.internal:host-gateway"
# If you want to use a non docker database enable following lines and
# change the Database URL to 'host.docker.internal'
#extra_hosts:
# - "host.docker.internal:host-gateway"
```

## Docker Setup
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/setup/standard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ import { Callout } from 'nextra-theme-docs'
# Your Golbat or RDM database
SCANNER_DB_URL='mysql://rdm_user:rdm_password@host:3306/rdm_database'

# Your Flygon (if using) or RDM database (if you're using a hybrid Golbat/RDM setup)
# CONTROLLER_DB_URL='mysql://flygon_user:flygon_password@host:3306/flygon_database'
# Your Dragonite (if using) or RDM database (if you're using a hybrid Golbat/RDM setup)
# CONTROLLER_DB_URL: 'mysql://dragonite_user:dragonite_password@host:3306/dragonite_database'

# Your Koji database
KOJI_DB_URL='mysql://koji_user:[email protected]:3306/koji_database'
Expand Down