Skip to content

Commit

Permalink
Update docker-compose files
Browse files Browse the repository at this point in the history
- keep up to date with latest spec.
- better way to deal with volumes
- avoid sed and replace in travis
- use env variables to expose what datadir is used
  • Loading branch information
epcim committed Apr 23, 2018
1 parent 5adf204 commit 143abb4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ kubeconfig_remote

.cache
.pytest_cache

workspace/
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ jobs:
- docker-compose -f docker-compose.etcd-volume.yml up -d
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl mkdir /travis/
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl set /travis/commit $TRAVIS_COMMIT
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl backup --data-dir /0.etcd/ --backup-dir /root/backup/
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl backup --data-dir /*.etcd/ --backup-dir /root/backup/
- docker-compose -f docker-compose.etcd-volume.yml stop
- docker-compose -f docker-compose.etcd-volume.yml rm -fv
- sed -i 's/#//g' docker-compose.etcd-volume.yml
# restore and verify
- export ETCD_DATA_DIR=/root/backup ETCD_FORCE_NEW_CLUSTER=1
- docker-compose -f docker-compose.etcd-volume.yml up -d
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl ls --recursive /travis/
- |
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.auth.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.2'
services:
ldap:
image: osixia/openldap
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.demo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.2'
services:
api:
image: kqueen/api:v0.18
Expand Down
24 changes: 17 additions & 7 deletions docker-compose.etcd-volume.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
version: '2'
version: '3.2'
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
-
# your docker env subnet
subnet: 172.16.254.0/24
services:
etcd:
image: quay.io/coreos/etcd:latest
ports:
- 127.0.0.1:4001:4001
volumes:
- /tmp/backup/:/root/backup/
environment:
ETCD_NAME: 0
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd:2380
Expand All @@ -22,5 +21,16 @@ services:
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:4001
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_ADVERTISE_CLIENT_URLS: http://127.0.0.1:4001,http://etcd:4001
#ETCD_DATA_DIR: /root/backup/
#ETCD_FORCE_NEW_CLUSTER: 1
ETCD_DATA_DIR: ${ETCD_DATA_DIR:-/default.etcd}
ETCD_FORCE_NEW_CLUSTER: ${ETCD_FORCE_NEW_CLUSTER:-0}

volumes:
- type: bind
source: ./workspace/etcd-data
target: /default.etcd
#- type: volume
#source: etcd-data
#target: /default.etcd

volumes:
etcd-data:
2 changes: 1 addition & 1 deletion docker-compose.kubernetes.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.2'
services:
apiserver:
image: gcr.io/google_containers/hyperkube-amd64:v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.2'
services:
etcd:
restart: always
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
version: '2'
version: '3.2'
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
-
# your docker env subnet
subnet: 172.16.254.0/24
services:
etcd:
image: quay.io/coreos/etcd:latest
Expand All @@ -20,3 +21,4 @@ services:
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:4001
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_ADVERTISE_CLIENT_URLS: http://127.0.0.1:4001,http://etcd:4001

0 comments on commit 143abb4

Please sign in to comment.