Skip to content

Commit 67869c3

Browse files
author
Carlos Bautista
committed
Merge pull request #42 from cbautista1002/docker_compose_for_test
Create prod and test env docker compose yaml files; Update readme
2 parents 8803b14 + 17470b5 commit 67869c3

4 files changed

Lines changed: 132 additions & 43 deletions

File tree

README.md

Lines changed: 68 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,71 @@ with Alpine Linux. The main application container has a LAMP stack of:
1212
Build status on CircleCI (master branch): [![Circle CI](https://circleci.com/gh/ISEexchange/tacstack/tree/master.svg?style=svg&circle-token=373b7a10221a0403c993da96c45ba15ef225e932)](https://circleci.com/gh/ISEexchange/tacstack/tree/master)
1313

1414

15-
Build and Deploy locally with docker-compose
15+
How to Launch a Production System
1616
-------------
1717

18-
docker-compose will provide a fully functioning MAP system
19-
from scratch. It will build all of the required images and start up
20-
the containers. It will also take care of linking the data and app
21-
containers and will provide ports for you to use. Use this to create
22-
either a test environment or a production environment. To get started,
23-
clone this git repo, then run:
18+
Download this repo so you can use docker-compose files:
19+
20+
git clone https://github.com/ISEexchange/tacstack.git
21+
cd tacstack
22+
23+
You first need to get the container images from quay.io (the
24+
repo in the cloud where we store our build images):
25+
26+
docker-compose -f docker-compose-common.yml pull
27+
28+
Now start up the containers for a production system. This
29+
basically means that the ports will be pre-selected:
30+
31+
docker-compose -f docker-compose-prod.yml up -d
32+
33+
34+
How to Launch a Test Environment
35+
-------------
36+
37+
Pretty much the same as above except the docker-compose
38+
up command will be different:
39+
40+
docker-compose -f docker-compose-testenv.yml -p mytestenv up -d
41+
42+
Output:
2443

25-
docker-compose up -d
44+
Creating mytestenv_mysqldatavoltestenv_1...
45+
Creating mytestenv_ftpdatavoltestenv_1...
46+
Creating mytestenv_mapapptestenv_1...
47+
Creating mytestenv_ftpapptestenv_1...
2648

27-
The `-d` will start the applications in the background.
49+
The `-p` is what will allow you to have your own set
50+
of containers, independent from any other.
2851

29-
The ports for the internal applications will be randomly
52+
53+
docker-compose Notes
54+
-------------
55+
56+
docker-compose will provide a fully functioning system of containers
57+
from scratch. It will pull all of the required images and start up
58+
the containers. It will also take care of linking the data and app
59+
containers and will provide ports for you to use. Use docker-compose
60+
to create either a test environment or a production environment.
61+
62+
The `-d` in the `docker-compose up` command will start the
63+
containers/services in the background.
64+
65+
The ports for the test environment containers will be randomly
3066
selected. To find them, run:
3167

32-
docker-compose ps
68+
docker-compose -f docker-compose-testenv.yml ps
3369

34-
The ports will be listed under the mapapp container.
70+
Or
71+
72+
docker-compose -f docker-compose-testenv.yml -p mytestenv port mapapptestenv 22
3573

3674
There are four services in this system that docker-compose will bring up:
3775

38-
mapapp
39-
ftpapp
40-
mysqldatavol
41-
ftpdatavol
76+
mapapp[prod|testenv]
77+
ftpapp[prod|testenv]
78+
mysqldatavol[prod|testenv]
79+
ftpdatavol[prod|testenv]
4280

4381
For more information on docker-compose:
4482
https://docs.docker.com/compose/
@@ -49,11 +87,10 @@ Build on CircleCI
4987

5088
Open a pull request on Github.
5189
This triggers a build in CircleCI.
52-
At the moment, this will only build the main docker application.
53-
docker-compose integration with CircleCI coming soon.
90+
Dockerfiles will be built and completed docker images will be pushed to quay.io.
5491

5592

56-
Pull an already-built image
93+
Pull an Already-Built Image
5794
---------------------------
5895

5996
If you want the latest build of master branch:
@@ -72,7 +109,7 @@ If you want the version from your pull request:
72109
docker pull quay.io/iseexchange/tacstack:${handle}_pull_${number}
73110

74111

75-
Build locally with docker
112+
Build Locally With Docker
76113
-------------
77114

78115
To build the main application container, clone this git
@@ -87,21 +124,20 @@ Manual Deployment
87124
Follow these instructions if you are not using docker-compose.
88125
For a live TAC application, run:
89126

90-
```
91-
docker run -d -p 2222:22 -p 80:80 quay.io/iseexchange/tacstack
92-
```
127+
docker run -d quay.io/iseexchange/tacstack_ftpdata:latest --name FTPData
128+
docker run -d jumanjiman/dropbox:latest
129+
docker run -d quay.io/iseexchange/tacstack_mysqldata:latest --name MySQLData
130+
docker run -d -p 18922:22 -p 80:80 -p 18906:3306 -p 18900:18900 -p 18901:18901 --name MAPApp --volumes-from MySQLData --volumes-from FTPData quay.io/iseexchange/tacstack
93131

94132
For an individual test environment, run:
95133

96-
```
97-
CID=$(docker run -d -P quay.io/iseexchange/tacstack)
134+
CID=$(docker run -d -P quay.io/iseexchange/tacstack)
98135

99-
# Find the port on which sshd is running.
100-
docker port $CID 22
136+
# Find the port on which sshd is running.
137+
docker port $CID 22
101138

102-
# Find the port on which apache is running.
103-
docker port $CID 80
104-
```
139+
# Find the port on which apache is running.
140+
docker port $CID 80
105141

106142

107143
Troubleshooting
@@ -112,8 +148,10 @@ Troubleshooting
112148
```bash
113149
# Commands for docker-compose:
114150
# List active and exited containers.
151+
docker-compose -f docker-compose-testenv.yml -p mytestenv ps
115152
docker-compose ps
116153
# Follow logs from a container.
154+
docker-compose -f docker-compose-testenv.yml -p mytestenv logs
117155
docker-compose logs <service-name>
118156

119157
# Commands for docker:
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
mapapp:
22
image: quay.io/iseexchange/tacstack:latest
33
command: supervisord -n
4-
ports:
5-
- "18922:22"
6-
- "80:80"
7-
- "18906:3306"
8-
- "18900:18900"
9-
- "18901:18901"
10-
volumes_from:
11-
- mysqldatavol
12-
- ftpdatavol
134

145
ftpapp:
156
image: jumanjiman/dropbox
16-
ports:
17-
- "21:21"
18-
volumes_from:
19-
- ftpdatavol
207

218
mysqldatavol:
229
image: quay.io/iseexchange/tacstack_mysqldata:latest

docker-compose-prod.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
mapappprod:
2+
extends:
3+
file: docker-compose-common.yml
4+
service: mapapp
5+
ports:
6+
- "18922:22"
7+
- "80:80"
8+
- "18906:3306"
9+
- "18900:18900"
10+
- "18901:18901"
11+
volumes_from:
12+
- mysqldatavolprod
13+
- ftpdatavolprod
14+
15+
ftpappprod:
16+
extends:
17+
file: docker-compose-common.yml
18+
service: ftpapp
19+
ports:
20+
- "21:21"
21+
volumes_from:
22+
- ftpdatavolprod
23+
24+
mysqldatavolprod:
25+
extends:
26+
file: docker-compose-common.yml
27+
service: mysqldatavol
28+
29+
ftpdatavolprod:
30+
extends:
31+
file: docker-compose-common.yml
32+
service: ftpdatavol

docker-compose-testenv.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
mapapptestenv:
2+
extends:
3+
file: docker-compose-common.yml
4+
service: mapapp
5+
ports:
6+
- "22"
7+
- "80"
8+
- "3306"
9+
- "18900"
10+
- "18901"
11+
volumes_from:
12+
- mysqldatavoltestenv
13+
- ftpdatavoltestenv
14+
15+
ftpapptestenv:
16+
extends:
17+
file: docker-compose-common.yml
18+
service: ftpapp
19+
ports:
20+
- "21"
21+
volumes_from:
22+
- ftpdatavoltestenv
23+
24+
mysqldatavoltestenv:
25+
extends:
26+
file: docker-compose-common.yml
27+
service: mysqldatavol
28+
29+
ftpdatavoltestenv:
30+
extends:
31+
file: docker-compose-common.yml
32+
service: ftpdatavol

0 commit comments

Comments
 (0)