Giter Site home page Giter Site logo

demodb-docker's Introduction

demodb-docker

Run a postgres instance in Docker and initially load the flight demo database:

docker compose up -d
docker compose logs -f

Now connect to the database on localhost using the port and credentials from the .env file.

Stop and remove postgres and persistent files of the database:

docker compose down
rm -rf volumes/postgres/*

If changing only the init scripts, build without using cache:

docker compose build --no-cache

Configuration

# path of config file in container
pgconf=/var/lib/postgresql/data/postgresql.conf
# get id of postgres container
cid=$(docker ps | grep demodb-docker-postgres | awk '{print $1}')
# view full config
docker exec $cid cat $pgconf
# configure pg_stat_statements and logs
docker exec $cid sed -i "/#shared_preload_libraries = '' # (change requires restart)/c\shared_preload_libraries = 'pg_stat_statements'" $pgconf
docker exec $cid sed -i "/#log_destination = 'stderr'/c\log_destination = 'csvlog'" $pgconf
docker exec $cid sed -i "/#logging_collector = off/c\logging_collector = on" $pgconf
docker exec $cid sed -i "/#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'/c\log_filename = 'postgresql.log'" $pgconf
# verify config with only values that are set
docker exec $cid egrep -v "^[[:blank:]]*($|#|//|/\*| \*|\*/)" $pgconf
# restart to apply config changes
docker restart $cid

References

demodb-docker's People

Contributors

munterfi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.