Skip to content

Commit 671ce22

Browse files
committed
Merge pull request apache#22 from cloudsoft/docs
Adds docs (for internal developer use)
2 parents e9f052c + 479e41c commit 671ce22

1 file changed

Lines changed: 166 additions & 0 deletions

File tree

docs-internal/dev.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
### Setup
2+
3+
1. Run a bleeding-edge AMP (e.g. a very recent snapshot build)
4+
5+
2. Add each of the .bom files to the catalog (e.g. using a build of `br` from after 8th May):
6+
7+
for b in *.bom tests/*.bom ; do
8+
br add-catalog $b
9+
done
10+
11+
Or:
12+
13+
AMP_URL=http://127.0.0.1:8081
14+
AMP_USER=admin
15+
AMP_PASSWORD=pa55w0rd
16+
BOMS="ca.bom etcd.bom catalog.bom swarm.bom"
17+
BOMS="${BOMS} tests/common.tests.bom tests/docker.tests.bom tests/swarm.tests.bom "
18+
BOMS="${BOMS} tests/jclouds.tests.bom tests/swarm-endpoint.tests.bom tests/tests.bom"
19+
for i in ${BOMS}; do
20+
curl -u ${AMP_USER}:${AMP_PASSWORD} ${AMP_URL}/v1/catalog --data-binary @${i}
21+
done
22+
23+
24+
3. Add the location definition(s) to your test. For example, use the bluebox definitions
25+
that the QA framework uses (don't forget to run the VPN, and to deploy to CentOS 7).
26+
See:
27+
28+
- https://github.com/cloudsoft/blueprint-qa-seed/blob/master/locations/bluebox-singapore-centos7.bom
29+
- https://github.com/cloudsoft/cloudsoft/wiki/QA%20Framework
30+
- https://github.com/cloudsoft/cloudsoft/wiki/Blue-Box
31+
32+
br add-catalog https://raw.githubusercontent.com/cloudsoft/blueprint-qa-seed/master/locations/bluebox-singapore-centos7.bom?token=ANfNJ5kY9pvufckGUZZ3mzM4FlHq1D2Aks5XX93owA%3D%3D
33+
34+
35+
4. Delete the 1.0.0 version of the etcd entities from the catalog.
36+
(TODO: we don't replace it because snapshot versions (i.e. our 2.0.0-SNAPSHOT) does not take
37+
precedence over the 1.0.0 version).
38+
39+
40+
### Running tests
41+
42+
To run the suite of tests, use `tests.bom`. For example:
43+
44+
location:
45+
ibm-bluebox-sng-centos7-vpn
46+
services:
47+
- type: docker-and-swarm-engine-tests
48+
49+
50+
### Running as an end-user
51+
52+
#### Docker Engine
53+
54+
To deploy a simple Docker Engine:
55+
56+
name: Docker Engine
57+
location: ibm-bluebox-sng-centos7-vpn
58+
services:
59+
- type: docker-engine
60+
61+
Or a Docker Engine with a container:
62+
63+
name: Docker Engine with container
64+
location: ibm-bluebox-sng-centos7-vpn
65+
services:
66+
- type: docker-engine
67+
brooklyn.children:
68+
- type: docker-engine-container
69+
container: cloudsoft/centos:7
70+
71+
72+
To deploy a Docker Engine with TLS (which will also require a CA server):
73+
74+
name: Docker Engine with TLS
75+
location: ibm-bluebox-sng-centos7-vpn
76+
services:
77+
- type: ca-server
78+
id: ca-server
79+
name: "ca-server"
80+
- type: docker-engine-tls
81+
brooklyn.config:
82+
customize.latch: $brooklyn:entity("ca-server").attributeWhenReady("service.isUp")
83+
ca.request.root: $brooklyn:entity("ca-server").attributeWhenReady("main.uri")
84+
85+
86+
#### Docker Swarm
87+
88+
To deploy a Docker Swarm cluster:
89+
90+
name: Docker Swarm
91+
location: ibm-bluebox-sng-centos7-vpn
92+
services:
93+
- type: docker-swarm
94+
brooklyn.config:
95+
swarm.initial.size: 1
96+
etcd.initial.size: 1
97+
98+
99+
#### Deploying apps to Docker
100+
101+
To deploy to an entity to an existing Docker Swarm endpoint (first changing the path to the
102+
cert.pem and key.pem - see next section for how to get those files). If targeting a Docker
103+
Engine directly, use port 2376; if targeting swarm, use 3376:
104+
105+
name: SoftwareProcess on Docker
106+
location:
107+
jclouds:docker:
108+
endpoint: https://10.104.0.105:2376/
109+
identity: /Users/aled/.docker/.certs-from-server/cert.pem
110+
credential: /Users/aled/.docker/.certs-from-server/key.pem
111+
imageId: sha256:5670c22f2f46bfc7578447978fa7be62699d1e90ed88bf7e415ec96b2571ce0b
112+
loginUser: root
113+
loginUser.password: p4ssw0rd
114+
onbox.base.dir: /tmp
115+
services:
116+
- type: org.apache.brooklyn.entity.machine.MachineEntity
117+
brooklyn.config:
118+
onbox.base.dir.skipResolution: true
119+
sshMonitoring.enabled: false
120+
121+
Note you may need to first pull the image (depending how the Swarm cluster was provisioned):
122+
123+
docker -H ${swarm_endpoint} ${TLS_OPTIONS} pull cloudsoft/centos:7
124+
docker -H ${swarm_endpoint} ${TLS_OPTIONS} images --no-trunc
125+
126+
Warning: jclouds-docker is currently broken against docker-engine, but works against swarm (as of 8/6/16)
127+
https://github.com/jclouds/jclouds-labs/commit/7e55ad7971f94b19068cd8da32295d2ab5b9c18c
128+
added "Node" but this is not returned by docker-engine rest api when inspecting a container.
129+
130+
131+
### Credentials for Deploying to Docker Swarm
132+
133+
To deploy to a Docker Swarm endpoint, you'll need pem files for identity/credential. These can
134+
either be copied from one of the Docker Engine VMs, or can be generated from the certificate
135+
authority. The actual IP of the client doesn't matter.
136+
137+
To generate your own certificates from the CA server rest api that we wrote (note this is subject
138+
to deletion in a future release!):
139+
140+
# Create your certificates directory
141+
mkdir -p .certs
142+
143+
# Get yourself a certificate from the CA
144+
# You can use any IP; to find your IP use `ifconfig`
145+
own_ip=192.168.1.64
146+
ca=$(br app "Docker Swarm" ent ca-server sensor main.uri)
147+
echo ${ca}
148+
curl -X POST ${ca}/generate/${own_ip}
149+
curl ${ca}/cert/${own_ip}/ca.pem > .certs/ca.pem
150+
curl ${ca}/cert/${own_ip}/cert.pem > .certs/cert.pem
151+
curl ${ca}/cert/${own_ip}/key.pem > .certs/key.pem
152+
153+
To be able to execute `docker ...` commands locally:
154+
155+
# Set up TLS options to point at your certificates
156+
CERTS_DIR=${HOME}/.docker/.certs
157+
TLS_OPTIONS="--tlsverify --tlscacert=${CERTS_DIR}/ca.pem --tlscert=${CERTS_DIR}/cert.pem --tlskey=${CERTS_DIR}/key.pem"
158+
159+
# Check docker works
160+
swarm_endpoint=$(br app "Docker Swarm" ent "swarm-cluster" sensor swarm.url)
161+
echo ${swarm_endpoint}
162+
docker -H ${swarm_endpoint} ${TLS_OPTIONS} ps
163+
164+
# Run something, and check it is listed
165+
docker -H ${swarm_endpoint} ${TLS_OPTIONS} run hello-world
166+
docker -H ${swarm_endpoint} ${TLS_OPTIONS} ps -a

0 commit comments

Comments
 (0)