Skip to content

ifly7charlie/onglide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hosted?

If you'd like your competition hosted for you please let me know at melissa-hosting1 [at] onglide.com

Running (Docker)

This repo includes docker commands to launch everything required to run your own competition.

You should clone the repository, and then configure a file called .env to have at least NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN mapbox access token (https://account.mapbox.com/auth/signup/), the 'NEXT_PUBLIC_SITEURL' for the site and a database password (MYSQL_PASSWORD). Without this docker compose build will fail to build a valid website.

MYSQL_PASSWORD=<random string>
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=<access token>
NEXT_PUBLIC_SITEURL=<url less protocol, eg localhost:3000 or regionals.onglide.com>
SERVER_ADMIN=<your email address>

You can also use it to specify the soaring spot credentials, or you can pass then in through your service provider environment variables.

SOARINGSPOT_CLIENT_ID=
SOARINGSPOT_SECRET=

To enable SSL add ONGLIDE_SSL to the .env file

ONGLIDE_SSL=yes

Once you have configure the environment variables use docker compose to create all the 'services' required.

NOTE You need to re-run build if you change the environment variables as the are copied into the containers

> docker compose build
> docker compose up

This will launch the following:

* onglide-mysql (db)
* onglide-soaringspot (data synchronisation)
* onglide-ogn (ogn/flarm data feed handler and websocket provider)
* onglide-next (front end next.js)
* onglide-apache (web proxy to route things to the right place)

Your website will be available on port 80, and if it is actually reachable at that URL then an LetsEncrypt SSL certificate should be issued and it will also be available on port 443

You can also link to robocontrol (soaringspot only) to fetch the official flarm ids. The url is the host name you use to login to robocontrol plus /api/flarm

eg: https://dunstable.robocontrol.com/api/flarm

ROBOCONTROL_URL=https://dunstable.robocontrol.com/api/flarm

RST

scraping soaringspot (not recommended for hosting competitions but useful for testing)

Instead of configuring client keys configure SOARINGSPOT_URL= to point ot the en_gb root of the competition URL on soaringspot, eg https://www.soaringspot.com/en_gb/my-comp-name-2022/

Then use

> docker compose -f docker-compose-ssscrape.yml build
> docker compose -f docker-compose-ssscrape.yml up

Installing manually (non-docker)

It isn't difficult to deploy and run this on your own server. However if you would prefer a hosted version please email your soaring spot keys to [email protected] and I can set it up for you.

Requirements

Steps

  • create a database and a user with the following rights
    > grant insert,update,delete,execute,select on dsample19.\* to reactuser@'xx.xx.xx.xx' identified by 'some-good-password';
  • load the database sql & stored procedures
    > source conf/sql/onglide_schema.sql;
    > source conf/sql/sp_nextjs.sql
  • install yarn packages
    > yarn install
  • install pm2 (optional)
    > yarn global add pm2
  • run the onglide installation script, this will require a mapbox API key, and the database to be loaded
    > yarn setup
  • build protobuf and backend
    > yarn build
  • configure your webserver (there is a sample file but you'll want certificates etc)

  • build the application using yarn

    > yarn next build

Running (pm2) - if you can use docker use docker ;)

> pm2 start ecosystem.config.js
> pm2 start all
  • start webserver

You can use this to see logs

> pm2 log
> pm2 log ogn

See status

> pm2 status

Or to monitor processes

> pm2 monit

pm2 will automatically restart the processes if they fail

Running (yarn)

  • start the OGN processor (bin/ogn.ts) this will fetch data into the database and send on websocket
    > yarn ogn
  • start the soaringspot processor
    > yarn soaringspot
    or
    > yarn ssscrape
    or
    > yarn sgp
  • start the application
    > yarn next start
  • start webserver

RST tracking

Instead of using SoaringSpot as the backend it's possible to use RST Online as well.

  • run the normal installation program
  • select RST for scoring system (see steps above) and then ensure the URL provided takes you to the page on RST that lists the competition. Default is "Övriga tävlingar" but it should also work with the HDI Safe Skies pages as well by changing the URL
  • ensure that the contest name matches the prefix of the name, text after the name is assumed to be the contest class

eg: "DM Herrljunga 2021 18-Meter" select "DM Herrljunga 2021" as the contest name, 18-Meter will become the contest class

  • run

Troubleshooting

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published