Glavin001 / GitLab-Pages

:eyes: GitHub Pages, for GitLab.
MIT License
203 stars 30 forks source link

not working - 404 #30

Closed victor-yan closed 8 years ago

victor-yan commented 8 years ago

I have long tried to make it work, but still have problem with it. what work: deploy key and webhook sucsesfully added, i can enable and disable projects in list. what doesn't work: after i commit into gl-pages branch (or master, does not matter) i've got only created new folder (as i configure as tmp) and its all. in DEBUG=* npm start:

express:router dispatching POST /webhooks/pages.json +33s
  express:router query  : /webhooks/pages.json +3ms
  express:router expressInit  : /webhooks/pages.json +1ms
  express:router session  : /webhooks/pages.json +1ms
  express-session no SID sent, generating session +2ms
  express:router logger  : /webhooks/pages.json +5ms
  express:router jsonParser  : /webhooks/pages.json +4ms
  body-parser:json content-type "application/json" +0ms
  body-parser:json content-encoding "identity" +5ms
  body-parser:json read body +0ms
  body-parser:json parse body +32ms
  body-parser:json parse json +1ms
  express:router urlencodedParser  : /webhooks/pages.json +0ms
  body-parser:urlencoded body already parsed +0ms
  express:router cookieParser  : /webhooks/pages.json +0ms
  express:router serveStatic  : /webhooks/pages.json +1ms
  express:router router  : /webhooks/pages.json +0ms
  express:router dispatching POST /webhooks/pages.json +1ms
  express:router trim prefix (/webhooks) from url /webhooks/pages.json +1ms
  express:router router /webhooks : /webhooks/pages.json +0ms
  express:router dispatching POST /pages.json +0ms
  routes:webhooks /pages.json +2ms
  routes:webhooks deploy ref: refs/heads/gl-pages, ref: refs/heads/gl-pages +0ms
  routes:webhooks config +0ms { gitlab: { url: 'http://my.gitlab.domain/' },
  deploy:
   { sshPublicKey: '/var/opt/pages/keys/id_rsa.pub',
     sshPrivateKey: '/var/opt/pages/keys/id_rsa',
     deployBranch: 'gl-pages',
     publicPagesDir: '/var/opt/pages/pages',
     tmpPagesDir: '/var/opt/pages/.tmp' },
  server: { publicUrl: 'http://my.gitlab.domain' } }
  routes:webhooks repoPath +4ms /var/opt/pages/.tmp/yan/test
  routes:webhooks url +0ms git@my.gitlab.domain:yan/test.git
  morgan log request +12ms
POST /webhooks/pages.json 200 51.923 ms - -

and i got nothing in my publicPagesDir, so when i try to load my page - i have 404..

express:router dispatching GET /pages/yan/test +35m
  express:router query  : /pages/yan/test +2ms
  express:router expressInit  : /pages/yan/test +0ms
  express:router session  : /pages/yan/test +1ms
  express-session fetching fN8fN58T5V1bApRU7MwgdG5InN6UZuF7 +5ms
  express-session no session found +2ms
  express:router logger  : /pages/yan/test +0ms
  express:router jsonParser  : /pages/yan/test +2ms
  body-parser:json skip empty body +0ms
  express:router urlencodedParser  : /pages/yan/test +0ms
  body-parser:urlencoded skip empty body +1ms
  express:router cookieParser  : /pages/yan/test +0ms
  express:router serveStatic  : /pages/yan/test +1ms
  send stat "/var/opt/pages/public/pages/yan/test" +3ms
  express:router router  : /pages/yan/test +1ms
  express:router dispatching GET /pages/yan/test +1ms
  express:router trim prefix (/pages) from url /pages/yan/test +0ms
  express:router serveStatic /pages : /pages/yan/test +0ms
  send stat "/var/opt/pages/pages/yan/test" +1ms
  express:router <anonymous>  : /pages/yan/test +1ms
  express:router <anonymous>  : /pages/yan/test +0ms
  express:view lookup "error.handlebars" +2ms
  express:view stat "/var/opt/pages/views/error.handlebars" +0ms
  express:view render "/var/opt/pages/views/error.handlebars" +1ms
  morgan log request +70ms
GET /pages/yan/test 404 79.668 ms - 1566
  express:router dispatching GET /stylesheets/style.css +9ms
  express:router query  : /stylesheets/style.css +1ms
  express:router expressInit  : /stylesheets/style.css +0ms
  express:router session  : /stylesheets/style.css +0ms
  express-session fetching fN8fN58T5V1bApRU7MwgdG5InN6UZuF7 +1ms
  express-session no session found +0ms
  express:router logger  : /stylesheets/style.css +1ms
  express:router jsonParser  : /stylesheets/style.css +1ms
  body-parser:json skip empty body +0ms
  express:router urlencodedParser  : /stylesheets/style.css +5ms
  body-parser:urlencoded skip empty body +0ms
  express:router cookieParser  : /stylesheets/style.css +0ms
  express:router serveStatic  : /stylesheets/style.css +1ms
  send stat "/var/opt/pages/public/stylesheets/style.css" +2ms
  send pipe "/var/opt/pages/public/stylesheets/style.css" +2ms
  send modified Sat, 06 Feb 2016 14:19:12 GMT +1ms
  send etag W/"6e-3110077135" +1ms
  send content-type text/css +1ms
  send not modified +2ms
  morgan log request +2ms
GET /stylesheets/style.css 304 16.051 ms - -

i try to instal it several times in different OS, (for different packages version) but the result steel the same. Please help me to find the reason and and make it work.

victor-yan commented 8 years ago

Have somebody any ideas? I still try to make it work, but stil no luck..

Glavin001 commented 8 years ago

I would recommend adding some debugging to https://github.com/Glavin001/GitLab-Pages/blob/master/routes/webhooks.js#L71-L114 and attempting to narrow down where your problem begins.

I am not currently using GitLab so I am unable to test right now however I'll try to help you debug best I can. :smiley:

victor-yan commented 8 years ago

first of all thanks for your reply! code stuck on if (ref !== deployRef) { // debug(ref, deployRef); return res.end(); i read,that someone is coment this out and it worked, so i try to do the same. After this my debuging came to string promise.then(function(repo) { and stuck there.. since I am not a programmer , I can not understand what the problem is and how to fix it

victor-yan commented 8 years ago

by the way.. i suspect that i have some problem with nodegit, as i understand your code crash after try to using it, and i notice that when i try to install nodegit i get this message [nodegit] Fetching binary from S3. [nodegit] Failed to install prebuilt binary: but in the end it say that manual build and install sucsesful, and your code do not display any error with it. so i dont know how to confirm my guess. so i have questions to you: 1)wich version of nodegid should work? (i tried 0.4.1 0.6.0 0.11.0) result the same.. 2)maybe you know how to test if the problem is related to nodegit?

thank for your help!

Glavin001 commented 8 years ago

Looks like 0.4.1 is what I would have tested: https://github.com/Glavin001/GitLab-Pages/blob/master/package.json#L38

So after your debugging you found it stopped at https://github.com/Glavin001/GitLab-Pages/blob/master/routes/webhooks.js#L80 ? Maybe you could add:

promise.catch(function(error) { console.error(error); });

and see if there was an error thrown while trying to pull or clone the repository. That is likely why it never passes promise.then.

victor-yan commented 8 years ago

AWESOME! problem was with ssh-connection to gitlab (pages and gitlab "live" on the same server). Anyway, your advice gave me the opportunity to see exactly where the problem. Maybe you should commit it in your repo? this is VERY usefull for me.

Many thanks for your help!

Glavin001 commented 8 years ago

Please feel free to submit a Pull Request for me to review with any recommend changes you found useful :smiley:. Thanks!

victor-yan commented 8 years ago

I just add promise.catch(function(error) { console.error(error); });` before https://github.com/Glavin001/GitLab-Pages/blob/master/routes/webhooks.js#L80 and it show me where is my problem.

P.S. if someone will have the same issue i strongly recomend to start it with DEBUG=* npm start and read output.

Glavin001 commented 8 years ago

I added that line. Thanks!