-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
159 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.11 | ||
FROM golang:1.12.1 | ||
MAINTAINER [email protected] | ||
|
||
RUN apt-get -y -q update && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '3.7' | ||
services: | ||
control: | ||
volumes: | ||
# Mounts $CHAOS_ROOT on host to /go/src/github.com/pingcap/chaos control container | ||
- ${CHAOS_ROOT}:/go/src/github.com/pingcap/chaos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
version: '2' | ||
version: '3.7' | ||
x-node: | ||
&default-node | ||
build: ./node | ||
env_file: ./secret/node.env | ||
privileged: true | ||
networks: | ||
- chaos | ||
|
||
services: | ||
control: | ||
container_name: chaos-control | ||
hostname: control | ||
build: ./control | ||
env_file: ./secret/control.env | ||
privileged: true | ||
links: | ||
- n1 | ||
- n2 | ||
- n3 | ||
- n4 | ||
- n5 | ||
node: | ||
container_name: chaos-node | ||
build: ./node | ||
env_file: ./secret/node.env | ||
privileged: true | ||
ports: | ||
- "8080" | ||
networks: | ||
- chaos | ||
n1: | ||
extends: node | ||
<< : *default-node | ||
container_name: chaos-n1 | ||
hostname: n1 | ||
n2: | ||
extends: node | ||
<< : *default-node | ||
container_name: chaos-n2 | ||
hostname: n2 | ||
n3: | ||
extends: node | ||
<< : *default-node | ||
container_name: chaos-n3 | ||
hostname: n3 | ||
n4: | ||
extends: node | ||
<< : *default-node | ||
container_name: chaos-n4 | ||
hostname: n4 | ||
n5: | ||
extends: node | ||
<< : *default-node | ||
container_name: chaos-n5 | ||
hostname: n5 | ||
|
||
networks: | ||
chaos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,34 @@ | ||
# FIXME: tutum/debian will be deprecated soon: https://github.com/tutumcloud/tutum-debian/blob/master/README.md | ||
FROM ethercflow/debian:jessie | ||
# Based on the deprecated `https://github.com/tutumcloud/tutum-debian` | ||
FROM debian:stretch | ||
|
||
RUN rm /etc/apt/apt.conf.d/docker-clean && apt-get update && apt-get install -y sudo net-tools wget sysvinit-core sysvinit sysvinit-utils curl vim man faketime unzip iptables iputils-ping logrotate && apt-get remove -y --purge --auto-remove systemd | ||
# Install packages | ||
RUN apt-get update && \ | ||
apt-get -y install \ | ||
dos2unix \ | ||
openssh-server \ | ||
pwgen \ | ||
&& \ | ||
mkdir -p /var/run/sshd && \ | ||
sed -i "s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config && \ | ||
sed -i "s/PermitRootLogin without-password/PermitRootLogin yes/g" /etc/ssh/sshd_config | ||
|
||
ENV AUTHORIZED_KEYS **None** | ||
|
||
ADD run.sh /run.sh | ||
RUN dos2unix /run.sh \ | ||
&& chmod +x /*.sh | ||
|
||
RUN apt-get update | ||
RUN apt install -y apt-transport-https | ||
RUN apt install -y software-properties-common | ||
|
||
RUN rm /etc/apt/apt.conf.d/docker-clean && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
sudo net-tools wget \ | ||
curl vim man faketime unzip less \ | ||
iptables iputils-ping logrotate && \ | ||
apt-get remove -y --purge --auto-remove systemd | ||
|
||
EXPOSE 22 | ||
CMD ["/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
if [ "${AUTHORIZED_KEYS}" != "**None**" ]; then | ||
echo "=> Found authorized keys" | ||
mkdir -p /root/.ssh | ||
chmod 700 /root/.ssh | ||
touch /root/.ssh/authorized_keys | ||
chmod 600 /root/.ssh/authorized_keys | ||
IFS=$'\n' | ||
arr=$(echo ${AUTHORIZED_KEYS} | tr "," "\n") | ||
for x in $arr | ||
do | ||
x=$(echo $x |sed -e 's/^ *//' -e 's/ *$//') | ||
cat /root/.ssh/authorized_keys | grep "$x" >/dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "=> Adding public key to /root/.ssh/authorized_keys: $x" | ||
echo "$x" >> /root/.ssh/authorized_keys | ||
fi | ||
done | ||
fi | ||
|
||
exec /usr/sbin/sshd -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters