Closed lholmquist closed 6 years ago
So when i run this on openshift, i get an error during the "run" phase
Running as user uid=1000060000 gid=0(root) groups=0(root),1000060000
starting nginx server with daemon off
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/07/05 16:05:13 [emerg] 1#0: mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied)
damn you permission errors
@lholmquist I tried the following steps, but the s2i build failed.
$ git clone git@github.com:bucharest-gold/centos7-s2i-web-app.git
$ cd centos7-s2i-web-app
$ git checkout -b lholmquist-utter-fucking-chaos master
$ git pull https://github.com/lholmquist/centos7-s2i-web-app.git utter-fucking-chaos
$ npx create-react-app testapp
$ cd testapp
$ s2i build --pull-policy never . lholmquist/centos7-s2i-web-app:latest testapp
The failure log:
~/s/c/t/testapp (lholmquist-utter-fucking-chaos %)
s2i build --pull-policy never . lholmquist/centos7-s2i-web-app:latest testapp
Checking if image "lholmquist/centos7-s2i-web-app:latest" is available locally ...
Checking if image "lholmquist/centos7-s2i-web-app:latest" is available locally ...
---> Installing application source
---> 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
---> Installing dependencies
---> Using 'npm install'
npm info it worked if it ends with ok
npm info using npm@5.6.0
npm info using node@v10.2.1
npm info lifecycle testapp@0.1.0~preinstall: testapp@0.1.0
npm info linkStuff testapp@0.1.0
npm info lifecycle testapp@0.1.0~install: testapp@0.1.0
npm info lifecycle testapp@0.1.0~postinstall: testapp@0.1.0
npm info lifecycle testapp@0.1.0~prepublish: testapp@0.1.0
npm info lifecycle testapp@0.1.0~prepare: testapp@0.1.0
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
up to date in 7.953s
npm info ok
npm info it worked if it ends with ok
npm info using npm@5.6.0
npm info using node@v10.2.1
npm info lifecycle testapp@0.1.0~prebuild: testapp@0.1.0
npm info lifecycle testapp@0.1.0~build: testapp@0.1.0
> testapp@0.1.0 build /opt/app-root/src
> react-scripts build
internal/modules/cjs/loader.js:596
throw err;
^
Error: Cannot find module '../scripts/build'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.resolve (internal/modules/cjs/helpers.js:30:19)
at Object.<anonymous> (/opt/app-root/src/node_modules/.bin/react-scripts:28:25)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
npm info lifecycle testapp@0.1.0~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testapp@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testapp@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /opt/app-root/src/.npm/_logs/2018-07-05T17_27_39_760Z-debug.log
Build failed
ERROR: An error occurred: non-zero (13) exit code from lholmquist/centos7-s2i-web-app:latest
@lance interesting. was that all there was to your "npm install" section?
Yep. That's the full transcript. I tried doing a local npm install
first, just for kicks, but that didn't make a difference.
P.S. Don't forget to change the name to use the bucharestgold
namespace. :)
that is odd. It should install a whole lot of things
@lance i changed the namespace to use bucharestgold
. mind re-making and trying again?
@lholmquist same issue with your latest changes. I'll poke around a little bit and see if I can figure out what's going on.
I added some debug output (listing environment variables, and listing what's in node_modules
) and nothing is really jumping out at me. All of the packages are installed, and the node_modules/.bin/react-scripts build
script is running, but when it tries to resolve ../scripts/build
it doesn't for some reason.
@lance i think i'm in a place where we might be able to have an alpha version of this
mind giving it some eyes.
@lholmquist sure thing. Do you have some recommended test paths? E.g. new angular app, new react app, what else?
Run make first, to build the image, then
For a React App:
npx create-react-app my-app
cd my-app
s2i build --pull-policy never . bucharestgold/centos7-s2i-web-app:latest react-my-app
docker run -it -p 8080:8080 react-my-app
For Angular:
npx ng new my-angular-app
cd my-angular-app
s2i build --pull-policy never -e OUTPUT_DIR=dist . bucharestgold/centos7-s2i-web-app:latest angular-my-app
(this one i think takes a while)
docker run -it -p 8080:8080 angular-my-app
If you wanted to try on minishift, after making the image:
docker save bucharestgold/centos7-s2i-web-app:latest | (eval $(minishift docker-env) && docker load)
to get your image in minishift
npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --expose --build.env YARN_ENABLED=true --build.recreate
for react
npx nodeshift --strictSSL=false --dockerImage=lholmquist/centos7-s2i-web-app --expose --build.env OUTPUT_DIR=dist --build.recreate
for angular
i've added the save-artifact stuff back in. I think it works, just need to add the --incremental flag to the s2i build command and run it more than once
Perhaps we should also look into archiving any output directories. not sure if that helps with build time also, but it would be good to look into it
Perhaps we should also look into archiving any output directories. not sure if that helps with build time also, but it would be good to look into it
seems to me that if you restore artifacts and it includes build output, when you run another build that removes some content, it will actually still be there in the build directory. Probably not ideal if things are being removed for security purposes or anything like that.
@lance i updated the label in the Dockerfile, anything you see that is glaring
@lholmquist LGTM
So this is my first pass, there is a lot of clean up to do, but i think i got it working when running the s2i commands locally
I just ran make and it should create an image called
lholmquist/centos7-s2i-web-app
Testing with a new react app:
npx create-react-app my-app
assuming you are in the my-app directorys2i build --pull-policy never . lholmquist/centos7-s2i-web-app:latest react-my-app
docker run -it -p 8080:8080 react-my-app
The "hello world" react app should be running on
@lance @danbev @helio-frota want to give a try?