mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
commit
69294dd41f
@ -6,7 +6,7 @@ Most of the scripts/files assume you are on a Mac.
|
|||||||
|
|
||||||
- Recent Docker for Mac installed (edge, nightly, master channel)
|
- Recent Docker for Mac installed (edge, nightly, master channel)
|
||||||
- Currently, you need a *custom* version of VPNKit installed in Docker
|
- Currently, you need a *custom* version of VPNKit installed in Docker
|
||||||
for Mac. Contact @magnus or @rneugeba.
|
for Mac (see below)
|
||||||
- For the GCP portion: `brew install google-cloud-sdk`
|
- For the GCP portion: `brew install google-cloud-sdk`
|
||||||
- For `etcd`: `brew install etcd`
|
- For `etcd`: `brew install etcd`
|
||||||
- Infrakit: Clone [infrakit](https://github.com/docker/infrakit) and
|
- Infrakit: Clone [infrakit](https://github.com/docker/infrakit) and
|
||||||
@ -14,6 +14,32 @@ Most of the scripts/files assume you are on a Mac.
|
|||||||
infrakit. For each, `make build-in-container` and then copy the
|
infrakit. For each, `make build-in-container` and then copy the
|
||||||
contents of `./build` somewhere in your path.
|
contents of `./build` somewhere in your path.
|
||||||
|
|
||||||
|
For some of the demos, you currently need an updated version of VPNKit
|
||||||
|
for Docker for Mac. Hopefully this version will ship as default soon.
|
||||||
|
|
||||||
|
Quit docker for Mac
|
||||||
|
```
|
||||||
|
curl -fsSL --retry 10 -z vpnkit.tgz -o vpnkit.tgz https://circle-artifacts.com/gh/docker/vpnkit/708/artifacts/0/Users/distiller/vpnkit/vpnkit.tgz
|
||||||
|
|
||||||
|
tar xzvf vpnkit.tgz
|
||||||
|
cp Contents/MacOS/vpnkit /Applications/Docker.app/Contents/Resources/bin/
|
||||||
|
```
|
||||||
|
Restart Docker for Mac.
|
||||||
|
|
||||||
|
|
||||||
|
# Local setup
|
||||||
|
|
||||||
|
We use a `socat` container to forward ports from the VM to localhost (via Docker for Mac), to make it easier to access some VMs. To build
|
||||||
|
```
|
||||||
|
(cd dockerfiles; docker build -t socat -f Dockerfile.socat .)
|
||||||
|
```
|
||||||
|
And then run:
|
||||||
|
```
|
||||||
|
docker run --rm -t -d -p 8080:8080 socat tcp-listen:8080,reuseaddr,fork tcp:192.168.65.100:80
|
||||||
|
```
|
||||||
|
This forwards local port `8080` to `192.168.65.100:80`, so if you start, say the `intro` image, run `moby run -ip 196.168.65.100 intro`
|
||||||
|
|
||||||
|
|
||||||
# GCP Setup
|
# GCP Setup
|
||||||
|
|
||||||
You probably want to change the project/zone
|
You probably want to change the project/zone
|
||||||
|
8
projects/demo/dockerfiles/Dockerfile.socat
Normal file
8
projects/demo/dockerfiles/Dockerfile.socat
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# A dockerfile to build a socat container
|
||||||
|
#
|
||||||
|
# It sets the environment to talk to the local cluster
|
||||||
|
FROM alpine:edge
|
||||||
|
|
||||||
|
RUN apk add --no-cache socat
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/bin/socat" ]
|
6
projects/demo/etcd/Dockerfile.local
Normal file
6
projects/demo/etcd/Dockerfile.local
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# A dockerfile to build an etcd container image from the upstream one
|
||||||
|
#
|
||||||
|
# It sets the environment to talk to the local cluster
|
||||||
|
FROM quay.io/coreos/etcd:v3.1.5
|
||||||
|
|
||||||
|
ENV ETCDCTL_ENDPOINTS="http://192.168.65.200:2379,http://192.168.65.201:2379,http://192.168.65.202:2379,http://192.168.65.203:2379,http://192.168.65.204:2379"
|
@ -15,7 +15,7 @@ moby build etcd
|
|||||||
|
|
||||||
## InfraKit cluster setup (OUTDATED)
|
## InfraKit cluster setup (OUTDATED)
|
||||||
|
|
||||||
This should create a HyperKit based, InfraKit managed `etcd` cluster with 3 `etcd` instances.
|
This should create a HyperKit based, InfraKit managed `etcd` cluster with 5 `etcd` instances.
|
||||||
|
|
||||||
Start InfraKit:
|
Start InfraKit:
|
||||||
```
|
```
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
docker build -t mobylinux/etcd .
|
docker build -t mobylinux/etcd .
|
||||||
|
|
||||||
|
docker build -t etcd.local -f Dockerfile.local .
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
set -x
|
set -x
|
||||||
set -v
|
set -v
|
||||||
|
|
||||||
# --initial-cluster argument should come from meta data
|
|
||||||
|
|
||||||
# Wait till we have an IP address
|
# Wait till we have an IP address
|
||||||
IP=""
|
IP=""
|
||||||
while [ -z "$IP" ]; do
|
while [ -z "$IP" ]; do
|
||||||
@ -18,6 +16,10 @@ NUM=$(echo ${IP} | cut -d . -f 4)
|
|||||||
PREFIX=$(echo ${IP} | cut -d . -f 1,2,3)
|
PREFIX=$(echo ${IP} | cut -d . -f 1,2,3)
|
||||||
NAME=infra${NUM}
|
NAME=infra${NUM}
|
||||||
|
|
||||||
|
# This should come from Metadata
|
||||||
|
INIT_CLUSTER=infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380,infra203=http://${PREFIX}.203:2380,infra204=http://${PREFIX}.204:2380
|
||||||
|
|
||||||
|
# Try to start in *new* cluster mode
|
||||||
/usr/local/bin/etcd \
|
/usr/local/bin/etcd \
|
||||||
--name ${NAME} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
@ -27,13 +29,12 @@ NAME=infra${NUM}
|
|||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||||
--advertise-client-urls http://${IP}:2379 \
|
--advertise-client-urls http://${IP}:2379 \
|
||||||
--initial-cluster-token etcd-cluster-1 \
|
--initial-cluster-token etcd-cluster-1 \
|
||||||
--initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \
|
--initial-cluster ${INIT_CLUSTER} \
|
||||||
--initial-cluster-state new
|
--initial-cluster-state new
|
||||||
|
|
||||||
echo "Returned $?"
|
[ $? -eq 0 ] && exit 0
|
||||||
|
|
||||||
# If we get here, joining a new cluster failed. Let's try joining an
|
# Joining the new cluster failed. Let's try joining an *existing* cluster
|
||||||
# existing cluster
|
|
||||||
/usr/local/bin/etcd \
|
/usr/local/bin/etcd \
|
||||||
--name ${NAME} \
|
--name ${NAME} \
|
||||||
--debug \
|
--debug \
|
||||||
@ -42,5 +43,5 @@ echo "Returned $?"
|
|||||||
--listen-peer-urls http://${IP}:2380 \
|
--listen-peer-urls http://${IP}:2380 \
|
||||||
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
--listen-client-urls http://${IP}:2379,http://127.0.0.1:2379 \
|
||||||
--advertise-client-urls http://${IP}:2379 \
|
--advertise-client-urls http://${IP}:2379 \
|
||||||
--initial-cluster infra200=http://${PREFIX}.200:2380,infra201=http://${PREFIX}.201:2380,infra202=http://${PREFIX}.202:2380 \
|
--initial-cluster ${INIT_CLUSTER} \
|
||||||
--initial-cluster-state existing
|
--initial-cluster-state existing
|
||||||
|
@ -20,7 +20,7 @@ daemon:
|
|||||||
oomScoreAdj: -800
|
oomScoreAdj: -800
|
||||||
readonly: true
|
readonly: true
|
||||||
- name: dhcpcd
|
- name: dhcpcd
|
||||||
image: "mobylinux/dhcpcd:d01a17d211218f289e2bac601bfe9787d4fabaf2"
|
image: "mobylinux/dhcpcd:3eb32da7ff8051f61e0f18edd90dd0fbfcf148ea"
|
||||||
binds:
|
binds:
|
||||||
- /var:/var
|
- /var:/var
|
||||||
- /tmp/etc:/etc
|
- /tmp/etc:/etc
|
||||||
@ -41,7 +41,7 @@ daemon:
|
|||||||
net: host
|
net: host
|
||||||
outputs:
|
outputs:
|
||||||
- format: kernel+initrd
|
- format: kernel+initrd
|
||||||
- format: gce
|
# - format: gcp
|
||||||
project: docker4x
|
# project: docker4x
|
||||||
bucket: rolf
|
# bucket: rolf
|
||||||
replace: true
|
# replace: true
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"ID": "etcd",
|
"ID": "etcd.gcp",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"Allocation": {
|
"Allocation": {
|
||||||
"LogicalIDs": [
|
"LogicalIDs": [
|
||||||
"10.132.0.200",
|
"10.132.0.200",
|
||||||
"10.132.0.201",
|
"10.132.0.201",
|
||||||
"10.132.0.202"
|
"10.132.0.202",
|
||||||
|
"10.132.0.203",
|
||||||
|
"10.132.0.204"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Instance": {
|
"Instance": {
|
@ -5,7 +5,9 @@
|
|||||||
"LogicalIDs": [
|
"LogicalIDs": [
|
||||||
"192.168.65.200",
|
"192.168.65.200",
|
||||||
"192.168.65.201",
|
"192.168.65.201",
|
||||||
"192.168.65.202"
|
"192.168.65.202",
|
||||||
|
"192.168.65.203",
|
||||||
|
"192.168.65.204"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Instance": {
|
"Instance": {
|
||||||
|
18
projects/demo/etcd/start-infrakit.sh
Executable file
18
projects/demo/etcd/start-infrakit.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
# !/bin/sh
|
||||||
|
|
||||||
|
# Start the infrakit plugins, save their PID
|
||||||
|
|
||||||
|
INFRAKIT_HOME=~/.infrakit
|
||||||
|
IK_PLUGINS=$INFRAKIT_HOME/plugins
|
||||||
|
|
||||||
|
rm -rf $INFRAKIT_HOME
|
||||||
|
|
||||||
|
infrakit-flavor-vanilla &
|
||||||
|
infrakit-instance-hyperkit &
|
||||||
|
infrakit-instance-gcp --project docker4x --zone europe-west1-d &
|
||||||
|
|
||||||
|
# start the group plugin in the foreground. If it exits, it will take
|
||||||
|
# the others down as well.
|
||||||
|
infrakit-group-default
|
||||||
|
|
||||||
|
rm -rf $INFRAKIT_HOME
|
@ -14,7 +14,7 @@ system:
|
|||||||
readonly: true
|
readonly: true
|
||||||
daemon:
|
daemon:
|
||||||
- name: dhcpcd
|
- name: dhcpcd
|
||||||
image: "mobylinux/dhcpcd:d01a17d211218f289e2bac601bfe9787d4fabaf2"
|
image: "mobylinux/dhcpcd:3eb32da7ff8051f61e0f18edd90dd0fbfcf148ea"
|
||||||
binds:
|
binds:
|
||||||
- /var:/var
|
- /var:/var
|
||||||
- /tmp/etc:/etc
|
- /tmp/etc:/etc
|
||||||
|
Loading…
Reference in New Issue
Block a user