oa

module
v0.0.0-...-0da7da6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2019 License: GPL-3.0

README

Olsztyńskie Autobusy

About

Olsztyńskie Autobusy combine harvesting vehicles data from systems of Olsztyn public transportation agency, serving current data for web app users and retaining that data.

Screenshot

It has modular microservice architecture divided into front/back-end. Main part of this infrastructure is the dataharvester service and a Postgres instance.

Build & Run

In order to start a dockerized instance locally, you need to obtain session cookie and build services from source. This walk-through assumes you have Go & Docker installed and configured.

Clone repository:

git clone git@github.com:amwolff/oa.git $GOPATH/src/github.com/amwolff/oa

Install dependencies:

curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
cd $GOPATH/src/github.com/amwolff/oa
dep ensure

Get session cookie:

  1. In browser navigate to sip.zdzit.olsztyn.eu;
  2. Open up inspector (Google Chrome: Control+Shift+I) > Application > Storage > Cookies;
  3. Copy value of ASP.NET_SessionId cookie.

Configure services:

In files

# $GOPATH/src/github.com/amwolff/oa/deploy/services/dataharvester/example_config.yml
Line 3: ClientCookie: <your-ClientCookie>
# $GOPATH/src/github.com/amwolff/oa/deploy/services/pinger/Dockerfile
Line 3: ENV CLIENT_COOKIE <your-ClientCookie>

substitue <your-ClientCookie> for copied value of your session cookie.

Build everything:

cd $GOPATH/src/github.com/amwolff/oa/deploy
./build_all.sh -d -v 63d0d1c

Start services:

docker network create backend
docker network create frontend
docker run -d --name oa_db --network backend --network-alias oa-postgres-ip-alias --rm amwolff/oa:oadb_63d0d1c
docker run -d --name oa_pinger --network backend --rm amwolff/oa:pinger_63d0d1c
docker run -d --name oa_dataharvester --network backend --rm amwolff/oa:dataharvester_63d0d1c
docker run -d --name oa_api --network backend -p 8080:80 --rm amwolff/oa:api_63d0d1c
docker network connect frontend oa_api
docker run -d --name oa_dirserver --network frontend -p 80:80 --rm amwolff/oa:dirserver_63d0d1c

The app should be now available at http://localhost.

Notes

Started instance is very similar to what I deployed in cloud for "production" use. Additionally, I've used docker-compose along with Docker in swarm mode (to encapsulate startup instructions) and traefik (for requests routing).

CI

Build Status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL