Skip to content

Commit

Permalink
Merge pull request #359 from green-ecolution/release/v1.1.0
Browse files Browse the repository at this point in the history
Release v1.1.0
  • Loading branch information
choffmann authored Jan 13, 2025
2 parents b6157be + ef525f9 commit c89cbe4
Show file tree
Hide file tree
Showing 411 changed files with 65,382 additions and 5,539 deletions.
3 changes: 2 additions & 1 deletion .docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ FROM alpine:3.20 AS runner

ENV DEVELOPMENT=true
ENV PORT=3000
ENV ENV=dev
EXPOSE 3000

RUN adduser -D gorunner
Expand All @@ -47,7 +48,7 @@ RUN apk add --no-cache geos proj
USER gorunner
WORKDIR /app

COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config/config.dev.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/bin/green-ecolution-backend /app/backend

ENTRYPOINT [ "/app/backend" ]
3 changes: 2 additions & 1 deletion .docker/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RUN make build \
FROM alpine:3.20 AS runner

ENV PORT=3000
ENV ENV=prod
EXPOSE 3000

RUN adduser -D gorunner
Expand All @@ -47,7 +48,7 @@ RUN apk add --no-cache geos proj
USER gorunner
WORKDIR /app

COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config/config.prod.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/bin/green-ecolution-backend /app/backend

ENTRYPOINT [ "/app/backend" ]
3 changes: 2 additions & 1 deletion .docker/Dockerfile.stage
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN make build \
FROM alpine:3.20 AS runner

ENV PORT=3000
ENV ENV=stage
EXPOSE 3000

RUN adduser -D gorunner
Expand All @@ -46,7 +47,7 @@ RUN apk add --no-cache geos proj
USER gorunner
WORKDIR /app

COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/.docker/config.default.yaml /app/config/config.stage.yaml
COPY --chown=gorunner:gorunner --from=builder /app/build/bin/green-ecolution-backend /app/backend

ENTRYPOINT [ "/app/backend" ]
41 changes: 32 additions & 9 deletions .docker/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,41 @@ server:
name: green_ecolution_db

auth:
keycloak:
baseurl: https://auth.green-ecolution.de
realm: green-ecolution-dev
client_id: green-ecolution-backend
client_secret: secret_secret_secret
realm_public_key: secret_secret_secret
oidc_provider:
base_url: https://auth.green-ecolution.de
domain_name: green-ecolution-dev
auth_url: https://auth.green-ecolution.de/realms/green-ecolution-dev/protocol/openid-connect/auth
token_url: https://auth.green-ecolution.de/realms/green-ecolution-dev/protocol/openid-connect/token
public_key:
static: secret_secret_secret
frontend:
auth_url: https://auth.green-ecolution.de/realms/green-ecolution-dev/protocol/openid-connect/auth
token_url: https://auth.green-ecolution.de/realms/green-ecolution-dev/protocol/openid-connect/token
client_id: green-ecolution-frontend
client_secret: secret_secret_secret

backend:
client_id: green-ecolution-backend
client_secret: secret_secret_secret
routing:
start_point: [9.434764259345679, 54.768731253913806]
end_point: [9.434764259345679, 54.768731253913806]
watering_point: [9.434764259345679, 54.768731253913806]
valhalla:
host: http://localhost:8002
optimization:
vroom:
host: http://localhost:2525
ors:
host: http://localhost:8080/ors
optimization:
vroom:
host: http://localhost:2525
s3:
endpoint: s3.green-ecolution.de
region: us-east-1
use_ssl: true
route-gpx:
bucket: routes-gpx
accessKey: routes-gpx
secretAccessKey: secret_secret_secret
mqtt:
broker: eu1.cloud.thethings.industries:1883
client_id: tree-sensor
Expand Down
86 changes: 86 additions & 0 deletions .docker/docker-compose.infra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
services:
db:
image: postgis/postgis
restart: always
# set shared memory limit when using docker-compose
shm_size: 128mb
environment:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
networks:
- app-network
pgadmin:
image: dpage/pgadmin4
restart: always
ports:
- 5050:80
volumes:
- "./infra/pgadmin/servers.json:/pgadmin4/servers.json"
environment:
PGADMIN_DEFAULT_EMAIL: a@a.com
PGADMIN_DEFAULT_PASSWORD: geheim
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
networks:
- app-network
ors-app:
image: openrouteservice/openrouteservice:v9.0.0
ports:
- "8080:8082"
- "9001:9001"
user: "1000:1000" # Default is 1000:1000. make infra/up will override this to the actual user values
volumes:
- ./infra/ors:/home/ors
environment:
ors.engine.profile_default.build.source_file: /home/ors/files/sh.osm.pbf
REBUILD_GRAPHS: false
CONTAINER_LOG_LAVEL: INFO
XMS: 256m
XMX: 512m
ADDITIONAL_JAVA_OPTS: ""
deploy:
resources:
reservations:
cpus: "1"
memory: 256m
limits:
cpus: "1"
memory: 512m
networks:
- app-network
vroom:
image: ghcr.io/vroom-project/vroom-docker:v1.14.0
ports:
- 2525:3000
volumes:
- ./infra/vroom:/conf
environment:
VROOM_ROUTER: ors
networks:
- app-network
deploy:
resources:
reservations:
cpus: "1"
memory: 50m
limits:
cpus: "1"
memory: 50m
valhalla:
image: ghcr.io/gis-ops/docker-valhalla/valhalla:latest
ports:
- "8002:8002"
volumes:
- ./infra/valhalla/custom_files:/custom_files
deploy:
resources:
reservations:
cpus: "1"
memory: 256m
limits:
cpus: "2"
memory: 1g
networks:
app-network:
driver: bridge
14 changes: 14 additions & 0 deletions .docker/infra/pgadmin/servers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Servers": {
"1": {
"Name": "local db",
"Group": "Green Ecolution",
"Port": 5432,
"Username": "postgres",
"Host": "db",
"SSLMode": "prefer",
"MaintenanceDB": "postgres",
"PasswordExecCommand": "echo 'postgres'"
}
}
}
42 changes: 42 additions & 0 deletions .docker/infra/vroom/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cliArgs:
geometry: false # retrieve geometry (-g)
planmode: false # run vroom in plan mode (-c) if set to true
threads: 4 # number of threads to use (-t)
explore: 5 # exploration level to use (0..5) (-x)
limit: '1mb' # max request size
logdir: '/..' # the path for the logs relative to ./src
logsize: '100M' # max log file size for rotation
maxlocations: 1000 # max number of jobs/shipments locations
maxvehicles: 200 # max number of vehicles
override: true # allow cli options override (-c, -g, -t and -x)
path: '' # VROOM path (if not in $PATH)
port: 3000 # expressjs port
router: 'ors' # routing backend (osrm, libosrm or ors)
timeout: 300000 # milli-seconds
baseurl: '/' #base url for api
routingServers:
ors:
driving-car:
host: 'ors-app/ors/v2'
port: '8082'
driving-hgv:
host: 'ors-app/ors/v2'
port: '8082'
cycling-regular:
host: 'ors-app/ors/v2'
port: '8082'
cycling-mountain:
host: 'ors-app/ors/v2'
port: '8082'
cycling-road:
host: 'ors-app/ors/v2'
port: '8082'
cycling-electric:
host: 'ors-app/ors/v2'
port: '8082'
foot-walking:
host: 'ors-app/ors/v2'
port: '8082'
foot-hiking:
host: 'ors-app/ors/v2'
port: '8082'
1 change: 0 additions & 1 deletion .env.dev

This file was deleted.

1 change: 0 additions & 1 deletion .env.prod

This file was deleted.

1 change: 0 additions & 1 deletion .env.stage

This file was deleted.

3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .envrc

use flake
44 changes: 42 additions & 2 deletions .github/workflows/build-and-push-develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@ name: Build and Push Docker Image Develop
- develop

jobs:
update_test_cover_badge:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Dependencies
run: sudo apt-get update && sudo apt-get install -y make build-essential libgeos-dev libproj-dev

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Setup
run: make setup/ci

- name: Build
run: make build

- name: generate test coverage
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...

- name: check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/green-ecolution/green-ecolution-backend
git-token: ${{ github.ref_name == 'develop' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges

build_and_deploy_dev:
runs-on: ubuntu-latest
permissions:
Expand All @@ -13,6 +45,7 @@ jobs:
actions: write
outputs:
COMMIT_SHA: ${{ steps.set_commit_sha.outputs.COMMIT_SHA }}
APP_VERSION: ${{ steps.set_app_version.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -24,6 +57,13 @@ jobs:
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_OUTPUT
- name: Set app version
id: set_app_version
run: |
APP_VERSION=$(git describe --tags --always --dirty)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand Down Expand Up @@ -52,7 +92,7 @@ jobs:
with:
context: .
build-args: |
APP_VERSION=development
APP_VERSION=${{env.APP_VERSION}}
APP_GIT_COMMIT=${{env.COMMIT_SHA}}
APP_GIT_BRANCH=develop
APP_BUILD_TIME=${{env.BUILD_TIME}}
Expand Down Expand Up @@ -97,7 +137,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }}
run: |
gh run download -R green-ecolution/green-ecolution-backend -n api-docs.json
gh run download -R green-ecolution/green-ecolution-backend -n api-docs.json
- name: Check API Docs exist
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Create Release
uses: thomaseizinger/create-release@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }}
with:
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
tag_name: ${{ env.RELEASE_VERSION }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/build-and-test-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,23 @@ jobs:

- name: Test
run: make test

test_pkg_client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Dependencies
run: sudo apt-get update && sudo apt-get install -y make build-essential libgeos-dev libproj-dev

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Setup
run: make setup/ci

- name: Test
run: cd pkg/client && go test ./...

Loading

0 comments on commit c89cbe4

Please sign in to comment.