Edster is an application based on JHipster, designed to create and generate presentations. It leverages the JHipster platform to quickly develop and deploy modern presentation generating applications.
The Edster codebase can be generated using the jdl.sh
script. This script processes a JDL (JHipster Domain Language) file to define the application’s entities, relationships, and configurations.
Note: Before running the jdl.sh
script for the first time, you need to make it executable using the following command:
chmod u+x scripts/jdl.sh
To generate the codebase:
-
Execute the
jdl.sh
script:./scripts/jdl.sh
This command will:
-
Parse the JDL file.
-
Generate the necessary application code based on the JDL definition.
Ensure that you have the necessary JHipster environment set up.
If you need to clean the generated code, you can use the clean.sh
script.
Note: Before running the clean.sh
script for the first time, you need to make it executable using the following command:
chmod u+x scripts/clean.sh
To clean the generated code:
-
Execute the
clean.sh
script:./scripts/clean.sh
This command will remove the generated code, allowing you to regenerate it using the jdl.sh
script.
To run the application in development mode, use the following steps:
-
Start the development environment:
./npmw run app:start;
This command will start the backend server with hot reloading enabled. The frontend is served by the webpack dev server.
-
Access the application in your browser:
-
Development-specific configurations:
-
Profile:
dev
-
Hot reloading for backend changes
-
Webpack dev server for frontend
-
H2 database (if not configured differently)
-
To run the application in production mode, use the following steps:
-
Build the production-ready package:
./gradlew -Pprod clean build
This command will:
-
Compile the Java code
-
Run tests
-
Package the application into a deployable archive (
.war
or.jar
or.gradle
) -
Optimize the frontend assets
-
Run the application:
java -jar build/libs/edster-0.0.1.jar
-
Caution
|
The jar file name may vary depending on the version of the application. |
This command will start the application using the production profile.
-
Access the application in your browser:
-
Production-specific configurations:
-
Profile:
prod
-
Optimized and minified frontend assets
-
No hot reloading
-
Production database (e.g., PostgreSQL, MySQL)
-
During development, you can run the backend and frontend separately for faster iteration.
-
To run only the backend:
./npmw run backend:start;
This command will start the backend server on :
-
To run the frontend in watch mode:
./npmw run start;
This command will start the frontend development server with hot reloading, allowing you to see changes in real-time on :
The sync.sh
script helps synchronize manual code changes with the JDL-generated codebase. This ensures that customizations are preserved when regenerating the application using jdl.sh
.
Note: Before running the sync.sh
script for the first time, you need to make it executable using the following command:
chmod u+x scripts/sync.sh
To synchronize the codebase:
-
Execute the
sync.sh
script:./scripts/sync.sh
This script will identify and merge your manual changes into the newly generated code, minimizing conflicts and preserving your customizations.
To run the application front and back end separately in development mode on one terminal, you can use the following steps:
./npmw run backend:start &;npm run start;
One ctrl+c will stop the front only. To stop backend, you will need to find the process id and kill it, like this :
killall -9 java
To re-run the front end :
npm run start;
-
Create a Docker Hub account
-
Generate a key on Portainer or dockerhub.com
This document outlines the steps for programmatically deploying a Docker image to Docker Hub. We will use the docker-credential-helpers
tool, specifically the pass
credential helper, for secure storage of Docker Hub credentials.
This section provides information specific to using pass
as a credential store.
To use the pass
credential helper, ensure that pass
is installed and properly initialized:
-
Install pass:
sudo apt-get install pass
-
Initialize pass with your GPG key ID:
pass init <your_gpg_key_id>
Replace <your_gpg_key_id>
with your actual GPG key ID.
-
Docker installed and running.
-
docker-credential-helpers
installed. On Debian/Ubuntu:sudo apt-get install docker-credential-helper-pass
-
pass
password manager installed and initialized. On Debian/Ubuntu:sudo apt-get install pass
pass init <your_gpg_id>
(replace<your_gpg_id>
with your GPG key ID) -
Docker Hub account and repository created.
Add pass
to your ~/.docker/config.json
file. If the credHelpers
section doesn’t exist, create it.
~/.docker/config.json
{
"credsStore": "desktop",
"credHelpers": {
"docker.io": "pass"
}
}
Use the pass
command to store your Docker Hub username and personal access token (PAT). Important: Use a personal access token instead of your password for automated deployments. Generate a PAT on Docker Hub with "write" access to your repository.
pass insert docker-credential-helpers/docker.io
When prompted, enter your Docker Hub username and personal access token in the following format:
username=<your_dockerhub_username>
password=<your_personal_access_token>
Here’s an example shell script to build, tag, and push a Docker image to Docker Hub:
deploy.sh
#!/bin/bash
# Set variables
IMAGE_NAME="your-image-name"
IMAGE_TAG="latest"
DOCKERHUB_USERNAME="your-dockerhub-username"
DOCKERHUB_REPO="your-dockerhub-repo"
# Build the Docker image
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .
# Tag the image for Docker Hub
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${DOCKERHUB_USERNAME}/${DOCKERHUB_REPO}:${IMAGE_TAG}
# Push the image to Docker Hub
docker push ${DOCKERHUB_USERNAME}/${DOCKERHUB_REPO}:${IMAGE_TAG}
Important:
-
Replace
your-image-name
,latest
,your-dockerhub-username
, andyour-dockerhub-repo
with your actual values. -
Make the script executable:
chmod +x deploy.sh
-
For CI/CD pipelines, ensure
pass
is available and initialized in the environment. -
Consider using environment variables to pass sensitive information to the script, rather than hardcoding them.
-
Always use personal access tokens (PATs) instead of passwords for security.
-
Store the PAT securely (e.g., in a CI/CD secrets manager).