0

I used JHipster gae to deploy JHipster on GCP, as is explained here, but version 8 has dropped unmaintained deployment sub-generators (#23422):

  1. aws
  2. azure-app-service
  3. azure-spring-cloud
  4. cloudfoundry
  5. gae
  6. openshift

Are there any instructions to follow when deploying an app?

Thanks

1 Answer 1

-1
+50

Deploying a JHipster application on Google Cloud Platform (GCP) without the specific gae sub-generator, which was available in previous versions but removed in version 8, involves a few steps. Since the automated process provided by the sub-generator is no longer an option, you'll need to handle the deployment manually.

Deploying a JHipster application manually on GCP involves several steps, especially since you won't be using the now-removed gae sub-generator. I've mulled over this question quite a bit now, having worked with GCP last year, and I think the steps below should work:

1. Prepare Your JHipster Application

  • Ensure Production Readiness: Confirm that your application is ready for deployment. This includes running tests, setting production configurations and optimising any code or resources.

  • Set Application Properties: Configure your application-prod.yml file for production settings, including database connections, server ports and any other environment-specific settings.

2. Containerise Your Application with Docker

  • Create a Dockerfile: If you don't already have a Dockerfile, you can generate one using JHipster's Docker support. The command jhipster docker-compose can be used to create necessary configurations.

  • Build Docker Image: Build your Docker image with a command like docker build -t your-app-name.

3. Set Up GCP

  • Install Google Cloud SDK: If not already installed, download and install the Google Cloud SDK.

  • Initialise gcloud: Run gcloud init to initialise the gcloud environment. This sets up your GCP credentials and selects a default GCP project.

  • Enable Required Services: Depending on your needs (e.g. Compute Engine, Cloud SQL), enable the required services in your GCP project.

4. Choose a Deployment Model

  • Google Kubernetes Engine (GKE): For deploying on GKE, you need to create a Kubernetes cluster in GCP.

  • Google App Engine Flexible: For a more straightforwrd approach, similar to the old gae sub-generator, use App Engine Flexible.

  • Google Cloud Run: For a fully managed solution, especially for stateless containers, consider using Cloud Run.

5. Database and Services Setup

  • Configure Database: If using Cloud SQL, set up an instance and configure your application to connect to this database.

  • Other Services: Configure any additional services your application needs (forinstance, storage, caching).

6. Deploy Your Application

  • Push Docker Image to Container Registry: Use the gcloud commands to tag and push your Docker image to Google Container Registry (GCR).

  • Deploy to Selected Service:

    • GKE: Use kubectl commands to deploy your application onto your Kubernetes cluster.
    • App Engine Flexible: gcloud app deploy.
    • Cloud Run: gcloud run deploy.

##7. Test and Validate ##

  • Check Deployment: Once deployed, visit your application's URL to check its functionality.

  • Run Tests: Perform any and all you necessary tests to ensure all parts of your application are working as expected.

8. Monitoring and Logging

  • Set Up Monitoring: Utilise Google Cloud's monitoring and logging tools to keep track of your application's performance and troubleshoot any issues.

9. Continuous Deployment

  • Set Up CI/CD: Consider setting up a CI/CD pipeline using GitHub Actions, GitLab CI or Google Cloud Build for automated deployments.

Additional Tips

Some things that came to mind wrting this.

  • Read the Docs: I think you're already doing this, but always refer to the latest GCP and JHipster documentation for up-to-date instructions and best practices.

  • Secure Your Application: Ensure that all aspects of security (like SSL, database security) are correctly configured.

  • Cost Management: Keep an eye out on GCP costs to avoid unexpected charges.

I can only provide you these steps as a general guideline and want to highlight that they might need adjustments based on the specifics of your JHipster application and your chosen services in GCP.


EDIT

SECURITY

The question arose whether there is anything that I'd consider that needs to be done besides the security that is already implemented in general (in JHipster using PostgreSQL or MySQL). There are several additional security consideration, which I outline below. Nothing really out of the ordinary, but probably good to have checkpoints to see if they are addressed:

A. Database Encryption

It's probably trivial to mention, but jus tin case, I'll mention them here:

  • At-Rest Encryption: Ensure that your database is configured to use at-rest encryption, meaning that data stored on disk is encrypted, protecting it from unauthorised access. Most cloud providers, including GCP, offer this feature.
  • In-Transit Encryption: Use SSL/TLS encryption for data transmitted between your application and the database to prevent data interception.

B. Network Security

  • Private Connectivity: Use private IP addresses for your database instances to ensure they are not exposed to the public internet. This can be configured in GCP's network settings.
  • Firewall Rules: Configure firewall rules to allow access to the database only from specific, trusted sources (like your application servers or a secure admin network).
  • Central Egress: Any outgoing network traffic is best to pass through a central egress.

C. Access Control

  • Strong Authentication: Use strong, complex passwords for all database accounts. Consider integrating with a managed identity and access management system.
  • Role-Based Access Control (RBAC): Assign roles and permissions appropriately, ensuring that each user or service has only the minimum required level of access.
  • Rotate Credentials: Regularly rotate database credentials to reduce the risk of credential compromise.

D. Monitoring and Auditing

  • Audit Logs: Enable audit logging to keep track of database access and activities. This is crucial for identifying and investigating suspicious activities. Also, some industries require those to be kept for a number of years.
  • Real-Time Monitoring: Use monitoring tools to keep an eye on database performance and security-related events.

E. Regular Updates and Patches

  • Keep Software Up-to-Date: Regularly update your database software (or any application for that matter) to the latest version to ensure all known security vulnerabilities are patched.
  • Apply Security Patches: Promptly apply security patches provided by the database vendors or the cloud service provider.

F. Backup and Disaster Recovery

  • Regular Backups: Implement a strategy for regular backups of your database.
  • Disaster Recovery Plan: Have a disaster recovery plan in place that includes procedures for restoring data from backups in case of data loss or corruption.
  • Metrics Definition: Define your DR metrics, such as Recovery Time Objective (RTO), which is the targeted duration of time between the event of failure and the point where operations resume, and Recovery Point Objective (RPO), the maximum length of time permitted that data can be restored from, which may or may not mean data loss. Get sign off on these.

G. Data Privacy and Compliance

  • Compliance with Regulations: Ensure that your database setup complies with relevant data privacy laws and regulations (like GDPR, HIPAA etc.).
  • Data Masking & Redaction: Consider using data masking or redaction techniques for sensitive data, especially in non-production environments.
  • Data Retention: Keep data only for as long as you really need it and schedule regular deletions according to rules there were signed off on.

H. Application-Level Security

  • SQL Injection Protection: JHipster typically includes protections against SQL injection, but always verify and understand how it's implemented and ensure it covers all parts of your application.
  • QA: Ensure you have resources to QA your security, include pen tests on various layers: network, app, database.
  • ORM Security: If using ORM (Object-Relational Mapping), configure it securely to prevent issues like lazy loading vulnerabilities or insecure direct object references.
5
  • Regarding database security, is there anything that you consider that needs to be done besides the security that is already implemented in general (in Jhipster: postgres or mysql)? Thanks for the answer. Really helpful, Alex Nov 16 at 10:54
  • Most definitely, when you deploy a JHipster application with databases like PostgreSQL or MySQL (especially in a cloud environment like GCP), there are several additional security measures you should consider beyond the default configurations provided by JHipster. I'll make an edit to the answer later as I can think of a few that wouldn't fit in a comment, plus, I need to sort out my thoughts and angles (Appreciate the feedback. Glad I could help.) Nov 16 at 13:07
  • One question Alex. Can a new version being deployed using: gradlew appengineDeploy -Pgae -Pprod-gae as it is used on the older version (for app engine in GCP)? Thanks again Nov 22 at 13:02
  • Yes, it should be possible, if you have the right configs in place. You can use the Gradle build system to deploy your app with the Gradle app engine plugin. Make sure your build.gradle file is configured correctly for the app engine deployment. You probably know it already, but the documentation is at cloud.google.com/appengine/docs/legacy/standard/java/…. More details on configuring Gradle: cloud.google.com/artifact-registry/docs/java/store-java Nov 23 at 14:33
  • Thanks Alex. Another question: Is it possible to have two different versions of a JHipster app running simultaneously (so it is not overwritten and I can switch traffic from one to the other with a no-promote)? Now it overwrites the old one using the app.yaml file. Can I chat with you from outside stackoverflow Tweet a DM at @AutoAlert_Es and thanks again for your help! Nov 28 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.