pgweb/README.md

167 lines
3.7 KiB
Markdown
Raw Normal View History

2014-10-09 06:29:43 +04:00
# pgweb
2014-10-11 06:06:08 +04:00
Web-based PostgreSQL database browser written in Go.
2014-10-09 06:29:43 +04:00
2014-10-28 06:12:56 +03:00
[![Build Status](https://travis-ci.org/sosedoff/pgweb.svg?branch=master)](https://travis-ci.org/sosedoff/pgweb)
2014-10-14 06:02:04 +04:00
## 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.
2014-10-14 20:34:22 +04:00
<img src="screenshots/browse.png" width="345px" />
<img src="screenshots/query.png" width="345px" />
2014-10-23 19:11:40 +04:00
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
2014-10-14 06:02:04 +04:00
## Installation
Please visit [Github Releases](https://github.com/sosedoff/pgweb/releases) to download a
precompiled binary for your operating system.
Currently supported:
2014-10-14 06:03:42 +04:00
- Mac OSX 64bit
2014-10-14 06:02:04 +04:00
- Linux 32/64bit
- Windows 32/64bit
2014-10-17 02:42:40 +04:00
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.
2014-10-29 21:58:32 +03:00
## Run on Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/sosedoff/pgweb)
2014-10-09 06:29:43 +04:00
## Usage
2014-10-14 06:03:42 +04:00
Start server:
```
2014-10-14 19:52:40 +04:00
pgweb --host localhost --user myuser --db mydb
2014-10-14 06:03:42 +04:00
```
2014-10-14 19:52:40 +04:00
You can also specify a connection URI instead of individual flags:
2014-10-14 06:02:04 +04:00
```
pgweb --url postgres://user:password@host:port/database
2014-10-14 06:02:04 +04:00
```
It works great with [Heroku Postgres](https://postgres.heroku.com) if you need
to troubleshoot production database or simply run a few queries.
2014-10-21 18:25:58 +04:00
Full CLI options:
2014-10-09 06:29:43 +04:00
```
2014-10-14 06:02:04 +04:00
Usage:
pgweb [OPTIONS]
Application Options:
2014-10-30 03:45:12 +03:00
-v, --version Print version
-d, --debug Enable debugging mode (false)
--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)
2014-10-30 03:45:12 +03:00
--listen= HTTP server listen port (8080)
--auth-user= HTTP basic auth user
--auth-pass= HTTP basic auth password
-s, --skip-open Skip browser open on start
2014-10-09 06:29:43 +04:00
```
2014-10-11 06:06:08 +04:00
## Compile from source
2014-10-09 06:54:49 +04:00
2014-10-11 06:06:08 +04:00
Go 1.3+ is required. You can install Go with `homebrew`:
2014-10-09 06:54:49 +04:00
```
2014-10-11 06:06:08 +04:00
brew install go
2014-10-10 04:23:19 +04:00
```
2014-10-11 06:06:08 +04:00
To compile source code run the following command:
2014-10-09 06:29:43 +04:00
```
2014-10-25 05:52:53 +04:00
make setup
2014-10-14 03:31:28 +04:00
make dev
2014-10-10 04:23:19 +04:00
```
2014-10-14 06:02:04 +04:00
This will produce `pgweb` binary in the current directory.
2014-10-21 18:25:58 +04:00
There's also a task to compile binaries for other operating systems:
```
make build
```
Under the hood it uses [gox](https://github.com/mitchellh/gox). Compiled binaries
will be stored into `./bin` directory.
2014-11-03 09:35:56 +03:00
## Use in Docker
Build the image. (Docker version 1.1)
```
docker build -t your-username/pgweb .
```
Run the container
```
docker run [OPTIONS of docker] your-username/pgweb [OPTIONS of pgweb]
```
#### demo:
postgresql container:
```
2014-11-04 08:18:26 +03:00
docker run -d --name="postgresql" \
2014-11-03 09:35:56 +03:00
-p 5432:5432 \
-e USER="testuser" \
-e DB="testdb" \
-e PASS="test123" \
paintedfox/postgresql
```
pgweb containers:
```
docker run -d -p 8082:8080 your-username/pgweb \
--url postgres://testuser:test123@your-ip:5432/testdb \
--bind 0.0.0.0
```
2014-11-04 08:18:26 +03:00
Then open [http://your-ip:8082](#) in your browser
2014-11-03 09:35:56 +03:00
2014-10-14 06:02:04 +04:00
## Contributors
- Dan Sosedoff - https://twitter.com/sosedoff
- Masha Safina - https://twitter.com/mashasafina
## License
The MIT License (MIT)
2014-10-14 20:34:22 +04:00
Copyright (c) 2014 Dan Sosedoff, <dan.sosedoff@gmail.com>