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
Copy file name to clipboardExpand all lines: README.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,9 @@ You can install additional dependencies by including a `package.json` file next
84
84
85
85
## Developing with the template
86
86
87
+
Livereload is enabled automatically when running in development mode. You can embed the template easily in a running mu.semte.ch stack by launching it in the docker-compose.yml with the correct links. If desired, the chrome inspecor can be attached during development, giving advanced javascript debugging features.
88
+
89
+
### Live reload
87
90
When developing, you can use the template image, mount the volume with your sources in `/app` and add a link to the database. Set the `NODE_ENV` environment variable to `development`. The service will live-reload on changes. You'll need to restart the container when you define additional dependencies in your `package.json`.
88
91
89
92
docker run --link virtuoso:database \
@@ -93,4 +96,49 @@ When developing, you can use the template image, mount the volume with your sour
93
96
--name my-js-test \
94
97
semtech/mu-javascript-template
95
98
99
+
### Develop in mu.semte.ch stack
100
+
When developing inside an existing mu.semte.ch stack, it is easiest to set the development mode and mount the sources directly. This makes it easy to setup links to the database and the dispatcher.
101
+
102
+
Optionally, you can publish the microservice on a different port, so you can access it directly without the dispatcher. In the example below, port 8888 is used to access the service directly. We set the path to our sources directly, ensuring we can develop the microservice in its original place.
103
+
104
+
yourMicroserviceName:
105
+
image: semtech/mu-javascript-template
106
+
ports:
107
+
- 8888:80
108
+
environment:
109
+
NODE_ENV: "development"
110
+
links:
111
+
- db:database
112
+
volumes:
113
+
- /absolute/path/to/your/sources/:/app/
114
+
115
+
### Attach the Chrome debugger
116
+
When running in development mode, you can attach the chrome debugger to your microservice and add breakpoints as you're used to. The chrome debugger requires port 9229 to be forwarded, and your service to run in development mode. After launching your service, open Google Chrome or Chromium, and visit [chrome://inspect/](chrome://inspect/).
117
+
118
+
Running through docker run, you could access the service as follows:
119
+
120
+
docker run --link virtuoso:database \
121
+
-v `pwd`:/app \
122
+
-p 8888:80 \
123
+
-p 9229:9229 \
124
+
-e NODE_ENV=development \
125
+
--name my-js-test \
126
+
semtech/mu-javascript-template
127
+
128
+
Now open Chromium, and visit [chrome://inspect/](chrome://inspect/). Once the service is launched, a remote target on localhost should pop up.
129
+
130
+
When running inside a mu.semte.ch stack, you could mount your sources and connect to known microservices as follows:
131
+
132
+
yourMicroserviceName:
133
+
image: semtech/mu-javascript-template
134
+
ports:
135
+
- 8888:80
136
+
- 9229:9229
137
+
environment:
138
+
NODE_ENV: "development"
139
+
links:
140
+
- db:database
141
+
volumes:
142
+
- /absolute/path/to/your/sources/:/app/
96
143
144
+
Now open Chromium, and visit [chrome://inspect/](chrome://inspect/). Once the service is launched, a remote target on localhost should pop up.
0 commit comments