You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a complete refactoring of our testing, building and Image system:
- no `./buildImages.sh` anymore it's all happening with `make`
- all images built by make, make also knows the dependency of the images and build them in the correct order
- docker-compose does not build images anymore, it just references images that are build by make
- new naming of images: version numbers all in image name, not in image tag (`centos7-node6` instead of `centos7-node:6`)
- no minishift anymore, we're using `oc cluster up` which runs within Docker, it's faster!
- using Travis for CI, which can run multiple tests at the same time.
- read DEVELOPMENT.md and TESTS.md to learn more
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+25-20
Original file line number
Diff line number
Diff line change
@@ -8,51 +8,55 @@ Please check the [official Docs of Docker](https://docs.docker.com/engine/instal
8
8
9
9
## Start Services
10
10
11
-
1.clone this repo
11
+
1.Add `172.30.0.0/16` to insecure registries in Docker (see [here](https://docs.docker.com/registry/insecure/) how to do that). Also make sure that you give your Docker Host minimum 4 CPUs and 6GB Ram. Also check that nothing is running on localhost:80 and localhost:443, as OpenShift will use these ports to run.
12
12
13
-
2.build base images needed for testing
13
+
2.Pull existing images for faster building as we use Docker Layer Caching
14
14
15
15
```sh
16
-
./buildBaseImages.sh
16
+
make pull
17
17
```
18
18
19
-
3. start Lagoon Services
19
+
Important: Lagoon consists of a lot of Services and Docker Images, building and running them locally might not even be necessary.
20
+
We're using make (see the [Makefile](./Makefile)) in order to only build the needed Docker Images specifically for a part of Lagoon.
20
21
21
-
```sh
22
-
docker-compose up -d
23
-
```
22
+
All of it is based around tests. So if you like to only build the part that is needed to work on the Node.js deployment, you can run the tests with `make tests/node`, this will then setup (openshift, building images, services) all the needed stuff for the Node.js deployment part.
24
23
25
-
4. Follow the Services logs
24
+
If you would still like to build and start all services, go ahead:
25
+
26
+
2. Build images
26
27
27
28
```sh
28
-
docker-compose logs -f
29
+
make build
29
30
```
30
31
31
-
## Start & Test OpenShift
32
-
33
-
1. start OpenShift
32
+
3. start Lagoon Services
34
33
35
34
```sh
36
-
./startOpenShift.sh
35
+
make up
37
36
```
38
37
39
-
2. Add `https://docker-registry-default.192.168.77.100.nip.io:443` to insecure registries in Docker (see [here](https://docs.docker.com/registry/insecure/) how to do that).
38
+
4. Follow the Services logs
40
39
41
-
4. run tests
40
+
```sh
41
+
make logs
42
+
```
42
43
44
+
5. run tests (read [TESTS.md](./TESTS.m) to learn more about testing)
43
45
```sh
44
-
docker-compose run --rm tests ansible-playbook /ansible/tests/ALL.yaml
46
+
make tests
45
47
```
46
48
49
+
6. Look what happens in OpenShift: https://172.16.123.1:8443/console (developer/developer)
50
+
47
51
## Local Development
48
52
49
53
Most services are written in Node.js. As many of these services share similar Node code and Node Packages, we're using a new feature of yarn, called `yarn workspaces`. Yarn Workspaces needs a package.json in the projects root directory that defines the workspaces plus an `.yarnrc` that enables workspace mode.
50
54
51
-
The development of the services can happen directly within Docker. Each container for each service is setup in a way that it's source code is mounted into the running container. Node itself is watching the code via `nodemon` and restarts the node process automatically on a change.
55
+
The development of the services can happen directly within Docker. Each container for each service is setup in a way that it's source code is mounted into the running container (see [docker-compose.yml](./docker-compose.yml). Node itself is watching the code via `nodemon` and restarts the node process automatically on a change.
52
56
53
57
### lagoon-commons
54
58
55
-
The services not only share many node packages, but also share actual custom code. This code is within `node-packages/lagoon-commons` it will be automatically symlinked by yarn workspaces, plus the nodemon of the services is setup in a way that it also checks for changes in `node-packages` and will restart the node process automatically
59
+
The services not only share many node packages, but also share actual custom code. This code is within `node-packages/lagoon-commons` it will be automatically symlinked by yarn workspaces, plus the nodemon of the services is setup in a way that it also checks for changes in `node-packages` and will restart the node process automatically.
56
60
57
61
### Hiera
58
62
@@ -62,10 +66,11 @@ The API uses a puppet compatible yaml format to store it's data. On production t
62
66
63
67
**I can't build any docker image for any Node.js based service**
64
68
65
-
Build the latest base images via
69
+
Rebuild the images via
66
70
67
71
```sh
68
-
./buildBaseImages.sh
72
+
make clean
73
+
make build
69
74
```
70
75
71
76
**I get errors about missing node_modules content when I try to build / run a NodeJS based image**
0 commit comments