You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A PostgreSQL database for use in the [Deis](http://deis.io) open source PaaS.
3
+
Deis (pronounced DAY-iss) is an open source PaaS that makes it easy to deploy and manage applications on your own servers. Deis builds on [Kubernetes](http://kubernetes.io/) to provide a lightweight, easy and secure way to deploy your code to production.
For more information about the Deis workflow, please visit the main project page at https://github.com/deis/workflow.
7
6
8
-
Master/slave replication and leader election code is largely inspired by [`compose/governor`](https://github.com/compose/governor).
7
+
## Beta Status
9
8
10
-
Please add any [issues](https://github.com/deis/postgres/issues)you find with this software.
9
+
This Deis component is currently in beta status, and we welcome your input! If you have feedback, please submit an [issue][issues]. If you'd like to participate in development, please read the "Development" section below and submit a [pull request][prs].
11
10
11
+
# About
12
12
13
-
## Deploying
13
+
This component is a PostgreSQL database for use in Kubernetes. It builds on the official [postgres](https://registry.hub.docker.com/_/postgres/) Docker image. While it's intended for use inside of the Deis open source [PaaS](https://en.wikipedia.org/wiki/Platform_as_a_service), it's flexible enough to be used as a standalone pod on any Kubernetes cluster or even as a standalone Docker container.
14
14
15
-
To build a dev release of this image, you will also need your own registry, but DockerHub or
16
-
[Quay](https://quay.io/) will do fine here. To build, run:
15
+
# Development
17
16
18
-
```bash
19
-
$ export DEIS_REGISTRY=myregistry.com:5000
20
-
$ make docker-build docker-push
21
-
```
17
+
The Deis project welcomes contributions from all developers. The high level process for development matches many other open source projects. See below for an outline.
22
18
23
-
This will compile the Docker image and push it to your registry.
19
+
- Fork this repository
20
+
- Make your changes
21
+
- Submit a [pull request][prs] (PR) to this repository with your changes, and unit tests whenever possible
22
+
- If your PR fixes any [issues][issues], make sure you write Fixes #1234 in your PR description (where #1234 is the number of the issue you're closing)
23
+
- The Deis core contributors will review your code. After each of them sign off on your code, they'll label your PR with LGTM1 and LGTM2 (respectively). Once that happens, a contributor will merge it
24
24
25
-
After that, run
25
+
## Prerequisites
26
26
27
-
```
28
-
$ make deploy
29
-
```
27
+
In order to develop and test this component in a Deis cluster, you'll need the following:
30
28
31
-
Which will deploy the component to kubernetes. After a while, you should see one pod up with one
32
-
running:
29
+
*[GNU Make](https://www.gnu.org/software/make/)
30
+
*[Docker](https://www.docker.com/) installed, configured and running
31
+
* A working Kubernetes cluster and `kubectl` installed and configured to talk to the cluster
32
+
* If you don't have this setup, please see [the installation instructions][install-k8s]
33
33
34
-
```
35
-
NAME READY STATUS RESTARTS AGE
36
-
postgres-6wy8o 1/1 Running 0 32s
37
-
```
34
+
## Testing Your Code
38
35
39
-
You can then query this pod as you would with any other Kubernetes pod:
36
+
Once you have all the aforementioned prerequisites, you are ready to start writing code. Once you've finished building a new feature or fixed a bug, please write a unit or integration test for it if possible. See [an existing test](https://github.com/deis/postgres/blob/master/contrib/ci/test.sh) for an example test.
40
37
41
-
```
42
-
$ kubectl logs -f postgres-6wy8o
43
-
$ kubectl exec -it postgres-6wy8o psql
44
-
```
38
+
If your feature or bugfix doesn't easily lend itself to unit/integration testing, you may need to add tests at a higher level. Please consider adding a test to our [end-to-end test suite](https://github.com/deis/workflow-e2e) in that case. If you do, please reference the end-to-end test pull request in your pull request for this repository.
45
39
40
+
### Dogfooding
46
41
47
-
## Testing
42
+
Finally, we encourage you to [dogfood](https://en.wikipedia.org/wiki/Eating_your_own_dog_food) this component while you're writing code on it. To do so, you'll need to build and push Docker images with your changes.
48
43
49
-
You can run the test suite with
44
+
This project has a [Makefile](https://github.com/deis/postgres/blob/master/Makefile) that makes these tasks significantly easier. It requires the following environment variables to be set:
50
45
51
-
```
52
-
$ make test
46
+
*`DEIS_REGISTRY` - A Docker registry that you have push access to and your Kubernetes cluster can pull from
47
+
* If this is [Docker Hub](https://hub.docker.com/), leave this variable empty
48
+
* Otherwise, ensure it has a trailing `/`. For example, if you're using [Quay.io](https://quay.io), use `quay.io/`
49
+
*`IMAGE_PREFIX` - The organization in the Docker repository. This defaults to `deis`, but if you don't have access to that organization, set this to one you have push access to.
50
+
*`SHORT_NAME` (optional) - The name of the image. This defaults to `controller`
51
+
*`VERSION` (optional) - The tag of the Docker image. This defaults to the current Git SHA (the output of `git rev-parse --short HEAD`)
52
+
53
+
Assuming you have these variables set correctly, run `make docker-build` to build the new image, and `make docker-push` to push it. Here is an example command that would push to `quay.io/arschles/postgres:devel`:
54
+
55
+
```console
56
+
export DEIS_REGISTRY=quay.io/
57
+
export IMAGE_PREFIX=arschles
58
+
export VERSION=devel
59
+
make docker-build docker-push
53
60
```
54
61
62
+
Note that you'll have to push your image to a Docker repository (`make docker-push`) in order for your Kubernetes cluster to pull the image. This is important for testing in your cluster.
0 commit comments