...

Text file src/go.formulabun.club/README.md

Documentation: go.formulabun.club

     1# go.formulabun.club
     2
     3[formulabun.club]() is an srb2kart server. It turned into a coding/histing project which includes go.formulabun.club.
     4
     5This [go.formulabun.club]() repository contains all the packages written for formulabun. From utility functions in [functional](https://godoc.formulabun.club/pkg/go.formulabun.club/functional/), to all [srb2kart](https://godoc.formulabun.club/pkg/go.formulabun.club/srb2kart/) related code and services like the [srb2kart socket to json translator](https://godoc.formulabun.club/pkg/go.formulabun.club/translator/).
     6
     7## Technologies used
     8
     9Everything is written in [Go](https://go.dev/), using the teachings form [gopl](http://www.gopl.io/). It is a simple language but draws a lot of power from that simplicity. [formulabun.club]() runs on a unix [VPS](https://en.wikipedia.org/wiki/Virtual_private_server) from [contabo](https://contabo.com/en/), a very good price/performance host. It runs [nginx](https://nginx.org/en/) with a certificate from [Let's Encrypt](https://letsencrypt.org/).
    10
    11The deployment on the VPS is done using [docker](https://www.docker.com/) and [docker compose](https://docs.docker.com/compose/). This allows for a [microsevice](https://microservices.io/) like deployment which keeps each service simple, going hand in hand with the simplicity of the Go language. In order to avoid writing the boilerplate HTTP server and client code, the API's are defined in [openapi](https://www.openapis.org/), from which the server and client code is generated using the Go [openapi generators](https://openapi-generator.tech/). A process that happens only a few times per service, due to their simplicity and small size. Both the docker compose files and the api specifications are written in [YAML](https://yaml.org/).
    12
    13## Running the services
    14
    15Take a zip from the releases, extract it, open the template.env file and follow the constructions. Use `docker compose` to manage the services.
    16
    17The `addons` service is meant to be used to link addons to the kart service. The repository of addons, from the `.env` file, are mapped to `/repo` and the kart server addons are mapped to `/addonsmain`. Link addons from the repo to the kart using `ls -s /repo/<addon> /addonsmain/<folder>/`. Use this service with `docker compose run`.
    18
    19## Setting up a development environment
    20
    21First of, **THIS IS NOT THE REPOSITORY TO DEVELOP IN.** This is only a collection of the packages, mostly serves the godoc site on [godoc.formulabun.club]() and contains build and release docker compose files. It is not really meant for development.
    22
    23Instead, clone the packages (the submodules in this repository) you want to work on in `GOPATH/go/src/go.formulabun.club/`. 
    24
    25If this is the only package you're working in you're already good to go. Pick an issue, make a branch and create a pull request when you're done.
    26
    27If you're working in multiple package at once, clone them all and use a [replace directive](https://go.dev/doc/modules/gomod-ref#replace) in the necessary `go.mod` files. These will generally take the form of `go.formulabun.club/<package> => ../<package>`.
    28
    29Because Go imports can't form cycles, you can complete the pull requests for each package in order. Do this without breaking other packages. Avoid writing breaking code or having to version a package. This may be a challenge but you should write code that's isn't prone to breaking changes anyway 😉. Think of the future and write wisely.
    30
    31### Running the development environment
    32
    33You can either always build and run services in docker or setup the environment yourself.
    34
    35##### Running in docker (WIP don't trust this)
    36
    37Update the context paths in the [docker-compose](https://github.com/formulabun/go.formulabun.club/blob/master/docker-compose.yml) file in this repository, then just `docker compose build` and `up` to build and run a service. 
    38
    39##### Setting up the environment
    40
    41This can be service dependent. See the docker and docker compose files as reference. Setting up your environment consists of 
    42
    43* exporting environment variables
    44* setting up static hostname redirects
    45* creating folders
    46
    47Each is OS dependent.
    48

View as plain text