There are two main execution methods described in this guide:
- Automated Deployment and Service Management: The standard operational method using scripts in the
setup
directory to install the application on a server, build/deploy it, and manage it as a system service. (Recommended) - Manual Execution and Management: A method for running the application directly for development or testing purposes using scripts in the
app/bin
directory.
1. Prerequisites
Before proceeding with the deployment, the following software must be installed on the server.
- Java (JDK): Version 21 or higher
- Git: Required to fetch the application from the source code repository.
- Apache Maven: Required to build the application source code.
2. Automated Deployment and Service Management (Using setup
Scripts)
The scripts in the setup
directory automate most of the tasks required for operations, such as initial application installation, updates, and service registration.
2.1. Initial Installation
Linux/Unix Environment
- Create a
setup
directory in your desired location on the server and navigate into it.mkdir setup && cd setup
- Copy the
app.conf
andinstall-app.sh
files from thesetup
directory of the original source repository. - Open the
app.conf
file and modify the variable values such asAPP_NAME
,DAEMON_USER
, andBASE_DIR
to match your server environment. - Grant execute permission to
install-app.sh
.chmod +x install-app.sh
- Run the installation script. This script will download the entire project from the Git repository and install the application in
BASE_DIR
../install-app.sh
Windows Environment
- Create a
setup
directory in your desired location on the server and navigate into it.mkdir setup && cd /d setup
- Copy the
setenv.bat
andinstall-app.bat
files from thesetup
directory of the original source repository. - Open the
setenv.bat
file and modify the variable values such asAPP_NAME
andBASE_DIR
to match your server environment. (BASE_DIR
should be in a Windows path format, likeC:\Aspectran\aspectow
). - Run the installation script.
install-app.bat
2.2. Initial Build and Deployment
The initial installation using install-app.sh
or install-app.bat
is a process that only prepares the directory structure and operational scripts required to run the application. After the installation is complete, a first deployment process to build the source code and deploy libraries, configuration files, etc., is essential to actually run the application.
- Once the
install-app
script is complete, navigate to theBASE_DIR
you set inapp.conf
orsetenv.bat
.# Linux/Unix cd /path/to/your/BASE_DIR
# Windows cd /d D:\path\to\your\BASE_DIR
- Run the full deployment script to proceed with the first build and deployment.
# Linux/Unix ./5-pull_build_deploy.sh
# Windows 5-pull_build_deploy.bat
Now the application is fully ready to be executed.
2.3. Service Installation and Management
Once the initial installation and deployment are complete, you can register and manage the application as a system service.
- Linux/Unix: Register as a
systemd
service# [BASE_DIR] is the path set in app.conf. cd [BASE_DIR] ./setup/install-service.sh
- Start/Stop/Status Check:
sudo systemctl start|stop|status [APP_NAME]
Remove Service:
./setup/uninstall-service.sh
- Windows: Register as a Windows Service
- As guided at the end of the
install-app.bat
execution, runinstall.bat
in theapp\bin\procrun
directory of the new installation path with Administrator privileges. - Start/Stop Service:
net start|stop [ServiceName]
or manage from theServices
app (services.msc
). - Remove Service: Run
uninstall.bat
inapp\bin\procrun
with Administrator privileges.
procrun.options
File Settings
The app/bin/procrun/procrun.options
file defines the detailed settings for when the application is registered as a Windows service. You can modify this file to change the service’s properties before running install.bat
.
SERVICE_NAME
: The unique name of the Windows service (e.g.,MyWebApp
).DISPLAY_NAME
: The name to be displayed in the ‘Services’ management console (e.g.,My Web Application
).DESCRIPTION
: A brief description of the service.JAVA_HOME
,JVM_MS
,JVM_MX
,JVM_SS
: JVM settings that serve the same role as inrun.options
.
2.4. Deployment Script Details (setup/scripts
)
The setup/scripts
directory is divided by platform (linux
/windows
) and contains various scripts for deployment automation. These scripts are copied to [BASE_DIR]
and are used for the initial deployment and continuous updates of the application.
1-pull.sh|bat
: Pulls the latest source code from the Git repository.2-build.sh|bat
: Builds the application source code using Maven.3-deploy_config.sh|bat
: Deploys configuration files in theapp/config
directory.4-deploy_webapps.sh|bat
: Deploys web application files in theapp/webapps
directory.5-pull_build_deploy.sh|bat
: Executes the entire deployment process (pull → build → deploy).6-pull_deploy.sh|bat
: Skips the build process and only executes deployment.7-pull_deploy_config_only.sh|bat
: After pulling the latest source, deploys only the configuration files.8-pull_deploy_webapps_only.sh|bat
: After pulling the latest source, deploys only the web application files.9-pull_deploy_config_webapps_only.sh|bat
: After pulling the latest source, deploys both configuration and web application files.
3. Manual Execution and Management (Using app/bin
Scripts)
Used when running the application directly without registering it as a service, for purposes such as development and debugging. All related scripts are located in the [BASE_DIR]/app/bin
directory.
run.options
File Settings
The app/bin/run.options
file defines common settings for all manually executed scripts, such as shell.sh
and daemon.sh
. You can uncomment and modify the values to use them.
JAVA_HOME
: Directly specifies the path of the JDK to use. If not set, it follows the system’s defaultJAVA_HOME
.JVM_MS
: JVM initial heap size (in MB). E.g.,JVM_MS=256
JVM_MX
: JVM maximum heap size (in MB). E.g.,JVM_MX=1024
JVM_SS
: Thread stack size (in KB). E.g.,JVM_SS=1024
WAIT_TIMEOUT
: The maximum time (in seconds) that thedaemon.sh
script waits for the daemon to start or stop. If this time is exceeded, it is considered a failure. E.g.,WAIT_TIMEOUT=60
Linux/Unix Environment
daemon.sh
: Runs as a simple background daemon. Automatically cleans up lock files left behind on abnormal termination.jsvc-daemon.sh
: Runs as a daemon using Apache Commonsjsvc
(more stable). Automatically cleans up PID files left behind on abnormal termination.shell.sh
: Runs in interactive shell mode.
Windows Environment
daemon.bat
: Runs as a daemon, displaying the execution process in a console window.shell.bat
: Runs in interactive shell mode with JLine applied (Recommended).legacy-shell.bat
: A basic shell for older console environments where compatibility is important.procrun\
directory: Scripts related toprunsrv.exe
for Windows service installation/uninstallation/management.
Related Guides
After deploying the application, it is recommended to configure a reverse proxy like Nginx in a production environment. Learn more in the guide below.