Skip to content

netzkolchose/botgard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

196 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BotGard 3.0

tests-ubuntu

Open Source Management System for Botanic Garden Collections built and maintained by netzkolchose.de in cooperation with the Botanical Garden of the Friedrich Schiller Universität Jena and the Botanical Garden of the TU Braunschweig.

Features

See Features wiki page for a list of features.

Requirements

To run the System in production mode you'll need:

Development

The following environment variables will be used by app/BotGard/settings.py if present.

You can also define an .env or `ini' file to store these value (See python-decouple documentation)

You can copy the app/.env-example file to app/.env and adjust it to your needs.

  • POSTGRES_PASSWORD: Password of the postgres user, if specified the postgres database backend will be used. Otherwise it falls back to sqlite3.
  • POSTGRES_USER: Name of the postgres user, defaults to postgres
  • POSTGRES_DATABASE: Name of the postgres database, defaults to postgres
  • POSTGRES_HOST: Name of the postgres host, defaults to localhost
  • POSTGRES_PORT: Name of the postgres host port, defaults to 5432
  • FULL_SERVER_HOST: Full hostname of the server (e.g. https://your-botgard.com), must be provided for deployments!
  • DJANGO_SECRET_KEY: Overrides the SECRET_KEY, defaults to a fixed sequence
  • DJANGO_TIME_ZONE: The default timezone, defaults to Europe/Berlin
  • DJANGO_ALLOWED_HOSTS: A list of hosts separated by spaces, defaults to empty list
  • DJANGO_CSRF_TRUSTED_ORIGINS: A list of hosts separated by spaces, defaults to FULL_SERVER_HOST
  • DJANGO_DEBUG: Set Django debug mode, defaults to True
  • MAP_TILE_URL: The URL for using OpenStreetMap raster tiles, defaults to /geo/raster-tiles/{z}/{x}/{y}.png, in live deployment this should be set to an nginx cached proxy url (see https://operations.osmfoundation.org/policies/tiles/)

To initially set up the development environment, install geo libraries and create a virtual environment using tools like venv or virtualenv and then:

sudo apt install librsvg2-bin
# or any other means to install the rsvg package

cd app
pip install -r requirements.txt
./manage.py migrate
./manage.py createsuperuser
./manage.py botgard_update_config

After that you can just run the development server with:

./manage.py runserver

Demo data

To create some demo gardens, species and individuals in your database run

./manage.py botgard_demo_data

The data is taken from CSV files in app/demo-data/.

Setting up postgres database

Postgres is required for proper text search in Django's admin views. If you do not need fulltext search, sqlite will work too.

To create a local database:

sudo apt install postgresql-server-dev-all postgis
# or any other means to install a local postgres server with GIS extension

# start psql
sudo -u postgres psql

# create user and database
CREATE USER "botgard-user" WITH PASSWORD "botgard-password";
CREATE DATABASE "botgard" ENCODING=UTF8 TEMPLATE=template0 OWNER="botgard-user";
CREATE EXTENSION IF NOT EXISTS postgis;

# allow the user to create databases (for unit-testing)
ALTER USER "botgard-user" CREATEDB;
# exit psql ^D

# add GIS extension to new "botgard" database
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS postgis;" botgard

To run the unit-tests:

# run once to add postgis to all django-created test databases
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS postgis;" template1

./manage.py collectstatic  # needs to be run once before testing
./manage.py test

Docker and CI

Dockerfile and app/start-server.sh are the entry points.

Please note that .env files are not put into the docker container (ignored by the .dockerignore file). For CI deployment, please use environment variables or generate an .env file during deployment.

run unittests in docker image

The unittests use the sqlite backend by default.

docker build --tag botgard-dev .
docker run -ti --env BOTGARD_RUN_TESTS=1 botgard-dev

To open a shell in the docker image:

docker run -ti --entrypoint /bin/bash botgard-dev

Data migration

The database of BotGard can be exported via:

./manage.py dumpdata -o dump-file.json

and imported into a newly created database via:

./manage.py migrate
./manage.py botgard_clear_django_tables
./manage.py loaddata dump-file.json

The import requires about 10-15 minutes per 100k objects...

Documentation

See the Wiki Page.

Getting Help and Commercial support

This project is backed by netzkolchose.de UG If you need help implementing or hosting BotGard for your Institution, please contact us: botgard@netzkolchose.de

Credits

Thanks to the Botanical Garden Jena especially Stefan Arndt for his ongoing support and input.

State and RoadMap

See RoadMap wiki page.

About

Open Source Management System for Botanic Garden Collections.

Resources

License

Stars

3 stars

Watchers

4 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors