Skip to content

GeolearnAI/service-bdms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Borehole Management System Service

Installation

sudo apt-get install \
    unzip \
    python3.7 \
    python3-pip \
    nginx \
    nano \
    npm \
    git \
    postgresql \
    postgresql-contrib \
    postgis \
    libsqlite3-mod-spatialite 

Database initilization

Create the database

sudo -u postgres createdb -E UTF8 bdms

Create the tables:

sudo -u postgres psql -d bdms -f db/1_schema.sql

Add default data:

sudo -u postgres psql -d bdms -f db/2_data.sql
sudo -u postgres psql -d bdms -f db/3_cantons.sql
sudo -u postgres psql -d bdms -f db/4_municipalities.sql

Or remotly with port forwarding:

ssh -R 9432:localhost:5432 USER_NAME@IP_ADDRESS

And then:

psql -U postgres -d bdms -h localhost -p 9432 -f db/1_schema.sql
psql -U postgres -d bdms -h localhost -p 9432 -f db/2_data.sql
psql -U postgres -d bdms -h localhost -p 9432 -f db/4_municipalities.sql
psql -U postgres -d bdms -h localhost -p 9432 -f db/3_cantons.sql

Run Server

Setup virtual environment

sudo apt-get install python3-venv
python3.7 -m venv ./venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Activate virtual environment

source venv/bin/activate

Run Server

python bms/main.py --pg-database=bdms

Config parameters:

--pg-database      PostgrSQL database name (default bms)
--pg-host          PostgrSQL database host (default localhost)
--pg-password      PostgrSQL user password (default postgres)
--pg-port          PostgrSQL database port (default 5432)
--pg-user          PostgrSQL database user (default postgres)
--port             Tornado Web port (default 8888)

Run with docker

Installation

Docker install:

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Git install:

sudo apt-get install git

Build image and run docker

Clone server repository:

git clone https://github.com/geoadmin/service-bdms
cd service-bdms

Build Docker image (x.x.x is the release number, start with 1.0.0):

 sudo docker build -t swisstopo/bdms:x.x.x ./config

Run Docker container (x.x.x is the release number, start with 1.0.0):

sudo docker run -d --name bdmsContainer -p 80:80 swisstopo/bdms:x.x.x

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.8%
  • Dockerfile 1.7%
  • Other 0.5%