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

Setting up with default ember-cli-deploy-build #20

Closed
dehuszar opened this issue Jan 25, 2016 · 13 comments
Closed

Setting up with default ember-cli-deploy-build #20

dehuszar opened this issue Jan 25, 2016 · 13 comments

Comments

@dehuszar
Copy link
Contributor

How would I go about getting this plugin working with the regular ember-cli-deploy build plugin? I've seen the discussion on the main plugin's issues thread but I'd really rather do the configuration myself than use a forked plugin.

Is it just passing some context-assembled path for attachments to the distDir property? Or are there other details involved?

@broerse
Copy link
Collaborator

broerse commented Jan 26, 2016

As long as setting a var in the configuration will make it read-only you could set outputPath, couchDir and distDir to:

    outputPath: 'tmp/deploy-dist/_attachments',
    couchDir: 'tmp/deploy-dist',
    distDir: 'tmp/deploy-dist/_attachments'

and use the regular deploy. The plus version does this for you and it provides an ENV specific robots.txt file for staging.

@broerse
Copy link
Collaborator

broerse commented Jan 26, 2016

Perhaps use path.sep to support windows and linux.

@dehuszar
Copy link
Contributor Author

Thanks!!

I think I've gotten most of the way there. I am able to successfully deploy to my development couch server. And when I go to my site's design document, I get a ton of output, but I'm not actually able to see the site render. I've traditionally just hosted the ember side via nginx, so forgive me if I'm missing something super obvious, but what URL should I be able to go to to see my ember site actually get rendered? Every path I try, to the extent that it exists just returns json.

Here's a gist of my deploy.js config.

@broerse
Copy link
Collaborator

broerse commented Jan 26, 2016

Sorry! I think you have to set outputPath: on the regular deploy environment to tmp/deploy-dist/_attachments .I don't have time to check now.

@dehuszar
Copy link
Contributor Author

Unless I'm not understanding what you mean by regular deploy environment, outputPath is set as described. Should I be able to see my Ember interface by going to http://0.0.0.0:5984/couch_db_name?

@broerse
Copy link
Collaborator

broerse commented Jan 27, 2016

It is why I had to build ember-cli-build-plus 😄

You need to set ENV.build outputPath: to tmp/deploy-dist/_attachments and ENV.couchdb distDir: to tmp/deploy-dist/_attachments and ENV.couchdb couchDir: to tmp/deploy-dist

But I can create a working version with the regular build if you don't get it to work. The baseURL you need to visit without a vhost is something like this http://0.0.0.0:5984/emberapp/_design/ddocname/_rewrite/' I print the correct baseURL to the screen when you run deploy.

@dehuszar
Copy link
Contributor Author

So after implementing the change you mentioned, I get the following error:

TypeError: Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
    at Class.DeployPluginBase.extend.didBuild (/home/dehuszar/Development/resume-builder/node_modules/ember-cli-deploy-couchdb/index.js:54:16)
    at Object._pipeline.register.fn (/home/dehuszar/Development/resume-builder/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:175:21)
    at Pipeline._notifyPipelinePluginHookExecution (/home/dehuszar/Development/resume-builder/node_modules/ember-cli-deploy/lib/models/pipeline.js:136:19)
    at lib$rsvp$$internal$$tryCatch (/home/dehuszar/Development/resume-builder/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/home/dehuszar/Development/resume-builder/node_modules/rsvp/dist/rsvp.js:505:17)
    at /home/dehuszar/Development/resume-builder/node_modules/rsvp/dist/rsvp.js:1001:13
    at lib$rsvp$asap$$flush (/home/dehuszar/Development/resume-builder/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:456:9)
    at process._tickCallback (node.js:385:13)Pipeline aborted

There's one other thing that I find confusing in the docs, which may or may not be related. Is the /emberapp/ segment a fixed label, meaning it must read emberapp? Because it reads like it should be an alias for the couchDB database. Additionally, ddocname appears to be a variable which defaults to the project name even though the /ddocname/ segment of the various urls doesn't appear to be a variable

@dehuszar
Copy link
Contributor Author

Quick update. Looks like my .env.deploy.[ENV] files got blown away somehow and that was causing the error. I am now able to push to my CouchDB server and load the site. But I am not able to get my image files to load on the site. They return 404 errors. The target paths are just normal paths; i.e. /images/[subfolder/filename.ext] and work on my local EmberCLI + PouchDB instance. Is there anything missing or out of place in my gist that might cause this issue?

@broerse
Copy link
Collaborator

broerse commented Jan 28, 2016

Your gist looks fine to me. Do you see the images in tmp/deploy-dist/_attachments ? Is this in you tmp/deploy-dist/rewites.json?

  {
    "from": "images/*",
    "to": "images/*",
    "method": "GET"
  },

@broerse
Copy link
Collaborator

broerse commented Jan 28, 2016

Perhaps you images are addressed absolute. They need to be relative to the <base href="/resume_builder/_design/resume-builder/_rewrite/" /> in the index.html file generated by ember-cli. /images/[subfolder/filename.ext] needs to be images/[subfolder/filename.ext] ??? Or use a CouchDB vhost.

@dehuszar
Copy link
Contributor Author

Woot! Setting the images to "images/etc/" instead of "/images/etc/" did the trick. Thank you for your help with this!

I think it would really be worth putting a clear example together for folks who wanted to use the regular cli-deploy library. I don't think the configuration is that onerous once it's laid out plainly. I would be happy to put together a PR against the docs if you're interested.

@broerse
Copy link
Collaborator

broerse commented Jan 30, 2016

@dehuszar Yes please write the PR. It would be nice if there is a choice between ember-cli-deploy-build and ember-cli-deploy-build-plus. Perhaps address the / \ issue for windows or use path.sep (path = require('path');) in your example.

@broerse
Copy link
Collaborator

broerse commented Oct 17, 2016

Merged #40

@broerse broerse closed this as completed Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants