mirror of
https://github.com/Cernobor/oko-server.git
synced 2025-02-24 08:27:17 +00:00
Readme, removed APK option.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* Added README. (Fix #5) * Removed -apk option.
This commit is contained in:
parent
d25e58905f
commit
f168a5966b
108
README.md
Normal file
108
README.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="" rel="noopener">
|
||||||
|
<img src="https://raw.githubusercontent.com/Cernobor/oko-app/master/assets/splash.png" alt="Project logo" style="background: #153d24;"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3 align="center">Organizátorské Kartografické OKO - server</h3>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
[]()
|
||||||
|
[](https://github.com/Cernobor/oko-server/issues)
|
||||||
|
[](https://github.com/Cernobor/oko-server/pulls)
|
||||||
|
<!-- [](/LICENSE) -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Table of Contents
|
||||||
|
|
||||||
|
- [About](#about)
|
||||||
|
- [Building](#building)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Built Using](#built_using)
|
||||||
|
- [Authors](#authors)
|
||||||
|
- [Acknowledgments](#acknowledgement)
|
||||||
|
|
||||||
|
## 🧐 About <a name = "about"></a>
|
||||||
|
|
||||||
|
Central server for the [OKO](https://github.com/Cernobor/oko-app) app.
|
||||||
|
Manges users, provides map tiles and the whole map tile pack, receives geo features submitted by users and serves them back.
|
||||||
|
|
||||||
|
## 🏗 Building <a name = "building"></a>
|
||||||
|
|
||||||
|
The only requirement to build the server is [go](https://go.dev).
|
||||||
|
|
||||||
|
In the root of the project, run
|
||||||
|
|
||||||
|
```
|
||||||
|
go build
|
||||||
|
```
|
||||||
|
|
||||||
|
which will produce the executable ``oko-server`` which you can just run (see [Usage](#usage)).
|
||||||
|
|
||||||
|
## 🎈 Usage <a name="usage"></a>
|
||||||
|
|
||||||
|
### Using docker
|
||||||
|
|
||||||
|
Dockerfile is included, therefore to build the docker image, all that is needed to do is to run
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t name:tag /path/to/the/root/of/the/repository
|
||||||
|
```
|
||||||
|
or, if you have no local changes, you can build the image even without cloning the repository at all
|
||||||
|
```
|
||||||
|
docker build -t name:tag https://github.com/Cernobor/oko-server.git
|
||||||
|
```
|
||||||
|
|
||||||
|
The image can then be run using the ``name:tag`` that you have given in the previous step.
|
||||||
|
Volume ``/data`` is available to share data between the host and the container.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v /path/to/data:/data name:tag [options...]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Without docker
|
||||||
|
|
||||||
|
Just run the previously built (see [Building](#building)) executable
|
||||||
|
```
|
||||||
|
/path/to/oko-server [options...]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
The server is configurable via a set of options, some of which are required.
|
||||||
|
The table of options follows:
|
||||||
|
|
||||||
|
| option | description |
|
||||||
|
| ------ | ----------- |
|
||||||
|
| ``-tilepack <path>`` | **Required.** File that will be sent to clients when they request a tile pack, also used to serve tiles in online mode. |
|
||||||
|
| ``-port <port>`` | Port where the server will listen. Default is ``8080``. |
|
||||||
|
| ``-dbfile <path>`` | Path to the sqlite3 database file used for data storage. Will be created, if it does not exist upons startup. Default is ``./data.sqlite3``. |
|
||||||
|
| ``-reinit-db`` | If specified, the DB will be reinitialized, i.e. the DB schema will be recreated, deleting all data. |
|
||||||
|
| ``-min-zoom <int>`` | Minimum supported zoom. Clients will receive this value during handshake. Default is ``1``. |
|
||||||
|
| ``-default-center-lat <float>`` | Latitude of the default map center, formatted as a floating point number of degrees. Clients will receive this value during handhake. Default is ``0``. |
|
||||||
|
| ``-default-center-lng <float>`` | Longitude of the default map center, formatted as a floating point number of degrees. Clients will receive this value during handhake. Default is ``0``. |
|
||||||
|
| ``-max-photo-width <int>`` | Maximum width of stored pohotos. Uploaded photos exceeding this width will be rescaled to fit (keeping aspect ratio). If ``0``, no scaling will be done. Default is ``0``. |
|
||||||
|
| ``-max-photo-height <int>`` | Maximum height of stored pohotos. Uploaded photos exceeding this height will be rescaled to fit (keeping aspect ratio). If ``0``, no scaling will be done. Default is ``0``. |
|
||||||
|
| ``-photo-quality <int>`` | JPEG photo quality. Photos are reencoded to JPEG with this quality setting when uploaded. Default is ``90``. |
|
||||||
|
| ``-debug`` | If specified, logging level will be set do debug instead of info. w
|
||||||
|
|
||||||
|
## ⛏️ Built Using <a name = "built_using"></a>
|
||||||
|
|
||||||
|
- [Go](https://go.dev/) - Programming language
|
||||||
|
- [Gin](https://gin-gonic.com/) - HTTP handler
|
||||||
|
- [SQLite](https://www.sqlite.org/) - Database
|
||||||
|
- [mbtileserver](https://github.com/consbio/mbtileserver) - MBTiles tile server
|
||||||
|
|
||||||
|
## ✍️ Authors <a name = "authors"></a>
|
||||||
|
|
||||||
|
- [@zegkljan](https://github.com/zegkljan) - Idea & Initial work
|
||||||
|
- [@0x416E64](https://github.com/0x416E64) - Docker and deployment tweaks
|
||||||
|
|
||||||
|
See also the list of [contributors](https://github.com/Cernobor/oko-server/contributors) who participated in this project.
|
||||||
|
|
||||||
|
## 🎉 Acknowledgements <a name = "acknowledgement"></a>
|
||||||
|
|
||||||
|
- Hat tip to anyone whose code was used
|
2
main.go
2
main.go
@ -23,7 +23,6 @@ func main() {
|
|||||||
tilepackFileArg := flag.String("tilepack", "", "File that will be sent to clients when they request a tile pack, also used to serve tiles in online mode. Required.")
|
tilepackFileArg := flag.String("tilepack", "", "File that will be sent to clients when they request a tile pack, also used to serve tiles in online mode. Required.")
|
||||||
portArg := flag.Int("port", 8080, "Port where the server will listen to. Default is 8080.")
|
portArg := flag.Int("port", 8080, "Port where the server will listen to. Default is 8080.")
|
||||||
dbFileArg := flag.String("dbfile", "./data.sqlite3", "File that holds the server's sqlite3 database. Will be created if it does not exist. Default is \"./data.sqlite3\".")
|
dbFileArg := flag.String("dbfile", "./data.sqlite3", "File that holds the server's sqlite3 database. Will be created if it does not exist. Default is \"./data.sqlite3\".")
|
||||||
apkFileArg := flag.String("apk", "", "APK file with the client app. If not specified, no APK will be available (404).")
|
|
||||||
reinitDBArg := flag.Bool("reinit-db", false, "Reinitializes the DB, which means all the tables will be recreated, deleting all data.")
|
reinitDBArg := flag.Bool("reinit-db", false, "Reinitializes the DB, which means all the tables will be recreated, deleting all data.")
|
||||||
minZoomArg := flag.Int("min-zoom", 1, "Minimum zoom that will be sent to clients.")
|
minZoomArg := flag.Int("min-zoom", 1, "Minimum zoom that will be sent to clients.")
|
||||||
defaultCenterLatArg := flag.Float64("default-center-lat", 0, "Latitude of the default map center.")
|
defaultCenterLatArg := flag.Float64("default-center-lat", 0, "Latitude of the default map center.")
|
||||||
@ -57,7 +56,6 @@ func main() {
|
|||||||
Port: *portArg,
|
Port: *portArg,
|
||||||
DbPath: *dbFileArg,
|
DbPath: *dbFileArg,
|
||||||
TilepackPath: *tilepackFileArg,
|
TilepackPath: *tilepackFileArg,
|
||||||
ApkPath: *apkFileArg,
|
|
||||||
ReinitDB: *reinitDBArg,
|
ReinitDB: *reinitDBArg,
|
||||||
MinZoom: *minZoomArg,
|
MinZoom: *minZoomArg,
|
||||||
DefaultCenter: models.Coords{
|
DefaultCenter: models.Coords{
|
||||||
|
@ -46,7 +46,6 @@ type ServerConfig struct {
|
|||||||
Port int
|
Port int
|
||||||
DbPath string
|
DbPath string
|
||||||
TilepackPath string
|
TilepackPath string
|
||||||
ApkPath string
|
|
||||||
ReinitDB bool
|
ReinitDB bool
|
||||||
MinZoom int
|
MinZoom int
|
||||||
DefaultCenter models.Coords
|
DefaultCenter models.Coords
|
||||||
|
Loading…
Reference in New Issue
Block a user