Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Install Documentation #103

Closed
MattGyverLee opened this issue Jun 26, 2017 · 17 comments
Closed

Need Install Documentation #103

MattGyverLee opened this issue Jun 26, 2017 · 17 comments
Projects
Milestone

Comments

@MattGyverLee
Copy link

MattGyverLee commented Jun 26, 2017

Hi Bryan,

I just spent a long evening trying to install Geist locally on an Ubuntu 14.04 VM. I probably should have used 16.04, as it would have made Java easier, but I was learning the constraints as I went.
I'm not a javascript guru, so I had to learn to use nodejs, which slowed me down considerably.

I was hoping that the dev version would bypass the auth protocol for a locally-run application. And as I mentioned on Twitter, if I can get it running locally, maybe I can make it edit, preview, and store DITA topics and tasks (#90), but I bet you (Bryan) could do it faster and better.

I created my own install documentation along the way (for repeatability), that may be helpful as you work on install instructions. This is what I've accomplished so far:

Initial Steps (on Main Branch):

npm install
  • Install the ones it missed:
npm install csurf
npm install bcrypt
npm install passport-twitter
npm install passport-google-oauth
npm install passport-github2
npm install passport-facebook
  • Install deprecated and special modules:
npm install mimelib@0.2.14
npm install moment@2.11.2
npm install emailjs
npm install git+https://github.com/bryanph/full-auth-middleware.git

https://stackoverflow.com/questions/17509669/how-to-install-an-npm-package-from-github-directly

  • create auth.js and config.js files
cd server/config
cp auth.sample.js auth.js
cp config.sample.js config.js

External Utilities:

Debugging:

  • browse to node_modules/parallelshell/index.js and replace "process.cwd" with "process.cwd()"

    • If you don't do this, parallelshell will fail on the "npm run dev" command.

For running Production:

  • nodejs index.js

I need to create stats.js file. The step below doesn't work for me, so I can't manage to run Production.

webpack --env production --profile --json --config='webpack.config.prod.js' --output-filename='stats.json'

For running Dev:

npm run dev
  • Open http://localhost:3001
  • Try to create account
    • Email will fail, but a verified account is created in the database.
    • Login with this account.

And I get a blank screen

@bryanph
Copy link
Owner

bryanph commented Jun 27, 2017

Thanks for your detailed issue, I'll make sure to add installation instructions in the coming days and make the overall process easier.

@bryanph
Copy link
Owner

bryanph commented Jun 27, 2017

In the meanwhile, you could take a look at #94 where I posted some installation instructions.

@MattGyverLee
Copy link
Author

With help from #94 , I got Geist up and running on Ubuntu 16.04 server!
Everything loads up with:
npm run dev
and I can use the server.

Now I'm trying to run production:
npm run build:webpack
generated the stats.json I was missing, but when i try to run in production mode by setting environment
export NODE_ENV=production
and running:
node index.js
I get this error:

matt@Geist:~/Geist$ node index.js
/home/matt/Geist/server/config/auth.js:36
    "bundleFileName": process.env.NODE_ENV === 'development' ? 'auth.bundle.js' : stats.assetsByChunkName.auth[0],
                                                                                  ^

ReferenceError: stats is not defined
    at Object.<anonymous> (/home/matt/Geist/server/config/auth.js:36:83)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/matt/Geist/server/app.js:87:20)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)

running the Geist service (with the right path in the config) fails as well.
What am I doing wrong?

@bryanph
Copy link
Owner

bryanph commented Jul 2, 2017

@erros84 glad to hear you got it running.
Is this line at the top of auth.js?

const env = process.env.NODE_ENV;

if (env !== 'development') {
    const stats = require('../../stats.json')
}

it is in the sample auth config.

@MattGyverLee
Copy link
Author

MattGyverLee commented Jul 2, 2017

yes it is, and I don't get the missing file error anymore now that I generated the stats.json. with npm run build:webpack

It passes that line, and gets stuck on line 36.

My stats.json file starts with:

{"errors":[],"warnings":[],"version":"2.6.0","hash":"af7562d9a53ff9c299d9","time":74775,"publicPath":"/static/","assetsByChunkName":{"app":["app.af7562d9a53ff9c299d9.bundle.js","app.af7562d9a53ff9c299d9.bundle.js.map"],"auth":["auth.af7562d9a53ff9c299d9.bundle.js","au

so I don't see the problem...

@bryanph
Copy link
Owner

bryanph commented Jul 2, 2017

Make sure you set the environment variable in the same command.
So running NODE_ENV=production node index.js

@MattGyverLee
Copy link
Author

MattGyverLee commented Jul 2, 2017

I backed off to a clean copy of auth.js. Same problem with NODE_ENV=production node index.js.

Using this at the top of auth.js:

if (env !== 'development') {
    const stats = require('../../stats.json')
    console.log(`env is ${env}`)
    console.log(`Version is ${stats.version}`);
    console.log(`auth is ${stats.assetsByChunkName.auth[0]}`);
}

The results are:

env is production
Version is 2.6.0
auth is auth.af7562d9a53ff9c299d9.bundle.js

so...there seems to be an issue with scope, as it evaluates outside const auth but not inside.

I pulled the files down from your latest git commit.

@bryanph
Copy link
Owner

bryanph commented Jul 2, 2017

Woops you are right, it was the scoping. I pushed a fix.
Sorry for the hassle.

@MattGyverLee
Copy link
Author

What service! Thanks! Works now.

@MattGyverLee
Copy link
Author

But when I open page i get "stats not defined" in routes.js down the line.
Do you have stats defined globally somehow on your machine? How are you not seeing this?

@bryanph
Copy link
Owner

bryanph commented Jul 2, 2017

hmm this is strange indeed, the scoping doesn't seem to be an issue for me. Maybe it has to do with different node.js versions. I am running version 7.10.0.
That said, i removed the scoping there as well

@MattGyverLee
Copy link
Author

I'm on nodejs 8.1.3, i'll downgrade to 7.10.0.

@bryanph bryanph added this to ready in current Jul 16, 2017
@MattGyverLee
Copy link
Author

MattGyverLee commented Aug 2, 2017

I am well aware that this is a prototype, but it is a prototype I like so much that I am willing to battle with it.

I have all the dev and prod dependencies installed (except react-tap-event-plugin that has conflicts). Runnig Geist in Dev mode seems to work without problems. Analytics seem to be working. Twitter login is working.

Nevertheless, on nodejs 7.10.0, running in Production mode (as above) doesn't throw any more errors, but it still does not work.

Aug 02 01:32:52 Geist systemd[1]: Started Geist-Prod.
Aug 02 01:32:53 Geist nodejs[5434]: env is production
Aug 02 01:32:53 Geist nodejs[5434]: Version is 2.6.0
Aug 02 01:32:53 Geist nodejs[5434]: auth is auth.6e2c3df3db3f3bc53b0a.bundle.js
Aug 02 01:32:54 Geist nodejs[5434]: listening on port 3001

Opening [host]:3001/ shows a title in the menu bar with no content. It is similar to accessing the site in dev mode before the webpack has finished loading.

Looking at the code, the link to the bundle <script src="https://192.168.1.104/static/app.6e2c3df3db3f3bc53b0a.bundle.js"></script> is a dead link.

Maybe I generated my stats.json file the wrong way...what is the correct process?

Any ideas?

I have run npm run build and this runs as well (also without errors).

@bryanph
Copy link
Owner

bryanph commented Aug 3, 2017

Kudos to you for your perseverance!
In my production setup, I load the static files using nginx, a separate webserver. Hence, these are not loaded by the node.js server (it just does the API logic). So I expose the public/ folder on the URL /static/ and the assets folder on the URL /media/ using an external webserver (in my production setup).

The production setup is not really meant to be run on a local pc to be honest. It is more for a production setup with multiple users.

@MattGyverLee
Copy link
Author

Ok, that helps to understand.

There are 3 of us currently testing it at home and at work, and it took me a while to find that my port-forwarding for the dev version needed to expose both ports 3000 and 3001 to be accessible outside the LAN.

So If I only have one multi-core server to play with (I moved the VM off of my main machine), what goodies am I losing by running in dev?

By the way, I'm calling my server Krang (from the Ninja Turtles) as it functions as an external brain.

@bryanph
Copy link
Owner

bryanph commented Aug 4, 2017

@erros84 minification and some performance optimization and some dev functionality is turned off. And that is a pretty cool name haha!

@bryanph bryanph modified the milestones: Redesign, Release 1.0 Sep 17, 2017
@bryanph
Copy link
Owner

bryanph commented Jan 18, 2018

See #165

@bryanph bryanph closed this as completed Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
current
ready
Development

No branches or pull requests

2 participants