mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-03-03 09:50:26 +00:00
Compare commits
19 Commits
2015-09-24
...
2016-01-22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edf3aeb9c4 | ||
|
|
e16c391deb | ||
|
|
1a486a2f95 | ||
|
|
962737ffa2 | ||
|
|
076d471a1d | ||
|
|
ee2f8ef02e | ||
|
|
bc40a77b2b | ||
|
|
f532c99c68 | ||
|
|
9cb8e60e26 | ||
|
|
49d25f19da | ||
|
|
1c170bedb7 | ||
|
|
33d29248bb | ||
|
|
ecc5a3eafe | ||
|
|
65c96296cb | ||
|
|
49c17df2fd | ||
|
|
10b3a9c4e0 | ||
|
|
eb864d6719 | ||
|
|
b2fc2827f2 | ||
|
|
8e5af7b964 |
13
LICENSE
Normal file
13
LICENSE
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2015 Jérôme Petazzoni
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -63,6 +63,7 @@ for service_name, popen_object in push_operations.items():
|
||||
|
||||
# Write the new docker-compose.yml file.
|
||||
with open(output_file, "w") as f:
|
||||
yaml.safe_dump(stack, f)
|
||||
yaml.safe_dump(stack, f, default_flow_style=False)
|
||||
|
||||
print("Wrote new compose file: {}".format(output_file))
|
||||
print("Wrote new compose file.")
|
||||
print("COMPOSE_FILE={}".format(output_file))
|
||||
|
||||
@@ -5,7 +5,8 @@ import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
stack = yaml.load(open(sys.argv[1]))
|
||||
compose_file = os.environ.get("COMPOSE_FILE") or sys.argv[1]
|
||||
stack = yaml.load(open(compose_file))
|
||||
|
||||
project_name = os.path.basename(os.path.realpath("."))
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
stack = yaml.load(open(sys.argv[1]))
|
||||
compose_file = os.environ.get("COMPOSE_FILE") or sys.argv[1]
|
||||
stack = yaml.load(open(compose_file))
|
||||
|
||||
project_name = os.path.basename(os.path.realpath("."))
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ var points = []
|
||||
var graph = null;
|
||||
|
||||
function refresh () {
|
||||
var content = $("#content");
|
||||
$.ajax({ url: "json" }).done(function (data) {
|
||||
series.push(data);
|
||||
while (series.length < 250) {
|
||||
@@ -70,12 +69,17 @@ function refresh () {
|
||||
yAxis.render();
|
||||
} else {
|
||||
graph.update();
|
||||
$("text").css({
|
||||
"font-size": "15px",
|
||||
"font-weight": "normal",
|
||||
"opacity": 0.5,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setInterval(refresh, 2000);
|
||||
setInterval(refresh, 1000);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
@@ -84,7 +88,6 @@ $(function () {
|
||||
<h1>DockerCoin Miner WebUI</h1>
|
||||
|
||||
<div id="graph"></div>
|
||||
<div id="content">Current speed: N/A</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
16
fixup-yaml.sh
Executable file
16
fixup-yaml.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Some tools will choke on the YAML files generated by PyYAML;
|
||||
# in particular on a section like this one:
|
||||
#
|
||||
# service:
|
||||
# ports:
|
||||
# - 8000:5000
|
||||
#
|
||||
# This script adds two spaces in front of the dash in those files.
|
||||
# Warning: it is a hack, and probably won't work on some YAML files.
|
||||
[ -f "$COMPOSE_FILE" ] || {
|
||||
echo "Cannot find COMPOSE_FILE"
|
||||
exit 1
|
||||
}
|
||||
sed -i 's/^ -/ -/' $COMPOSE_FILE
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
# You can specify 1 or 2 parameters:
|
||||
# You can specify up to 2 parameters:
|
||||
# - with 0 parameter, we will look for the COMPOSE_FILE env var
|
||||
# - with 1 parameter, the same file will be used for in and out
|
||||
# - with 2 parameters, the 1st is the input, the 2nd the output
|
||||
input_file = sys.argv[1]
|
||||
output_file = sys.argv[-1]
|
||||
if len(sys.argv)==1:
|
||||
if "COMPOSE_FILE" not in os.environ:
|
||||
print("Please specify 1 or 2 file names, or set COMPOSE_FILE.")
|
||||
sys.exit(1)
|
||||
compose_file = os.environ["COMPOSE_FILE"]
|
||||
if compose_file == "docker-compose.yml":
|
||||
print("Refusing to operate directly on docker-compose.yml.")
|
||||
print("Specify it on the command-line if that's what you want.")
|
||||
sys.exit(1)
|
||||
input_file, output_file = compose_file, compose_file
|
||||
elif len(sys.argv)==2:
|
||||
input_file, output_file = sys.argv[1], sys.argv[1]
|
||||
elif len(sys.argv)==3:
|
||||
input_file, output_file = sys.argv[1], sys.argv[2]
|
||||
else:
|
||||
print("Too many arguments. Please specify up to 2 file names.")
|
||||
sys.exit(1)
|
||||
|
||||
stack = yaml.load(open(input_file))
|
||||
|
||||
@@ -41,5 +58,5 @@ for service_name, service in stack.items():
|
||||
if service_name in ports:
|
||||
service["ports"] = [ ports[service_name] ]
|
||||
|
||||
yaml.safe_dump(stack, open(output_file, "w"))
|
||||
yaml.safe_dump(stack, open(output_file, "w"), default_flow_style=False)
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
SETTINGS_BASIC = dict(
|
||||
clustersize=1,
|
||||
pagesize=12,
|
||||
pagesize=15,
|
||||
blurb="<p>Here is the connection information to your very own "
|
||||
"VM for this intro to Docker workshop. You can connect "
|
||||
"to the VM using your SSH client.</p>\n"
|
||||
"<p>Your VM is reachable on the following address:</p>\n",
|
||||
prettify=lambda x: x,
|
||||
footer="<p>You can find the last version of the slides on "
|
||||
"http://view.dckr.info/.</p>",
|
||||
)
|
||||
|
||||
SETTINGS_ADVANCED = dict(
|
||||
@@ -15,10 +17,12 @@ SETTINGS_ADVANCED = dict(
|
||||
pagesize=12,
|
||||
blurb="<p>Here is the connection information to your very own "
|
||||
"cluster for this orchestration workshop. You can connect "
|
||||
"to each VM with your SSH client.</p>\n"
|
||||
"to each VM with any SSH client.</p>\n"
|
||||
"<p>Your machines are:<ul>\n",
|
||||
prettify=lambda l: [ "node%d: %s"%(i+1, s)
|
||||
for (i, s) in zip(range(len(l)), l) ],
|
||||
footer="<p>You can find the last version of the slides on "
|
||||
"http://view.dckr.info/.</p>"
|
||||
)
|
||||
|
||||
SETTINGS = SETTINGS_ADVANCED
|
||||
@@ -44,14 +48,17 @@ html.write("""
|
||||
div {
|
||||
float:left;
|
||||
border: 1px solid black;
|
||||
width: 25%;
|
||||
padding: 4%;
|
||||
width: 28%;
|
||||
padding: 4% 2.5% 2.5% 2.5%;
|
||||
font-size: x-small;
|
||||
background-image: url("docker-nb.svg");
|
||||
background-size: 15%;
|
||||
background-position-x: 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
p {
|
||||
margin: 0.5em 0 0.5em 0;
|
||||
}
|
||||
.pagebreak {
|
||||
page-break-before: always;
|
||||
clear: both;
|
||||
@@ -69,6 +76,7 @@ for i, cluster in enumerate(clusters):
|
||||
html.write("<li>%s</li>\n"%s)
|
||||
html.write("</ul></p>")
|
||||
html.write("<p>login=docker password=training</p>\n")
|
||||
html.write(footer)
|
||||
html.write("</div>")
|
||||
html.close()
|
||||
|
||||
|
||||
@@ -26,16 +26,19 @@ while addresses:
|
||||
os.system("[ -f .ssh/id_rsa ] || ssh-keygen -t rsa -f .ssh/id_rsa -P ''")
|
||||
|
||||
|
||||
os.system("sudo apt-get -qy install python-setuptools pssh apache2-utils httping htop")
|
||||
os.system("sudo apt-get remove -y --purge dnsmasq-base")
|
||||
os.system("sudo apt-get -qy install python-setuptools pssh apache2-utils httping htop unzip")
|
||||
os.system("sudo easy_install pip")
|
||||
os.system("sudo pip install docker-compose==1.4.1")
|
||||
os.system("docker pull swarm:0.4.0")
|
||||
os.system("docker tag -f swarm:0.4.0 swarm")
|
||||
os.system("sudo curl -L https://github.com/docker/machine/releases/download/v0.4.1/docker-machine_linux-amd64 -o /usr/local/bin/docker-machine")
|
||||
os.system("sudo chmod +x /usr/local/bin/docker-machine")
|
||||
os.system("sudo pip install docker-compose==1.5.2")
|
||||
os.system("docker pull swarm:1.0.1")
|
||||
os.system("docker tag -f swarm:1.0.1 swarm")
|
||||
#os.system("sudo curl -L https://github.com/docker/machine/releases/download/v0.5.6/docker-machine_linux-amd64.zip -o /tmp/docker-machine.zip")
|
||||
#os.system("cd /usr/local/bin ; sudo unzip /tmp/docker-machine.zip")
|
||||
os.system("sudo curl -L https://github.com/docker/machine/releases/download/v0.5.6/docker-machine_linux-amd64 -o /usr/local/bin/docker-machine")
|
||||
os.system("sudo chmod +x /usr/local/bin/docker-machine*")
|
||||
os.system("echo 1000000 | sudo tee /proc/sys/net/nf_conntrack_max")
|
||||
os.system("""sudo sed -i 's,^DOCKER_OPTS=.*,DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:55555",' /etc/default/docker""")
|
||||
os.system("sudo service docker restart")
|
||||
#os.system("""sudo sed -i 's,^DOCKER_OPTS=.*,DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:55555",' /etc/default/docker""")
|
||||
#os.system("sudo service docker restart")
|
||||
EOF
|
||||
pssh -t 300 -I "python /tmp/postprep.py >>/tmp/pp.out 2>>/tmp/pp.err" < ips.txt
|
||||
pssh "[ -f .ssh/id_rsa ] || scp -o StrictHostKeyChecking=no node1:.ssh/id_rsa* .ssh"
|
||||
|
||||
@@ -3,4 +3,4 @@ www:
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- "htdocs:/usr/share/nginx/html"
|
||||
- "./htdocs:/usr/share/nginx/html"
|
||||
|
||||
BIN
www/htdocs/delay-hasher.png
Normal file
BIN
www/htdocs/delay-hasher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
www/htdocs/delay-rng.png
Normal file
BIN
www/htdocs/delay-rng.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user