Cross-platform client for PostgreSQL databases
Go to file
2014-11-21 20:04:02 -06:00
Godeps godeps 2014-10-30 17:35:27 -07:00
screenshots Update screenshots take 2 2014-10-26 18:28:51 -05:00
static Detect 127.0.0.1 in js as local connection 2014-11-21 20:04:02 -06:00
.gitignore vendor in the bindata 2014-10-30 17:35:27 -07:00
.travis.yml Test on go tip 2014-10-30 16:46:14 -05:00
api.go Return NewError function where it belongs 2014-11-20 21:43:51 -06:00
app.json Fix identation in app.json and add icon url 2014-11-06 10:19:15 -06:00
bindata.go Detect 127.0.0.1 in js as local connection 2014-11-21 20:04:02 -06:00
CHANGELOG.md Add changelog dates 2014-11-21 17:37:49 -06:00
client.go Implement client.fetchRows to reduce duplication 2014-11-21 17:07:32 -06:00
Dockerfile Run dep restore and build as separate commands in dockerfile 2014-11-10 12:54:41 -06:00
LICENSE License, readme 2014-10-13 21:02:04 -05:00
main.go Print runtime stats every minute when --debug flag is set 2014-11-20 20:00:45 -06:00
Makefile Rename asset build tasks 2014-11-11 18:13:23 -06:00
Procfile Bind to 0.0.0.0 in Procfile 2014-11-05 22:15:05 -06:00
README.md Readme tweaks 2014-11-07 18:12:08 -06:00
statements.go Move statements out of Client 2014-11-21 20:47:33 +00:00
utils.go Set profiler sleep time to 30 seconds 2014-11-21 17:20:30 -06:00

pgweb

Web-based PostgreSQL database browser written in Go.

Build Status

Overview

This is a web-based browser for PostgreSQL database server. Its written in Go and works on Mac OSX, Linux and Windows machines. Main idea behind using Go for the backend is to utilize language's ability for cross-compile source code for multiple platforms. This project is an attempt to create a very simple and portable application to work with PostgreSQL databases.

Features:

  • Connect to local or remote server
  • Browse tables and table rows
  • Get table details: structure, size, indices, row count
  • Execute SQL query and run analyze on it
  • Export query results to CSV
  • View query history

Installation

Please visit Github Releases to download a precompiled binary for your operating system.

Currently supported:

  • Mac OSX 64bit
  • Linux 32/64bit
  • Windows 32/64bit

Supported PostgreSQL versions:

  • 9.1
  • 9.2
  • 9.3

Older versions of PostgreSQL might also work but this project is not tested on 8.x branches.

Run on Heroku

Deploy

Usage

Start server:

pgweb

You can also provide connection flags:

pgweb --host localhost --user myuser --db mydb

Connection URL scheme is also supported:

pgweb --url postgres://user:password@host:port/database?sslmode=[mode]

It works great with Heroku Postgres if you need to troubleshoot production database or simply run a few queries.

CLI options

Usage:
  pgweb [OPTIONS]

Application Options:
  -v, --version    Print version
  -d, --debug      Enable debugging mode (false)
  -s, --skip-open  Skip browser open on start
      --url=       Database connection string
      --host=      Server hostname or IP (localhost)
      --port=      Server port (5432)
      --user=      Database user (postgres)
      --pass=      Password for user
      --db=        Database name (postgres)
      --ssl=       SSL option (disable)
      --bind=      HTTP server host (localhost)
      --listen=    HTTP server listen port (8080)
      --auth-user= HTTP basic auth user
      --auth-pass= HTTP basic auth password

Build from source

Go 1.3+ is required. You can install Go with homebrew:

brew install go

To compile source code run the following command:

make setup
make dev

This will produce pgweb binary in the current directory.

There's also a task to compile binaries for other operating systems:

make build

Under the hood it uses gox. Compiled binaries will be stored into ./bin directory.

Use in Docker

Build the image:

docker build -t pgweb .

Start container:

docker run [OPTIONS of docker] pgweb [OPTIONS of pgweb]

Example

Run postgresql container:

docker run -d \
           --name="postgresql" \
           -p 5432:5432 \     
           -e USER="testuser" \
           -e DB="testdb" \
           -e PASS="test123" \
           paintedfox/postgresql

Run pgweb container:

docker run -d \
           -p 8080:8080 pgweb \
           --url postgres://testuser:test123@your-ip:5432/testdb \
           --bind 0.0.0.0

Then open http://your-ip:8082 in your browser.

Contributing

  • Fork repository
  • Create a feature or bugfix branch
  • Open a new pull request
  • Use github issues for any questions

Contact

License

The MIT License (MIT)

Copyright (c) 2014 Dan Sosedoff, dan.sosedoff@gmail.com