Compare commits

..

19 Commits

Author SHA1 Message Date
Jerome Petazzoni
edf3aeb9c4 Fix LISA reference 2016-01-26 10:34:07 -08:00
Jerome Petazzoni
e16c391deb Good to go! 2016-01-22 14:29:37 -08:00
Jérôme Petazzoni
1a486a2f95 Minor fixes 2016-01-21 18:06:30 -08:00
Jerome Petazzoni
962737ffa2 Update for SCALE; add support for multi-host networking 2016-01-21 16:44:34 -08:00
Jérôme Petazzoni
076d471a1d Add LICENSE (closes #5) 2015-12-26 20:22:46 +01:00
Jerome Petazzoni
ee2f8ef02e Fixes after LISA 2015-11-29 14:13:52 -08:00
Jerome Petazzoni
bc40a77b2b Update deployment script for Docker Machine 2015-11-23 08:44:13 -08:00
Jerome Petazzoni
f532c99c68 Merge branch 'master' of github.com:jpetazzo/orchestration-workshop 2015-11-10 04:01:00 -08:00
Jerome Petazzoni
9cb8e60e26 Changes for LISA 2015-11-10 04:00:54 -08:00
Jérôme Petazzoni
49d25f19da Merge pull request #4 from clkao/master
Stop docker from complaining about ambiguous volume mapping
2015-10-15 08:41:46 -07:00
Chia-liang Kao
1c170bedb7 Stop docker from complaining about ambiguous volume mapping 2015-10-15 13:31:52 +08:00
Jerome Petazzoni
33d29248bb Allow to use COMPOSE_FILE env var in scripts 2015-10-05 08:50:48 -07:00
Jerome Petazzoni
ecc5a3eafe Fix permissions 2015-10-04 20:33:17 -07:00
Jerome Petazzoni
65c96296cb Add YAML fixup helper 2015-10-04 19:50:15 -07:00
Jerome Petazzoni
49c17df2fd Change YAML output to work around go-gypsy 2015-10-04 13:36:42 -07:00
Jerome Petazzoni
10b3a9c4e0 Style labels 2015-10-03 16:13:42 -07:00
Jerome Petazzoni
eb864d6719 Fix typos and add some extra content 2015-09-28 11:01:07 -07:00
Jerome Petazzoni
b2fc2827f2 Big update for LISA 2015-09-27 22:10:32 -07:00
Jerome Petazzoni
8e5af7b964 Add slides URL to printed cards 2015-09-27 12:58:13 -07:00
14 changed files with 1725 additions and 370 deletions

13
LICENSE Normal file
View 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.

View File

@@ -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))

View 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("."))

View 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("."))

View File

@@ -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
View 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

View 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)

View File

@@ -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()

View File

@@ -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"

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

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