Skip to content
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.github
.env*
**/target
docs
*.md
*.sqlite
11 changes: 11 additions & 0 deletions .env.dev.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Local settings for `make dev`: copy to .env.dev (gitignored) and adjust.
# `make dev` runs cargo on 127.0.0.1:8090; these override its defaults.

# Where the server stores its usage statistics.
OBN_DB=obn.sqlite

# Routes from the protocol submodule.
OBN_ROUTES_DIR=protocol/routes

# Log level (RUST_LOG syntax).
RUST_LOG=info,obn_server=debug
34 changes: 34 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OpenBikeNet server configuration. Copy to .env (`make setup` does this) and adjust.
# Every value is optional; the defaults below are used when a line is missing.
# After an update, `make setup` (also run by `make up` and `make update`) adds
# settings that are new here to the end of your .env and leaves the rest alone.

# --- Network -----------------------------------------------------------------

# Host interface and port for the WebSocket and the stats endpoint.
# 127.0.0.1 = this machine only. 0.0.0.0 = reachable from the network.
OBN_HTTP_BIND=127.0.0.1
OBN_HTTP_PORT=8090

# Behind a reverse proxy (Caddy, nginx, Traefik): take client IPs from
# X-Forwarded-For (1 or true). Set it to 1 behind the bundled Caddy or your own
# proxy, and only when the proxy is the only way in. 0 = off.
OBN_TRUST_PROXY=0

# Log level: error, warn, info, debug, trace (RUST_LOG syntax).
RUST_LOG=info

# --- HTTPS (bundled Caddy, optional) -----------------------------------------
# Not needed when your own reverse proxy terminates TLS (see the README).
# For a public server, point a DNS record at it, then enable Caddy:
#
# COMPOSE_PROFILES=tls
# OBN_DOMAIN=net.example.org
#
# Caddy obtains a Let's Encrypt certificate automatically (ports 80 and 443).
# Also set OBN_TRUST_PROXY=1 above.
#COMPOSE_PROFILES=tls
OBN_DOMAIN=

# --- Build -------------------------------------------------------------------
OBN_IMAGE_TAG=local
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [main]
pull_request:

# Read-only token: CI only checks out and tests, and pull requests from forks
# must not get write access.
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
server:
name: Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets -- -D warnings
- run: cargo test --workspace

docker:
name: Docker image
runs-on: ubuntu-latest
needs: [server]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- run: docker build -t obn-server:ci --build-arg OBN_BUILD_SHA=${{ github.sha }} .
- name: Smoke test
run: |
docker run -d --name obn -p 18080:8080 obn-server:ci
for i in $(seq 1 30); do
curl -fsS localhost:18080/healthz >/dev/null 2>&1 && break
if [ "$i" -eq 30 ]; then docker logs obn; echo "server did not become healthy"; exit 1; fi
sleep 1
done
test "$(curl -fsS localhost:18080/v0/stats)" = '{"apps":[]}'
docker stop obn
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target/
*.sqlite

# Local configuration
.env
.env.dev
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "protocol"]
path = protocol
url = https://github.com/OpenBikeNet/protocol
Loading
Loading