Skip to content

Create separate startup scripts for development and production - #13806

Merged
jbudz merged 5 commits into
elastic:masterfrom
jbudz:dev/bin-kibana
Nov 22, 2017
Merged

jbudz merged 5 commits into
elastic:masterfrom
jbudz:dev/bin-kibana

Conversation

@jbudz

@jbudz jbudz commented Aug 31, 2017 •

Copy link
Copy Markdown
Contributor

This creates a different set of startup scripts for development and production. Development scripts are not included in builds.

There's a few reasons behind this:

  1. We added --no-warnings during crunch time to hide unhandled promise rejections. In node 4 this was the default,, and we didn't have time to track these down with node 6. This removes the --no-warnings flag in development.
  2. This changes development to only use the system's global node. It's unlikely anyone was making use of the node folder in development and it's possible this could get in the way
  3. This changes production to only use the packaged node. Currently both version 4 and version 8 won't work. We've also had problems with this and homebrew in the past.
  4. Removing NODE_ENV=production in development

Closes #5673.

Development mode is now started with node scripts/kibana, and for plugins node scripts/kibana-plugin. CLI args are the same.

@jbudz

jbudz commented Aug 31, 2017

Copy link
Copy Markdown
Contributor Author

Another possible benefit that hasn't been included in this PR is we can stop shipping $dev code, and set it as a default in exec. (like --base-path)

@epixa

epixa commented Aug 31, 2017 •

Copy link
Copy Markdown
Contributor

❤️

If we're going to do this though, what do you think about removing the bin entirely for development and just going through node scripts/dev or something like that? Then we don't need to maintain separate binaries for nix/windows, and when we split out all the dev garbage from cli, we could easily "wrap" the cli call from within the dev script.

/cc @spalger since he was just talking about separating out dev stuff from the CLI.

@spalger

spalger commented Aug 31, 2017 •

Copy link
Copy Markdown
Contributor

+1 @epixa

./scripts/dev.js could probably just point to ./src/cli, and since node scripts/dev calls node directly it removes --no-warnings, makes it obvious that it's using system node, and how to use --inspect and friends.

@jbudz

jbudz commented Aug 31, 2017

Copy link
Copy Markdown
Contributor Author

Works for me, I'll make updates.

@jbudz

jbudz commented Sep 1, 2017

Copy link
Copy Markdown
Contributor Author

Getting there - we'll need grunt-run to use exec or fork, I don't think spawn can start another node process. I need to switch gears for a few, will come back to this.

@spalger

spalger commented Sep 2, 2017

Copy link
Copy Markdown
Contributor

I don't think spawn can start another node process

Sure it can, it's just another executable. Try using process.execPath if it's not resolving node to the right path.

@jbudz
jbudz force-pushed the dev/bin-kibana branch 3 times, most recently from e2086ba to 87f9ff1 Compare September 21, 2017 17:35
@jbudz

jbudz commented Sep 21, 2017

Copy link
Copy Markdown
Contributor Author

jenkins, test it

Comment thread tasks/config/run.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this change is alright?

@tylersmalley tylersmalley Oct 10, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are going through scripts/kibana.js as opposed to bin/kibana in development, so this should be correct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops I forgot to comment on this. @spalger were you concerned about a different node version being used? I believe we're using the bin script anyways, the node build task isn't copied until after optimize.

I'll give this a double check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is producing builds that don't have optimized assets because it's running the optimization in the repo, not the build output.

@spalger

spalger commented Oct 5, 2017

Copy link
Copy Markdown
Contributor

I'm removing release_note:breaking because this doesn't impact releases at all, right?

@jbudz

jbudz commented Oct 5, 2017

Copy link
Copy Markdown
Contributor Author

I added it in case someone was using a global node installed. It's not supported but technically would work and probably throw someone off.

@tylersmalley tylersmalley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tylersmalley

Copy link
Copy Markdown
Member

@spalger - mind taking another look at this?

Comment thread tasks/config/run.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is producing builds that don't have optimized assets because it's running the optimization in the repo, not the build output.

@w33ble

w33ble commented Nov 20, 2017

Copy link
Copy Markdown
Contributor

@elastic/plugin-helpers 8.0.0 published 🎉

@jbudz you should update the dependency here, and then it'll be safe to merge this PR.

@jbudz

jbudz commented Nov 20, 2017

Copy link
Copy Markdown
Contributor Author

Thanks @w33ble!

@tylersmalley I opened https://github.com/elastic/kibana/pull/15066/files to address kibana-keystore - I separated it mostly because this is all green. Pending any red CI I'm going to get this merged in the morning so I can keep an eye on things.

@spalger

spalger commented Nov 29, 2017

Copy link
Copy Markdown
Contributor

This script should probably be using snake_case

@epixa

epixa commented Nov 29, 2017

Copy link
Copy Markdown
Contributor

@spalger When we adopted the snake_case thing for files, we did say that there may be some directories where it makes sense to use a different convention, and that we'd treat those case by case. Since these file names are essentially CLI commands for us, it's possible this is one of those cases.

@spalger

spalger commented Nov 30, 2017

Copy link
Copy Markdown
Contributor

possible, but I think it's ideal to think of the scripts/ as just javascript, and there are other files in that directory that are already using snake case

@epixa

epixa commented Nov 30, 2017

Copy link
Copy Markdown
Contributor

@spalger 👍

@jbudz

jbudz commented Nov 30, 2017

Copy link
Copy Markdown
Contributor Author

I opened #15318 and assigned myself. I'll need to make upstream changes in the plugin-helpers and generator repos.

@w33ble

w33ble commented Nov 30, 2017

Copy link
Copy Markdown
Contributor

@jbudz If I understand this correctly, you're planning to move scripts/kibana-plugin.js to scripts/kibana_plugin.js (likewise the keystore).

The plugin helpers are just using scripts/kibana.js, so no change there. And the template just uses the plugin helpers...

@jbudz

jbudz commented Nov 30, 2017

Copy link
Copy Markdown
Contributor Author

Ah yep you're right, brain fart. That makes life easier.

@schersh

schersh commented Feb 12, 2019

Copy link
Copy Markdown
Contributor

@jbudz Should this be included in the Breaking Changes page for 7.0?
It appeared in the 7.0.0-alpha1 release notes, but I don't see a corresponding note in /migrate_7_0.asciidoc.

@jbudz

jbudz commented Feb 12, 2019

Copy link
Copy Markdown
Contributor Author

I think we're okay, it has never been an approved or advertised workflow. I knew one case on the AUR repository that was swapping it out. We have it documented in a few GitHub issues which should be findable, I'll drop the breaking changes label.

@jbudz

jbudz commented Feb 12, 2019

Copy link
Copy Markdown
Contributor Author

@schersh

schersh commented Feb 12, 2019

Copy link
Copy Markdown
Contributor

Thank you - sorry for the extra ping!

@watson watson mentioned this pull request Aug 20, 2019
5 of 7 tasks
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
…ic#13806)

* Use separate startup scripts for development and production

* build kibana directly

* [build] Use downloaded node when pre-optimizing

* clearer variable name

* Add breaking changes docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants