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
chore: enhance dockerized development environment (#977)
1. Add an option to control which PHP version is to be used in devenv
service via PHP env var passed at the time when dev-shell is started
(or any dev-* target is build).
2. Simplify `composer` and `go` install.
3. Fix `devenv` service image build for PHPs 7.2 and 7.3.
4. Apply `Dockerfile` best practices
Copy file name to clipboardExpand all lines: docs/dev_environment.md
+33-14Lines changed: 33 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,38 @@ The dockerized development environment prototype allows contributors to both dev
6
6
7
7
docker-compose spins up `mysql` and `redis` and other databases in separate containers.
8
8
9
-
Two environment variables to note:
10
-
`NEWRELIC_LICENSE_KEY` is required to run the integration tests and should be set to your NR license key.
11
-
If your collector isn’t the default (collector.newrelic.com), set the `NEWRELIC_COLLECTOR_HOST` to the appropriate value.
9
+
## Prerequisites
12
10
13
-
PHP_VER can also be set to vary the PHP version being used.
11
+
### 1. Docker Compose
14
12
15
-
Set all environment variables prior to running the development environment.
13
+
Dockerized development environment for the New Relic PHP Agent uses following Docker Compose services as a runtime platform. So you need `docker` with `docker compose` installed.
14
+
15
+
### 2. Environment variables
16
+
17
+
Dockerized development environment for the New Relic PHP Agent needs a valid license key available in `NEW_RELIC_LICENSE_KEY` environment variable.
18
+
This environment variable must be set prior to starting Dockerized development environment for the New Relic PHP Agent. The easiest way to set
19
+
`NEW_RELIC_LICENSE_KEY` environment variable is via `.env` file. Simply create `.env` file in the top level directory, and add definition
20
+
of `NEW_RELIC_LICENSE_KEY` environment variable there, e.g.:
21
+
```
22
+
NEW_RELIC_LICENSE_KEY=...
23
+
```
24
+
25
+
The second, optional environment variable, that controls PHP version in Dockerized development environment for the New Relic PHP Agent is `PHP`. `PHP` defaults to latest PHP supported by the agent.
26
+
This environment variable can be provided at the time when Dockerized development environment for the New Relic PHP Agent is started, e.g.:
27
+
```
28
+
make dev-shell PHP=8.2
29
+
```
16
30
17
31
## Options for using the environment
18
32
19
-
## With a shell environment
33
+
### With a shell environment
34
+
35
+
To start the dev environment type `make dev-shell`. This will spin up `devenv` service in `agent-devenv` container, with:
36
+
- latest PHP supported by the agent (this can be overriden with `PHP` environment variable like this: `make dev-shell PHP=8.2`)
37
+
- all the tools needed to build the agent
38
+
- all the tools needed to run unit tests
39
+
- all the tools and supporting services to run integration tests
20
40
21
-
To start the dev environment type `make dev-shell`. This will create a set of docker containers.
22
41
A prompt will open and you’ll be able to compile and run all `make` commands right away with no additional setup (for example: `make -j4 all` or `make -j4 valgrind` or `make -j4 run_tests`).
23
42
24
43
After compiling the agent, the integration tests can be run using the `integration_runner`.
@@ -31,27 +50,27 @@ To end the session type `exit`. You can run `make dev-stop` to stop the docker-
31
50
32
51
In the shell, you can run all `make` commands as you normally would.
33
52
34
-
## Build only
53
+
###Build only
35
54
36
55
`make dev-build`
37
56
38
-
## Unit Tests only
57
+
###Unit Tests only
39
58
40
59
`make dev-unit tests`
41
60
42
-
## Integration Tests only
61
+
###Integration Tests only
43
62
44
63
`make dev-integration-tests`
45
64
46
-
## Build and test all
65
+
###Build and test all
47
66
48
67
`make dev-all`
49
68
50
-
## Stop all containers
69
+
###Stop all containers
51
70
52
71
`make dev-stop`
53
72
54
-
# Next steps and issues
73
+
##Next steps and issues
55
74
56
-
## There is possibly some incompatibility with mysql in the main build container as one of the mysql unit tests fails. Unless this is resolved, It might make sense at a future point to have the integration tests run from a different container than the build container.
75
+
###There is possibly some incompatibility with mysql in the main build container as one of the mysql unit tests fails. Unless this is resolved, It might make sense at a future point to have the integration tests run from a different container than the build container.
0 commit comments