File tree Expand file tree Collapse file tree 5 files changed +42
-2
lines changed Expand file tree Collapse file tree 5 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env node
2
+
3
+ /*
4
+ * A script that forwards port 9393 to 9339 to allow for attaching a debugger
5
+ * from outside of the docker image.
6
+ */
7
+
8
+ const net = require ( 'net' ) ;
9
+
10
+ net
11
+ . createServer ( ( from ) => {
12
+ try {
13
+ const to = net . createConnection ( {
14
+ host : 'localhost' ,
15
+ port : 9339 ,
16
+ } ) ;
17
+ const close = ( ) => {
18
+ to . destroy ( ) ;
19
+ from . destroy ( ) ;
20
+ } ;
21
+ from . pipe ( to ) ;
22
+ to . pipe ( from ) ;
23
+ to . on ( 'close' , close ) ;
24
+ to . on ( 'error' , close ) ;
25
+ to . on ( 'end' , close ) ;
26
+ from . on ( 'close' , close ) ;
27
+ from . on ( 'error' , close ) ;
28
+ from . on ( 'end' , close ) ;
29
+ } catch ( e ) {
30
+ console . log ( 'Unable to connect' ) ;
31
+ from . destroy ( ) ;
32
+ }
33
+ } )
34
+ . listen ( 9393 ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ services:
7
7
dockerfile : ./env/api/Dockerfile
8
8
expose :
9
9
- ' 5100'
10
+ - ' 9393'
11
+ ports :
12
+ - ' 9339:9393'
10
13
volumes :
11
14
- .:/srv/www
12
15
- ../hpc-api-core:/srv/hpc-api-core
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ if [ ! -d "node_modules" ]; then
7
7
npm install
8
8
fi
9
9
10
+ echo " ==> Starting port forwarding for debugger"
11
+ node bin/port-forward.js &
12
+
10
13
echo " ==> Waiting for postgres to start"
11
14
/wait
12
15
Original file line number Diff line number Diff line change 9
9
"check-types" : " tsc --noEmit" ,
10
10
"install-and-link" : " sh ./bin/install.sh" ,
11
11
"start" : " ts-node src/server.ts" ,
12
- "dev" : " ts-node-dev --transpile-only --no-notify src/server.ts" ,
12
+ "dev" : " ts-node-dev --inspect=127.0.0.1:9339 -- transpile-only --no-notify -- src/server.ts" ,
13
13
"prepare" : " husky install" ,
14
14
"lint-prettier" : " prettier -c ." ,
15
15
"lint-eslint" : " eslint --quiet ." ,
Original file line number Diff line number Diff line change 17
17
"strictPropertyInitialization" : false ,
18
18
"strict" : true
19
19
},
20
- "include" : [" src/**/*.ts" ],
20
+ "include" : [" src/**/*.ts" , " bin " ],
21
21
"exclude" : [" node_modules" ]
22
22
}
You can’t perform that action at this time.
0 commit comments