Server backend for OpenBEERS
Import all submodules
git submodule update --init --recursiveinstall uv (if not present already)
https://docs.astral.sh/uv/getting-started/installation/
Install uv, then
uv syncMacOS (New, to be tested fully)
- install postgres and redis
New, (to be tested from scratch):
brew install postgresql
brew install redis- and/or
Install postgresql GUI
Ubuntu (TBT)
sudo apt install postgresql
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-serverWindows (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
- Update and install posgresql packages on your WSL:
sudo apt update; sudo apt install postgresql postgresql-contrib;
- Verify the installation by checking the PostgreSQL version:
psql --version
- Set a password for the default PostgreSQL user:
sudo passwd postgres
- Switch to the PostgreSQL user and access the PostgreSQL prompt:
psql -U postgres
- Create your very own OpenBEERS database:
createdb OpenBEERS
- Connect to your new database:
\c OpenBEERS - 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
-
Create DB server from the postgresql GUI (name=OpenBEERS)
-
Create the database
create database openbeers;- Enable PostGIS and PostGIS Raster extensions
create extension postgis;
create extension postgis_raster;
create extension postgis_sfcgal;
create extension fuzzystrmatch;- Install and build CitySim
https://github.com/kaemco/CitySim-Solver
- Copy
_config_dev.ymltoconfig.ymland adapt paths if needed
uv run run-devControl the postgresql and redis servers are running.
redis-serveruv run run-prodImport 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-datadocker build -t openbeers.backend --platform=linux/amd64 .