j3k0 / ganomede-admin

Ganomede administration interface
0 stars 0 forks source link

How to get into the website? #10

Closed j3k0 closed 8 years ago

j3k0 commented 8 years ago

After launching with make, I'm unable to access any page.

{
"success": false,
"error": "Need authentication",
"needAuthentication": true
}

How to access the entry page of the website with a login form?

On a similar note: /about shouldn't require authentication either. It's kind of the health check for the module.

j3k0 commented 8 years ago

@elmigranto Being pretty busy currently, I'd rather not dig into the source code to find answers. Can you add a short "Getting Started" section in the README.md?

elmigranto commented 8 years ago

Are you on master or develop? Not sure about master, node-couch-cms throwing that because it requires couch to have admin user or something like that.

Here's the script I use:

#!/bin/bash

function main {
  # admin server config
  export API_SECRET="1"
  export PORT="1337"
  export ADMIN_USERNAME="1"
  export ADMIN_PASSWORD="1"
  export ADMIN_TOKEN="ccd97be87b4afe2cf6b7e20c5e66fc2e6dde6c158020bc9d3caa1c8fec1f2197"

  # Some links
  export SERVERS_LINK1_URL="http://tst.com"
  export SERVERS_LINK1_NAME="tst"
  export ANALYTICS_LINK1_URL="http://dsdsd.com"
  export ANALYTICS_LINK1_NAME="Tessst"

  # vcurrency config
  export VIRTUAL_CURRENCY_PORT_8080_TCP_PORT='8000'
  export VIRTUAL_CURRENCY_CURRENCY_CODES="gold,silver,copper"

  # go!
  nodemon -w server/ -w config.js index.js
}

main
j3k0 commented 8 years ago

Using react-router branch.

I also commented out node-couch-cms:

diff --git a/index.js b/index.js
index 16a35bf..2004e1c 100644
--- a/index.js
+++ b/index.js
@@ -2,20 +2,20 @@

 const pkg = require("./package.json");
 const os = require("os");
-const CmsEngine = require('couchdb-node-cms');
+//const CmsEngine = require('couchdb-node-cms');
 const config = require('./config');
 const app = require('./server/app');
 const auth = require('./server/auth');
 const log = require('./server/log');

-const cmsEngine = new CmsEngine({
+/*const cmsEngine = new CmsEngine({
    config: config.couch,
    server: app,
    auth: auth.mwValidate,
    apiRoot: `${config.http.apiBase}/cms`
  });

-cmsEngine.start();
+cmsEngine.start();*/

 //
 // About endpoint

Using your script:

screen shot 2016-04-05 at 13 51 51 screen shot 2016-04-05 at 13 50 58
j3k0 commented 8 years ago

Are you sure you don't have a authentication cookie on your browser dating from when you could access the login form?

j3k0 commented 8 years ago

Doesn't work on develop branch either.

elmigranto commented 8 years ago

react-router branch is just me looking into react-router. It has no auth implemented atm and the only page is items. To see it, you'll need to export your ADMIN_TOKEN and visit /http://localhost:1337/admin/v1/web/#/items. If you don't have token cookie set from earlier, you'll need to login from develop first.

It probably would be simpler to run from develop or feature/items.

elmigranto commented 8 years ago

Doesn't work on develop branch either.

Same mistake? Does your couch has user/password? If so, export some of these (from config.couch):

  couch: {
    host: process.env.COUCHDB_HOST || 'localhost',
    port: +process.env.COUCHDB_PORT || 5984,
    user: process.env.COUCHDB_USER || '',
    password: process.env.COUCHDB_PASSWORD || '',
    db: process.env.COUCHDB_DB || 'blog'
  }

Oh, I see you commented couch out all together, the link is http://localhost:1337/admin/v1/web, probably worth adding redirect here. Also, make might be required inside web directory.

j3k0 commented 8 years ago

I commented out anything related to couchdb, so that's not where we should be looking?

diff --git a/config.js b/config.js
index 08b141f..f5a9a5c 100644
--- a/config.js
+++ b/config.js
@@ -3,13 +3,13 @@
 const pkg = require('./package.json');

 const config = {
-  couch: {
+  /* couch: {
     host: process.env.COUCHDB_HOST || 'localhost',
     port: +process.env.COUCHDB_PORT || 5984,
     user: process.env.COUCHDB_USER || '',
     password: process.env.COUCHDB_PASSWORD || '',
     db: process.env.COUCHDB_DB || 'blog'
-  },
+  }, */

   http: {
     host: process.env.HOST || '0.0.0.0',

Nobody is using couch except the CMS, so it's totally unrelated.

grep -r couch server => no result

elmigranto commented 8 years ago

Any errors in browser console?

Is browserify build okay, (cd web && make)?

j3k0 commented 8 years ago

OK, I figured out the webpage is located at http://localhost:8000/admin/v1/web/index.html (which was my original question). The bundle.js file can't be found.

j3k0 commented 8 years ago

Alright, make -C web did it.

Possible to add all this in a README section, that's not something one can intuitively figure out.

elmigranto commented 8 years ago

Oh, I see, I didn't change paths from original version, let's probably do that.

To make bundle, cd web && make.

elmigranto commented 8 years ago

Possible to add all this in a README

Yeah, sure!

j3k0 commented 8 years ago

Path is fine (because it's gonna be on same hostname as the other services), a redirect from / to /admin/v1/web would help.