General Project
General projects are used to deploy any type of executable program, not limited to specific programming languages.
Use Cases
- Rust applications
- C/C++ applications
- Shell scripts
- Other compiled language applications
- Custom startup scripts
Creating a General Project
- Go to the Projects page
- Click Create Project
- Fill in the configuration:
- Project Name: Project identifier
- Project Directory: Directory where the executable is located
- Startup Command: Command to start the program
- Enable Reverse Proxy as needed
Startup Command Examples
Rust Application
# Run compiled binary
./myapp
# Run with arguments
./myapp --config config.toml --port 8080Shell Script
# Run script
/bin/bash start.sh
# Or run directly (requires shebang and execute permission)
./start.shCustom Startup Script
Create start.sh:
#!/bin/bash
cd /opt/ace/project/myapp
export ENV=production
./myappStartup command: /bin/bash start.sh
Environment Variables
You can set environment variables in the startup command:
# Single environment variable
ENV=production ./myapp
# Multiple environment variables
ENV=production PORT=8080 ./myappOr edit the project directly and add environment variables in Runtime Settings.
Working Directory
The project runs in the specified project directory, and relative paths are resolved based on that directory.
If you need to change directories, you can use cd in the startup command:
cd /opt/ace/project/myapp/bin && ./myappPermission Settings
Ensure the executable has execute permission:
chmod +x myapp
chmod +x start.shRunning User
By default, projects run as the www user. If the program requires special permissions, you can select a different user.
Note
Running as root user may pose security risks, please choose carefully.
Log Output
The program's standard output (stdout) and standard error (stderr) are recorded in logs, which can be viewed on the project management page.
It is recommended that programs output logs to standard output rather than writing to files for unified management.
Signal Handling
When a project stops, a SIGTERM signal is sent. The program should handle this signal properly to achieve graceful shutdown:
// Rust example
use signal_hook::{consts::SIGTERM, iterator::Signals};
fn main() {
let mut signals = Signals::new(&[SIGTERM]).unwrap();
// Handle SIGTERM signal
}// C example
#include <signal.h>
void handle_sigterm(int sig) {
// Clean up resources
exit(0);
}
int main() {
signal(SIGTERM, handle_sigterm);
// ...
}