Coder Social home page Coder Social logo

postgres-docker's Introduction


postgres

Postgres and Pgweb with Docker Compose

simples way to run postgres in docker

Overview

This repo is just do store a simple way to run postgres and pgweb with docker

Prerequisites

To run this in your machine you will need to have Docker and Docker Compose installed.

Installing

Cloning the Repository

$ git clone https://github.com/codingwithmath/postgres-docker

$ cd postgres-docker

Guides

in our docker-compose.yml file we'll have our postgres image. It's important to noticy that we configure our database name, user and password:

environment: 
    - POSTGRES_DB=postgres
    - POSTGRES_USER=postgres
    - POSTGRES_PASSWORD=postgres
    - TZ=GMT

if you need to make changes in the file, that's the moment.

Running

If you have your enviorement properly configured you can run:

$ sudo docker-compose up

or

$ sudo docker-compose up -d

Migrations

after your containers is up and running you'll be able to execute your migrations

first, we are going to copy our migrations to the data/postgres folder created when we init our containers

$ sudo cp migrations/{YOUR_MIGRATIONS} data/postgres

in my case:

$ sudo cp migrations/*up.sql data/postgres   

after that, we can run our migrations:

$ sudo docker-compose exec postgres psql -U {YOUR_POSTGRES_USER} -d {YOUR_POSTGRES_DB} -1 -f /var/lib/postgresql/data/YOUR_MIGRATION.sql

in my case:

$ sudo docker-compose exec postgres psql -U postgres -d postgres -1 -f /var/lib/postgresql/data/001_create_table_up.sql

Pgweb

after running all comands above you'll can now see everything in http://localhost:8081

Refs

Brincando com o PostgreSQL - [PT-BR] pgweb

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.