Git Product home page Git Product logo

pqs's Introduction

pqs

This postgres service intended to be used only on development phase.

pqs designed for one-time use because it used for development only. no persistent volume. Easy to start, easy to destroy.

Image

Build image

$ docker build -t TAG .

Run a container

$ docker run -d --name postgres TAG

Stop a container

$ docker stop postgres

Run stopped container

$ docker start postgres

Services

TODO: bedakan image sama service!

Database maintenance

Installation method

Instalation using debian package. No need to initialize database cluster. Because standart installation already creates a default cluster.

Configuration file

Default installation /etc/postgresql/9.3/main/postgresql.conf

Where is data saved? (database directory)

Default debian installation use /var/lib/postgresql/9.3/main

Host Based Authentication file

This file for setting up client authentication. Default installation /etc/postgresql/9.3/main/pg_hba.conf

Create extra user and database

TODO: Create username, password and database outside
Dockerfile due security reason.

Initialize extra user & create new database in Dockerfile with command below:

RUN /etc/init.d/postgresql start &&\
    psql --command "CREATE USER bayu WITH SUPERUSER PASSWORD 'bayu';" &&\
    createdb -O bayu automata

NOTE: this command must running as postgres user.

Manage data

Manage data on postgres server container using running postgres client container as a client.

Make sure postgres container already running

$ docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS               NAMES
9e4232251c2d        bayu/pqs:v0         "/usr/lib/postgresql   10 hours ago        Up 2 seconds        5432/tcp            pg_server

Then run a postgres client based on same image to manage data. Don't forget to link pg_server to pg_client

$ docker run -it --name pg_client --entrypoint /bin/bash --link pg_server:database bayu/pqs:v0

Now you are ready to manage data using psql

$ psql -h database -U bayu -d automata

Todo

  • configure timezone to GMT+7
  • dynamically configured user and password for database

pqs's People

Contributors

pyk avatar

Watchers

 avatar  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.