Skip to content

Commit fca2bab

Browse files
committed
optional x64 for manage node
1 parent 19f2490 commit fca2bab

File tree

6 files changed

+86
-1
lines changed

6 files changed

+86
-1
lines changed

images/consul_x64/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update && apt-get -qy install \
4+
wget unzip
5+
WORKDIR /root/
6+
RUN wget \
7+
https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_linux_amd64.zip
8+
RUN mkdir /data
9+
RUN mkdir /ui
10+
RUN unzip consul*.zip -d /usr/local/bin/
11+
12+
RUN consul version
13+
14+
EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 53/udp
15+
16+
VOLUME ["/data"]
17+
ADD ./config /config/
18+
19+
ENV DNS_RESOLVES consul
20+
ENV DNS_PORT 8600
21+
22+
ENTRYPOINT ["/usr/local/bin/consul", "agent", "-config-dir=/config"]

images/consul_x64/build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker build -t alexellis2/consul .
4+

images/consul_x64/config/agent.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"client_addr": "0.0.0.0",
3+
"bootstrap": true,
4+
"server": true,
5+
"ui_dir" : "/ui",
6+
"data_dir": "/data",
7+
"leave_on_terminate": true,
8+
"dns_config": {
9+
"allow_stale": true,
10+
"max_stale": "1s"
11+
}
12+
}

script/auto_join_swarm.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#!/bin/bash
22

3+
# Usage: auto_join_swarm.sh <consul_ip:port>
4+
# Default: auto_join_swarm.sh 192.168.0.200:8500
5+
6+
export consul_addr=192.168.0.200:8500
7+
8+
if [ ! -z $1 ]; then
9+
export consul_addr=$1:8500
10+
fi
11+
12+
echo "Using consul: $consul_addr"
13+
314
export eth0_addr=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
415
export node_ip=$eth0_addr:2375
5-
export consul_addr=192.168.0.200:8500
616

717
echo "Removing old container"
818
docker rm -f join

script/manage_swarm_x64.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# This script is designed to be run on a 'regular' x64 machine
4+
# rather than a Raspberry PI itself.
5+
6+
export primary_node=35
7+
export manage_port=2376
8+
export swarm_ip=192.168.0.$primary_node
9+
export consul_addr=192.168.0.$primary_node:8500
10+
11+
export image_name=swarm
12+
13+
echo "Removing old manage_x64 container"
14+
docker rm -f manage_x64
15+
16+
echo "Starting new manage_x64 container"
17+
18+
echo "Using version: $swarm_version"
19+
export image=swarm
20+
21+
docker run -d -p 2376:2375 --name manage_x64 $image_name manage \
22+
consul://$consul_addr/swarm

script/start_consul_x64.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
echo "Attempting to remove existing container"
4+
5+
docker rm -f consul_x64
6+
echo "Starting new alexellis2/consul container"
7+
8+
docker run -d \
9+
--name consul_x64 \
10+
-p 8400:8400 -p 8500:8500 -p 8600:53/udp \
11+
-p 8301:8301 -p 8302:8302 \
12+
alexellis2/consul \
13+
-server -bootstrap
14+
15+
docker port consul_x64

0 commit comments

Comments
 (0)