Skip to content

EIDA/stationbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Station Book

This repository is deployed at orfeus-eu.org/stationbook.

Quick start guide

  1. Create env file with config using cp src/stationbook/.env.sample src/stationbook/.env and adjust as needed:

    SECRET_KEY='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
    DEBUG=False
    ALLOWED_HOSTS=.localhost,127.0.0.1,0.0.0.0
    DATABASE_URL=sqlite:////data/stationbook/db/db.sqlite3
    EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
    CACHE_BACKEND=django.core.cache.backends.locmem.LocMemCache
    CACHE_LOCATION='sb_cache'
    CACHE_TIME_SHORT=1800
    CACHE_TIME_MEDIUM=3600
    CACHE_TIME_LONG=43200
    SB_URL_BASE='stationbook/'
    CSRF_COOKIE_HTTPONLY = True
    CSRF_COOKIE_SECURE = True
    SESSION_COOKIE_HTTPONLY = True
    SESSION_COOKIE_SECURE = True
    HCAPTCHA_SITEKEY=''
    HCAPTCHA_SECRET=''
  2. Create the virtual environment and install dependencies:

    cd src/stationbook
    python3.11 -m venv env && source env/bin/activate && pip install --upgrade pip && pip install -r requirements.txt
  3. Prepare the database migration and apply it (check DATABASE_URL in src/stationbook/.env):

    python manage.py makemigrations
    python manage.py migrate
  4. Create the super user:

    python manage.py createsuperuser
  5. Load the fixtures into the database:

    python manage.py loaddata book.json
  6. Run the test server:

    python manage.py runserver 0.0.0.0:8080

Docker

# Build the image
docker build . -t stationbook:latest

# Run the container (replace PATH_TO_MEDIA and PATH_TO_DB accordingly)
docker run -d --restart always \
--user $(id -u):$(id -g) \
-p 8010:80 \
-v PATH_TO_MEDIA:/data/stationbook/media \
-v PATH_TO_DB:/data/stationbook/db \
--name stationbook \
stationbook:latest

FDSN data synchronization

Below code can be used to synchronize with the EIDA nodes. EIDA nodes can be configured manually using admin panel or loaded from the fixtures.

python3 fdsn_sync.py

To automate the synchronization process, /stationbook/src/stationbook/fdsn_sync.py can be executed via crontab:

# min   hour    day     month   weekday command
0       *       *       *       *       cd /data/stationbook && python fdsn_sync.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •