redhat-developer / odo-init-image

ODO v3 no loner users this image!!! (Container for ODO v2 to setup SupervisorD inside S2I builder image.)
Apache License 2.0
7 stars 27 forks source link

Enable yarn support for Node.js image #47

Closed cdrage closed 3 years ago

cdrage commented 4 years ago

Current situation:

Node.js images are have yarn support as enabled by passing in: YARN_ENABLED=true as an environment variable.

To replicate:

git clone https://github.com/yarnpkg/example-yarn-package
odo create nodejs
odo set --env YARN_ENABLED=true

See the resulting build:

odo push --show-log
...
---> Building your Node application from source
Current git config
url.https://github.com.insteadof=git@github.com:
url.https://.insteadof=ssh://
url.https://github.com.insteadof=ssh://git@github.com
---> Using 'yarn install' with YARN_ARGS
+ '[' '!' -z true ']'
+ echo '---> Using '\''yarn install'\'' with YARN_ARGS'
+ npx yarn install
npx: installed 1 in 1.319s
yarn install v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 11.89s.
+ echo '---> Fix permissions on app-root'
+ fix-permissions /opt/app-root
---> Fix permissions on app-root
+ '[' '!' -z /opt/app-root/src ']'
+ '[' -n /opt/app-root/src-backup ']'
+ '[' /tmp '!=' /opt/app-root/src ']'
+ '[' /opt/app-root/src '!=' /opt/app-root/src ']'
+ PV_MNT_PT=/opt/app-root
+ sed -i s/autostart=false/autostart=true/g /opt/app-root/conf/supervisor.conf
+ /opt/odo/bin/supervisord ctl stop run
run: stopped
+ /opt/odo/bin/supervisord ctl start run
run: started
 ✓  Building component [16s]
 ✓  Changes successfully pushed to component

In particular:

+ echo '---> Using '\''yarn install'\'' with YARN_ARGS'
+ npx yarn install
npx: installed 1 in 1.319s
yarn install v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

However.. you'll see that you'll be unable to access the application as odo tries to run npm and not npx serve. See: https://github.com/nodeshift/ubi8-s2i-web-app/blob/master/s2i/run#L13

Also see odo log:

...
Using Node.js version: v10.12.0
Environment: 
        DEV_MODE=true
        NODE_ENV=development
        DEBUG_PORT=5858
++ id
+ echo -e 'Running as user uid=1110280000(default) gid=0(root) groups=0(root),1110280000'
+ '[' true == true ']'
+ echo 'Launching via nodemon...'
+ exec npx nodemon --inspect=5858
Running as user uid=1110280000(default) gid=0(root) groups=0(root),1110280000
Launching via nodemon...
time="2019-12-12T16:38:28Z" level=debug msg="wait program exit" program=run 
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --inspect=5858 index.js`
Debugger listening on ws://127.0.0.1:5858/f1392acf-6b72-419e-8d84-10cfd39e11ff
For help, see: https://nodejs.org/en/docs/inspector
[nodemon] clean exit - waiting for changes before restart

Proposal:

openshift-bot commented 4 years ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

openshift-bot commented 3 years ago

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

openshift-bot commented 3 years ago

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

openshift-ci-robot commented 3 years ago

@openshift-bot: Closing this issue.

In response to [this](https://github.com/openshift/odo-init-image/issues/47#issuecomment-732423690): >Rotten issues close after 30d of inactivity. > >Reopen the issue by commenting `/reopen`. >Mark the issue as fresh by commenting `/remove-lifecycle rotten`. >Exclude this issue from closing again by commenting `/lifecycle frozen`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.