|
|
|
# Postgres asennus
|
|
|
|
|
|
|
|
For development, the database works great as a docker container. In production however, you should have a real database.
|
|
|
|
|
|
|
|
## Postgres docker with mounted volume
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# running the container
|
|
|
|
docker run --name --restart=always postgis -p 5432:5432 -d -v /home/postgres:/var/lib/postgresql/data --restart=always mdillon/postgis
|
|
|
|
# run bash inside the docker
|
|
|
|
docker exec -it postgis bash
|
|
|
|
# connect to the database
|
|
|
|
psql -U postgres
|
|
|
|
# inside the database:
|
|
|
|
create database ehasa;
|
|
|
|
\c ehasa;
|
|
|
|
create user ehasa;
|
|
|
|
alter user ehasa with encrypted password 'salasana';
|
|
|
|
grant all privileges on database ehasa to ehasa;
|
|
|
|
create extension "uuid-ossp";
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
``` |