Skip to content

Commit 6fbc8fc

Browse files
author
Matthew Fisher
committed
initial commit
0 parents  commit 6fbc8fc

24 files changed

Lines changed: 1121 additions & 0 deletions

.gitignore

Whitespace-only changes.

CHANGELOG.md

Whitespace-only changes.

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# How to Contribute
2+
3+
This project is part of Deis. You can find the latest contribution
4+
guidelines [at the Deis project](https://github.com/deis/deis/blob/master/CONTRIBUTING.md).
5+

DCO

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Developer Certificate of Origin
2+
Version 1.1
3+
4+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
5+
660 York Street, Suite 102,
6+
San Francisco, CA 94110 USA
7+
8+
Everyone is permitted to copy and distribute verbatim copies of this
9+
license document, but changing it is not allowed.
10+
11+
12+
Developer's Certificate of Origin 1.1
13+
14+
By making a contribution to this project, I certify that:
15+
16+
(a) The contribution was created in whole or in part by me and I
17+
have the right to submit it under the open source license
18+
indicated in the file; or
19+
20+
(b) The contribution is based upon previous work that, to the best
21+
of my knowledge, is covered under an appropriate open source
22+
license and I have the right under that license to submit that
23+
work with modifications, whether created in whole or in part
24+
by me, under the same open source license (unless I am
25+
permitted to submit under a different license), as indicated
26+
in the file; or
27+
28+
(c) The contribution was provided directly to me by some other
29+
person who certified (a), (b) or (c) and I have not modified
30+
it.
31+
32+
(d) I understand and agree that this project and the contribution
33+
are public and that a record of the contribution (including all
34+
personal information I submit with it, including my sign-off) is
35+
maintained indefinitely and may be redistributed consistent with
36+
this project or the open source license(s) involved.

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM postgres:9.4
2+
3+
RUN apt-get update && apt-get install -y \
4+
curl \
5+
gcc \
6+
libpq-dev \
7+
libyaml-dev \
8+
lzop \
9+
pv \
10+
python \
11+
python-dev \
12+
python-pip \
13+
--no-install-recommends \
14+
&& rm -rf /var/cache/apt/*
15+
16+
# add backup dir
17+
RUN mkdir -p /var/cache/postgresql/backups
18+
RUN chown -R postgres:postgres /var/cache/postgresql/backups
19+
20+
COPY rootfs /
21+
22+
RUN chown -R postgres:postgres /app
23+
24+
WORKDIR /app
25+
26+
RUN pip install -r requirements.txt
27+
28+
USER postgres
29+
30+
RUN mkdir data
31+
32+
CMD ["python", "governor.py", "postgres.yml"]
33+
34+
ENV DEIS_RELEASE 2.0.0-dev

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2015 Engine Yard, Inc.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

MAINTAINERS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Deis Maintainers
2+
3+
This project is part of Deis. The official maintainers documentation is
4+
located [in the main project](https://github.com/deis/deis/blob/master/MAINTAINERS.md).

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export GO15VENDOREXPERIMENT=1
2+
VERSION := 0.0.1
3+
4+
all:
5+
@echo "Use a Makefile to control top-level building of the project."
6+
7+
build:
8+
@echo "nothing to build"
9+
10+
deploy: kube-service kube-rc
11+
12+
kube-service:
13+
kubectl create -f def/postgres-service.json
14+
15+
kube-rc:
16+
kubectl create -f def/postgres-rc.json
17+
18+
kube-clean:
19+
kubectl delete rc postgres
20+
21+
test:
22+
@echo "no tests"
23+
24+
.PHONY: all build deploy kube-service kube-rc kube-clean test

README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Postgres
2+
3+
A PostgreSQL database for use in the [Deis](http://deis.io) open source PaaS.
4+
5+
This Docker image is based on the official
6+
[postgres](https://registry.hub.docker.com/_/postgres/) image.
7+
8+
Master/slave replication and leader election code is largely inspired by [`compose/governor`](https://github.com/compose/governor).
9+
10+
Please add any [issues](https://github.com/deis/postgres/issues) you find with this software.
11+
12+
13+
## Deploying
14+
15+
In order to run this component in Kubernetes, a few prerequisites are needed:
16+
17+
- An AWS account with S3 enabled
18+
- An external etcd cluster
19+
- your own kubernetes cluster
20+
21+
In Deis, these services are provided to you automatically through [the store](http://docs.deis.io/en/latest/understanding_deis/components/#store)
22+
and [etcd](https://github.com/technosophos/etcd) components.
23+
24+
To build a dev release of this image, you will also need your own registry, but DockerHub or
25+
[Quay](https://quay.io/) will do fine here. To build, run:
26+
27+
```bash
28+
$ make build
29+
$ docker build -t deis/postgres:v0.0.1
30+
$ docker push deis/postgres:v0.0.1
31+
```
32+
33+
This will compile the Docker image and push it to your registry.
34+
35+
Then, you'll need to modify the kubernetes manifests to point to your S3 account and your etcd
36+
cluster. Open up the replication controller manifest and change the values:
37+
38+
```
39+
$ git diff
40+
diff --git a/manifests/postgres-rc.json b/manifests/postgres-rc.json
41+
index a5cbb23..70d3bc2 100644
42+
--- a/manifests/postgres-rc.json
43+
+++ b/manifests/postgres-rc.json
44+
@@ -22,15 +22,15 @@
45+
"containers": [
46+
{
47+
"name": "deis-database",
48+
- "image": "CHANGEME",
49+
+ "image": "deis/postgres:v0.0.1",
50+
"env": [
51+
{
52+
"name" : "AWS_ACCESS_KEY_ID",
53+
- "value" : "CHANGEME"
54+
+ "value" : "FOO"
55+
},
56+
{
57+
"name" : "AWS_SECRET_ACCESS_KEY",
58+
- "value" : "CHANGEME"
59+
+ "value" : "BAR"
60+
},
61+
{
62+
"name" : "WALE_S3_PREFIX",
63+
@@ -38,7 +38,7 @@
64+
},
65+
{
66+
"name" : "ETCD_SERVICE_HOST",
67+
- "value" : "192.168.0.1"
68+
+ "value" : "10.0.1.100"
69+
}
70+
],
71+
"ports": [
72+
```
73+
74+
After that, run
75+
76+
```
77+
$ make deploy
78+
```
79+
80+
Which will deploy the component to kubernetes. After a while, you should see a few pods up with one
81+
running:
82+
83+
```
84+
NAME READY STATUS RESTARTS AGE
85+
deis-database-6wy8o 1/1 Running 0 32s
86+
deis-database-rh00d 0/1 Running 0 32s
87+
```
88+
89+
You can then query these images as you would with any other Kubernetes pod:
90+
91+
```
92+
$ kubectl logs -f deis-database-6wy8o
93+
$ kubectl exec -it deis-database-6wy8o psql
94+
```
95+
96+
97+
## Testing
98+
99+
**Note**: At this time, tests from Deis v1 are still being ported over.
100+
101+
You can run the test suite with
102+
103+
```
104+
$ make test
105+
```
106+
107+
108+
## License
109+
110+
© 2015 Engine Yard, Inc.
111+
112+
Licensed under the Apache License, Version 2.0 (the "License"); you may
113+
not use this file except in compliance with the License. You may obtain
114+
a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
115+
116+
Unless required by applicable law or agreed to in writing, software
117+
distributed under the License is distributed on an "AS IS" BASIS,
118+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119+
See the License for the specific language governing permissions and
120+
limitations under the License.

_docs/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)