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

Heroku generator update. #23686

Closed
1 task
mshima opened this issue Sep 29, 2023 · 7 comments · Fixed by #23971
Closed
1 task

Heroku generator update. #23686

mshima opened this issue Sep 29, 2023 · 7 comments · Fixed by #23971
Assignees
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: Heroku $200 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@mshima
Copy link
Member

mshima commented Sep 29, 2023

Overview of the feature request

There is some discussion about heroku generator future at #19551.
A proposal to drop it was done at #19112.
@mraible wants to keep support for it #19112 (comment).
And following the comment I agree we should keep it, because old tutorials may be outdated but they keep around forever.
Keeping good promoting materials valid (or near) is good for JHipster.

Blueprints overrides heroku too (dotnetcore, micronaut).

Current heroku implementation is too complicated and uses outdated standards. New need to:

  • replace child_process with this.spawn[Command][Sync].
  • drop run-async with async function.
  • simplify.
Motivation for or Use Case
Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Sep 29, 2023

I'll see if I can bribe @deepu105 into helping me with this next week when we're together at Devoxx Belgium. 😉

@deepu105
Copy link
Member

deepu105 commented Oct 4, 2023 via email

@mraible
Copy link
Contributor

mraible commented Oct 23, 2023

@mshima Do you have an example of these refactorings in another sub-generator? Otherwise, I'll just be doing a find-and-replace and hoping things work. It looks like tests will need to change too, since there's code like this:

  beforeEach(() => {
    stub = sinon.stub(ChildProcess, 'exec');
    stub.withArgs('heroku --version').yields(false);
    stub.withArgs('heroku plugins').yields(false, 'heroku-cli-deploy');
    stub.withArgs('git init').yields([false, '', '']);
  });
  afterEach(() => {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    (ChildProcess.exec as any).restore();
  });

@mshima
Copy link
Member Author

mshima commented Oct 23, 2023

You can see spawnMocks here:
f6e9d38

To simulate spawn return create a sinon stub:

const stub = sinon.stub();
stub.withArgs('spawnCommand', 'heroku --version').yields(false);

note that spawnCommand can be one of spawn/spawnSync/spawnCommand/spawnCommandSync, the one you used to call the specific command.

and inject:

helpers
  …
  .withSpawnMock(stub)
  …;

@mshima
Copy link
Member Author

mshima commented Oct 23, 2023

Is there microservice stack support?
If no I think ci-cd generator can be used as base.
The ci-cd rework is implemented at https://github.com/jhipster/generator-jhipster/pull/23718/files

@mraible
Copy link
Contributor

mraible commented Oct 24, 2023

@mshima There isn't support for deploying a whole microservices stack, but there is support for individual apps. @jdubois published a tutorial on Heroku's blog in 2016 that shows how to do it.

@mraible
Copy link
Contributor

mraible commented Oct 24, 2023

@mshima I took a pass at updating the Heroku generator in #23971. I'm not sure I did this one correctly:

  • drop run-async with async function

@mraible mraible added $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $200 https://www.jhipster.tech/bug-bounties/ labels Oct 24, 2023
@deepu105 deepu105 added this to the 8.0.0 milestone Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: Heroku $200 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants