ahwayakchih / openshift-nodebb

**CLOSED** HOWTO install NodeBB in the OpenShift cloud.
17 stars 9 forks source link

Git and RHC behavior changed. #24

Closed Kuchiriel closed 8 years ago

Kuchiriel commented 8 years ago

Hello, sorry for my first contact, I am kinda of autistic and I forget some conventions.

Explaining the troubles I had got:

It does not create a local copy of the app automatically. (It has managed to do only 1 time, and I dont know how)

So I cloned the OpenShift repo, after I had created it.

git pull --no-edit -s recursive -X theirs upstream v0.9.x

Does nothing, but: fatal: refusing to merge unrelated histories (Only happens if I clone)

So is git pull --no-edit -s recursive -X theirs openshift master

I have managed to continue, using: --allow-unrelated-histories

Anyway, I got this after:

Error: Cannot find module '/var/lib/openshift/57b8aae00c1e660839000182/app-root/runtime/repo//package.json'

Seens I had accidentaly deleted everything, by pushing an empty local rep, because of --alow-shit problem. So there is no package.json, I will restart everything and update and report things back. (This proved to be false later)

Edit: Reporting things back as I said, the workaround was deleting the app and dir, and trying again and again until finaly work. But it only worked in v9.x.x. The remaining I have explained in the comentary down below.

Thanks!

ahwayakchih commented 8 years ago

Thanks for the info. Is it RHC that does not pull from your openshift app repo, or git does not pull from nodebb repo?

As for the package.js error, i'm guessing it's missing when you/git hook tries to run npm install? We do read package.js in two places (1, 2), but those should throw different errors (if any).

Unfortunately i do not have much time for this project at the moment, so all help is welcome :).

Kuchiriel commented 8 years ago

Hello!

It was pulling both, I think package.json didn't reach the openshift because of some connection issue.

I have deleted both dir and rhc app, and after a few tries of I have managed to deploy v9.x.x.

But everytime I have tried with v1.x.x , I had a lot of different problems.

Then I found an easiest way to deploy the project on OpenShift, as described here: https://github.com/icflorescu/openshift-cartridge-nodejs

rhc app create appname \
  https://raw.githubusercontent.com/icflorescu/openshift-cartridge-nodejs/master/metadata/manifest.yml \
  --from-code=https://github.com/NodeBB/NodeBB/.git

So I switched back to this repository, after I successfully done the command above, then I added the database cartridge and so on.

But...

This message never came.

-============================================-.
    .  Setup Finished.
    .
    .  New administrator user has been created:
    .
    .    email   : youremail@example.com
    .    login   : nodebb
    .    password: 9D7u-KAtN-76Kz-TCyX
    .
    .  Please wait for NodeBB to start.
    .
    .  WARNING: Be sure to change admin password
    .           after first log in!
    ^-============================================-^

The workaround was authenticating in the database for being capable of retrieving the user id, and pasting after http://url/reset/{uid}, to reset admin password.

I will try to do some testing, if everything works fine I will communicate you and maybe send a PR.

Thanks for the project!
ahwayakchih commented 8 years ago

Thanks for testing!

Did you use OpenShift v2 account, or their new "next gen" 30-day account? Guide was made and tested with v2, but i guess it's time to prepare for v3.

Update: if there was no final message, was there any error message? Maybe NodeBB was installed with app creation, and so our scripts could not find installation output to know if everything went ok or not. I wonder if it wouldn't be safer to use different repo for initial app creation (--from-code).

Kuchiriel commented 8 years ago

It was v2.

Yes I think the default behavior of app creation was changed, so it was suppressing the output pipe of the scripts.

Only thing that appear is just the default OpenShift message, if was error, then it shows error, if dont, nothing relevant appear.

It will be good if there was choices, like one kind of tuto for v2 and another for v3, both working with any version of NodeBB. I have only weekends to do testing, but with time I will share more of my experience in this.

Kuchiriel commented 8 years ago

--allow-unrelated-histories did the magic

NodeBB Setup Completed. Run './nodebb start' to manually start your NodeBB server. remote: CLIENT_RESULT: remote: CLIENT_RESULT: .-============================================-. remote: CLIENT_RESULT: . Setup finished. remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . New administrator user has been created: remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . email : unlabeled.technologies@cyberservices.com remote: CLIENT_RESULT: . login : untech remote: CLIENT_RESULT: . password: ------ remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . Please wait for NodeBB to start. remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . WARNING: Be sure to change admin password remote: CLIENT_RESULT: . after first log in! remote: CLIENT_RESULT: ^-============================================-^ remote: CLIENT_RESULT: remote: CLIENT_MESSAGE: Starting Node.js application... remote: CLIENT_RESULT: Node.js application started. remote: tail: cannot open /var/lib/openshift/57c1130b0c1e663b8600000c/app-root/runtime/repo/logs/output.log' for reading: No such file or directory remote: remote: tail:/var/lib/openshift/57c1130b0c1e663b8600000c/app-root/runtime/repo/logs/output.log' has become accessible remote: remote: CLIENT_RESULT: remote: CLIENT_RESULT: .-============================================-. remote: CLIENT_RESULT: . NodeBB is ready. remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . You can visit it at: remote: CLIENT_RESULT: . https://untech-cells.rhcloud.com remote: CLIENT_RESULT: . remote: CLIENT_RESULT: . You can log in to it at: remote: CLIENT_RESULT: . https://untech-cells.rhcloud.com/login remote: CLIENT_RESULT: ^-============================================-^ remote: CLIENT_RESULT: remote: ------------------------- remote: Git Post-Receive Result: success remote: Activation status: success remote: Deployment completed with status: success To ssh://untech-cells.rhcloud.com/~/git/untech.git/ 108a73e..02fee7b master -> master

ahwayakchih commented 8 years ago

Strange, here they say that git pull already passes --allow-unrelated-histories to git merge.

Kuchiriel commented 8 years ago

I had to do manually.

And this env NODE VERSION URL = https: //semver.io/node/resolve/0.10

I used so NODE_VERSION_URL = https: //semver.io/node/resolve

Without 0.10

ahwayakchih commented 8 years ago

Thanks for testing and info!

I kept node at 0.10, because there was info that there are problems with latest versions on OpenShift (something about binary modules not being able to compile because of outdated gcc IIRC). Since you tested it with latest version (4.x? 6.x?) i guess we could move this guide to it too.

Kuchiriel commented 8 years ago

No problem, NodeBB is awesome, this tutorial is killer, its a pleasure to help.

If you use https://semver.io/node/stable, it will return 5.11.1, and this version works fine.