Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality and instructions #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OSKARI_DB_PORT=5433
OSKARI_DB_USER=oskari
OSKARI_DB_PASSWORD=oskari
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env*
!.env.template
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# oskari-database-docker
Minimal working database setup for Oskari

This Docker container provides a minimal working database setup for Oskari, intended for use in Oskari development. It initializes the Oskari database following the guidelines outlined in the [Oskari documentation](https://oskari.org/documentation/docs/latest/3-Setup-instructions#Setup-database).

## Requirements

- Docker Compose (tested with Docker Desktop v.4.17)

## Steps to run

1. Copy the environment template

- copy .env.template to .env

2. Edit environment variables

- edit environment variables in .env
- OSKARI_DB_PORT - database port
- OSKARI_DB_USER - username for the Oskari database
- OSKARI_DB_PASSWORD - password for the Oskari database user

3. Start the database

- docker compose up db
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
volumes:
postgis-data:
driver: local

services:
db:
image: oskari/postgis
build:
context: ./postgis
volumes:
- postgis-data:/var/lib/postgresql/data
- ./postgis/scripts:/docker-entrypoint-initdb.d/
environment:
- POSTGRES_DB=oskaridb
- POSTGRES_USER=$OSKARI_DB_USER
- POSTGRES_PASSWORD=$OSKARI_DB_PASSWORD
ports:
- ${OSKARI_DB_PORT}:5432
10 changes: 10 additions & 0 deletions postgis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM postgres:14

ENV POSTGIS_MAJOR 3

RUN apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
&& rm -rf /var/lib/apt/lists/*
1 change: 1 addition & 0 deletions postgis/scripts/init_oskari.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE EXTENSION postgis;