Skip to content

idiap/openbeers-server

Repository files navigation

openbeers-sever

Server backend for OpenBEERS

Installation

Import all submodules

git submodule update --init --recursive

Install UV

install uv (if not present already)

https://docs.astral.sh/uv/getting-started/installation/

Install dependencies

Install uv, then

uv sync

Install PostgreSQL/PostGIS/Redis

MacOS (New, to be tested fully)

  1. install postgres and redis

New, (to be tested from scratch):

brew install postgresql
brew install redis
  1. and/or

Install postgresql GUI

https://www.postgresql.org/

Ubuntu (TBT)

sudo apt install postgresql
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server

Windows (WSL2)

This is a basic WSL installation to get a simple test environment on your machine. It will be updated later on with more secure practices

  1. Update and install posgresql packages on your WSL:
    sudo apt update;
    sudo apt install postgresql postgresql-contrib;
  2. Verify the installation by checking the PostgreSQL version:
    psql --version
  3. Set a password for the default PostgreSQL user:
    sudo passwd postgres
  4. Switch to the PostgreSQL user and access the PostgreSQL prompt:
    psql -U postgres
  5. Create your very own OpenBEERS database:
    createdb OpenBEERS
  6. Connect to your new database:
    \c OpenBEERS
  7. Back on your windows machine, in your %UserProfile% directory, create a .wslconfig file if you do not already have one and add the following line to it (only works on WSL2). This will allow seamless port forwarding.
networkingMode=mirrored

Initialize database + extensions

  1. Create DB server from the postgresql GUI (name=OpenBEERS)

  2. Create the database

create database openbeers;
  1. Enable PostGIS and PostGIS Raster extensions
create extension postgis;
create extension postgis_raster;
create extension postgis_sfcgal;
create extension fuzzystrmatch;

Config

  1. Install and build CitySim

https://github.com/kaemco/CitySim-Solver

  1. Copy _config_dev.yml to config.ymland adapt paths if needed

Run the server (debug)

uv run run-dev

Control the postgresql and redis servers are running.

redis-server

Run the server (production)

uv run run-prod

Initialize the database

Import global (world) data:

uv run openbeers world import-data
uv run openbeers municipality import-zone-files
uv run openbeers energy import-historical-data
uv run openbeers energy import-pv-installations
uv run openbeers zone import-zones-data

Build Docker container

docker build -t openbeers.backend --platform=linux/amd64 .

About

Server backend for OpenBEERS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages