Skip to content

Commit

Permalink
correct procfile
Browse files Browse the repository at this point in the history
  • Loading branch information
atomfrede committed Jun 11, 2020
1 parent a45bf3a commit e60fddb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
46 changes: 44 additions & 2 deletions generators/heroku/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable consistent-return */
const chalk = require('chalk');
const fs = require('fs');
const ChildProcess = require('child_process');
const HerokuGenerator = require('generator-jhipster/generators/heroku');
const constants = require('generator-jhipster/generators/generator-constants');

const execCmd = util.promisify(ChildProcess.exec);

module.exports = class extends HerokuGenerator {
constructor(args, opts) {
super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important
Expand All @@ -18,7 +21,47 @@ module.exports = class extends HerokuGenerator {
}

get initializing() {
return super._initializing();
return {
validateFromCli() {
this.checkInvocationFromCLI();
},

async checkInstallation() {
try {
await execCmd('heroku --version');
} catch (err) {
this.log.error("You don't have the Heroku CLI installed. Download it from https://cli.heroku.com/");
}
},


initializing() {
this.log(chalk.bold('Heroku configuration is starting'));
const configuration = this.getAllJhipsterConfig(this, true);
this.env.options.appPath = configuration.get('appPath') || constants.CLIENT_MAIN_SRC_DIR;
this.baseName = configuration.get('baseName');
this.packageName = configuration.get('packageName');
this.packageFolder = configuration.get('packageFolder');
this.cacheProvider = configuration.get('cacheProvider') || configuration.get('hibernateCache') || 'no';
this.enableHibernateCache = configuration.get('enableHibernateCache') && !['no', 'memcached'].includes(this.cacheProvider);
this.databaseType = configuration.get('databaseType');
this.prodDatabaseType = configuration.get('prodDatabaseType');
this.searchEngine = configuration.get('searchEngine');
this.angularAppName = this.getAngularAppName();
this.buildTool = configuration.get('buildTool');
this.applicationType = configuration.get('applicationType');
this.reactive = configuration.get('reactive') || false;
this.serviceDiscoveryType = configuration.get('serviceDiscoveryType');
this.authenticationType = configuration.get('authenticationType');
this.herokuAppName = configuration.get('herokuAppName');
this.dynoSize = 'Free';
this.herokuDeployType = configuration.get('herokuDeployType');
this.herokuJavaVersion = configuration.get('herokuJavaVersion');
this.useOkta = configuration.get('useOkta');
this.oktaAdminLogin = configuration.get('oktaAdminLogin');
this.oktaAdminPassword = configuration.get('oktaAdminPassword');
},
}
}

get prompting() {
Expand All @@ -39,7 +82,6 @@ module.exports = class extends HerokuGenerator {
const done = this.async();
this.log(chalk.bold('\nCreating Heroku deployment files'));

// this.template('bootstrap-heroku.yml.ejs', `${constants.SERVER_MAIN_RES_DIR}/config/bootstrap-heroku.yml`);
this.template('application-heroku.yml.ejs', `${constants.SERVER_MAIN_RES_DIR}/application-heroku.yml`);
this.template('Procfile.ejs', 'Procfile');
this.template('system.properties.ejs', 'system.properties');
Expand Down
2 changes: 1 addition & 1 deletion generators/heroku/templates/Procfile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
web: java $JAVA_OPTS <% if (applicationType === 'gateway' || dynoSize === 'Free') { %>-Xmx256m<% } %> -jar <% if (buildTool === 'maven') { %>target<% } %><% if (buildTool === 'gradle') { %>build/libs<% } %>/*.jar --spring.profiles.active=prod,heroku<% if (buildTool == 'maven' && herokuDeployType == 'git') { %>,no-liquibase<% } %> --micronaut.server.port=$PORT
web: java $JAVA_OPTS -Dmicronaut.environments=prod,heroku <% if (applicationType === 'gateway' || dynoSize === 'Free') { %>-Xmx128m<% } %> -jar <% if (buildTool === 'maven') { %>target<% } %><% if (buildTool === 'gradle') { %>build/libs<% } %>/*-all.jar<% if (buildTool == 'maven' && herokuDeployType == 'git') { %>,no-liquibase<% } %> --micronaut.server.port=$PORT
<%_ if (buildTool == 'maven' && herokuDeployType == 'git' && (prodDatabaseType === 'postgresql' || prodDatabaseType === 'mysql' || prodDatabaseType === 'mariadb')) { _%>
release: cp -R src/main/resources/config config && ./mvnw -ntp liquibase:update -Pprod,heroku
<%_ } _%>
29 changes: 0 additions & 29 deletions generators/heroku/templates/bootstrap-heroku.yml.ejs

This file was deleted.

0 comments on commit e60fddb

Please sign in to comment.