diff --git a/examples/kubernetes/README.md b/examples/kubernetes/README.md index 75b7bb962..42f20cc76 100644 --- a/examples/kubernetes/README.md +++ b/examples/kubernetes/README.md @@ -6,24 +6,24 @@ The sentinels and proxies will be deployed as [kubernetes deployments](https://k ## Docker image -Prebuilt images are available on the dockerhub, the images' tags are the stolon release version plus the postgresql version (for example v0.6.0-pg9.6). +Prebuilt images are available on the dockerhub, the images' tags are the stolon release version plus the postgresql version (for example v0.12.0-pg10). **NOTE**: These images are **example** images provided for quickly testing stolon. In production you should build your own image customized to fit your needs (adding postgres extensions, backup tools/scripts etc...). Additional images are available: -* `master-pg9.6`: automatically built after every commit to the master branch. +* `master-pg10`: automatically built after every commit to the master branch. In the [image](image/docker) directory you'll find a Makefile to build the image used in this example (starting from the official postgreSQL images). The Makefile generates the Dockefile from a template Dockerfile where you have to define the wanted postgres version and image tag (`PGVERSION` and `TAG` mandatory variables). -For example, if you want to build an image named `stolon:master-pg9.6` that uses postgresql 9.6 you should execute: +For example, if you want to build an image named `stolon:master-pg10` that uses postgresql 10 you should execute: ``` -make PGVERSION=9.6 TAG=stolon:master-pg9.6 +make PGVERSION=10 TAG=stolon:master-pg10 ``` Once the image is built you should push it to the docker registry used by your kubernetes infrastructure. -The provided example uses `sorintlab/stolon:master-pg9.6` +The provided example uses `sorintlab/stolon:master-pg10` ## Cluster setup and tests @@ -44,7 +44,7 @@ You can execute stolonctl in different ways: * as a one shot command executed inside a temporary pod: ``` -kubectl run -i -t stolonctl --image=sorintlab/stolon:master-pg9.6 --restart=Never --rm -- /usr/local/bin/stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap init +kubectl run -i -t stolonctl --image=sorintlab/stolon:master-pg10 --restart=Never --rm -- /usr/local/bin/stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap init ``` * from a machine that can access the store backend: diff --git a/examples/swarm/README.md b/examples/swarm/README.md index b7d2dd362..3b25e33ca 100644 --- a/examples/swarm/README.md +++ b/examples/swarm/README.md @@ -2,20 +2,20 @@ In this example you'll see how stolon can provide an high available postgreSQL cluster inside Docker swarm. -We will use etcdv3 deployed in its own stack. +We will use etcdv3 deployed in its own stack. ## Docker image -Prebuilt images are available on the dockerhub, the images' tags are the stolon release version plus the postgresql version (for example v0.10.0-pg10). +Prebuilt images are available on the dockerhub, the images' tags are the stolon release version plus the postgresql version (for example v0.12.0-pg10). **NOTE**: These images are **example** images provided for quickly testing stolon. In production you should build your own image customized to fit your needs (adding postgres extensions, backup tools/scripts etc...). Additional images are available: -* `master-pg9.6`: automatically built after every commit to the master branch. +* `master-pg10`: automatically built after every commit to the master branch. In the [image](../kubernetes/image/docker) directory you'll find a Makefile to build the image used in this example (starting from the official postgreSQL images). The Makefile generates the Dockefile from a template Dockerfile where you have to define the wanted postgres version and image tag (`PGVERSION` and `TAG` mandatory variables). -For example, if you want to build an image named `stolon:master-pg9.6` that uses postgresql 9.6 you should execute: +For example, if you want to build an image named `stolon:master-pg10` that uses postgresql 10 you should execute: ``` make PGVERSION=10.3 TAG=stolon:master-pg10 @@ -38,28 +38,28 @@ This example has some predefined values that you'd like to change: If you don't already have one, you can create a new swarm using the following command: ``` -docker swarm init +docker swarm init ``` The output of the command above should provide you the command to use to add worker nodes. Something like: ``` -docker swarm join --token : +docker swarm join --token : ``` It's highly recommended to set labels on each node so that we can set deployment constraints. You can use to following command to set a `nodename` label equal to `node1` on the first node: ``` -docker node update --label-add nodename=node1 +docker node update --label-add nodename=node1 ``` Repeat this command to set a different label for each node. Allowed values for `` can be found using this command: ``` -docker node ls +docker node ls ``` - + ### Initialize the etcdv3 backend Now, before starting any stolon component, we need to start the etcdv3 backend. This can easily be done using the provided `docker-compose-etcd.yml` file: @@ -74,8 +74,8 @@ You can check everything is fine using this command: docker service ls ID NAME MODE REPLICAS IMAGE PORTS pbjr4k9285iy etcd_etcd-00 replicated 1/1 quay.io/coreos/etcd:v3.2.10 *:2379->2379/tcp -7bc4d0e0qf2y etcd_etcd-01 replicated 1/1 quay.io/coreos/etcd:v3.2.10 -2dcqqmi5li0v etcd_etcd-02 replicated 1/1 quay.io/coreos/etcd:v3.2.10 +7bc4d0e0qf2y etcd_etcd-01 replicated 1/1 quay.io/coreos/etcd:v3.2.10 +2dcqqmi5li0v etcd_etcd-02 replicated 1/1 quay.io/coreos/etcd:v3.2.10 ``` ### Initialize the cluster @@ -93,7 +93,7 @@ stolonctl --cluster-name=stolon-cluster --store-backend=etcdv3 --store-endpoints To create all the stolon components, we just have to create a new stack based on the file `docker-compose-pg.yml`. Before creating the stack, in case you have several nodes, it's highly recommended to set constraints so that each keeper will start on its own node. -Assuming you have 2 nodes with labels `nodename=node1` and `nodename=node2`, just edit the file `docker-compose-pg.yml` +Assuming you have 2 nodes with labels `nodename=node1` and `nodename=node2`, just edit the file `docker-compose-pg.yml` and uncomment the lines: ``` placement: @@ -112,17 +112,17 @@ Now, enter the following command to create the new stack with all stolon compone docker stack deploy --compose-file docker-compose-pg.yml pg ``` -This will create 2 sentinels, 2 proxies and 2 keepers. +This will create 2 sentinels, 2 proxies and 2 keepers. You can check everything is fine using this command: ``` docker service ls ID NAME MODE REPLICAS IMAGE PORTS pbjr4k9285iy etcd_etcd-00 replicated 1/1 quay.io/coreos/etcd:v3.2.17 *:2379->2379/tcp -7bc4d0e0qf2y etcd_etcd-01 replicated 1/1 quay.io/coreos/etcd:v3.2.17 -2dcqqmi5li0v etcd_etcd-02 replicated 1/1 quay.io/coreos/etcd:v3.2.17 -k2vh3ff0acpg pg_keeper1 replicated 1/1 sorintlab/master-pg10:latest -jbm195xsalwu pg_keeper2 replicated 1/1 sorintlab/master-pg10:latest +7bc4d0e0qf2y etcd_etcd-01 replicated 1/1 quay.io/coreos/etcd:v3.2.17 +2dcqqmi5li0v etcd_etcd-02 replicated 1/1 quay.io/coreos/etcd:v3.2.17 +k2vh3ff0acpg pg_keeper1 replicated 1/1 sorintlab/master-pg10:latest +jbm195xsalwu pg_keeper2 replicated 1/1 sorintlab/master-pg10:latest sf79wnygtcmu pg_proxy replicated 2/2 sorintlab/master-pg10:latest *:5432->5432/tcp tkbnrfdj4axa pg_sentinel replicated 2/2 sorintlab/master-pg10:latest ``` @@ -131,7 +131,7 @@ tkbnrfdj4axa pg_sentinel replicated 2/2 #### Connect to the proxy service -The password for the stolon user will be the value specified in your `./etc/secrets/pgsql` file (or `password1` if you did not change it). +The password for the stolon user will be the value specified in your `./etc/secrets/pgsql` file (or `password1` if you did not change it). ``` psql --host localhost --port 5432 postgres -U postgres -W