Skip to main content

Virtual Machine

This guide outline the process of deploying to a virtual machine, e.g. AWS EC2 or DigitalOcean Droplets.

Here we start from Ubuntu 24.04 LTS.

Cloning SeaORM Pro

$ git clone https://github.com/SeaQL/sea-orm-pro-plus

Build Frontend

$ cd sea-orm-pro-plus/pro_admin_frontend

# Build frontend
$ npm run build

# Delete old frontend build
$ rm -rf ../assets/admin

# Copy new frontend build to backend server
$ cp -r dist ../assets/admin

Build Backend

$ cd sea-orm-pro-plus

$ cargo build --release

Setup Reverse Proxy

# Create a new Nginx site config
$ vim /etc/nginx/sites-available/sea-orm-pro-demo.sea-ql.org

Proxy all requests to the backend server.

/etc/nginx/sites-available/sea-orm-pro-demo.sea-ql.org
server {
server_name sea-orm-pro-demo.sea-ql.org;

location / {
proxy_pass http://127.0.0.1:8086;
}
}

Setup Always on Service

# Setup a background service to run the backend server
$ vim /etc/systemd/system/sea-orm-pro-plus.service
[Unit]
Description=SeaORM Pro Plus Service
Documentation=https://sea-orm-pro-demo.sea-ql.org/
After=network.target

[Service]
Type=simple
User=<USER>
ExecStart=cargo run --release start --environment development

[Install]
WantedBy=multi-user.target

Launch

# To automatically start the service (on system startup)
$ systemctl enable sea-orm-pro-plus

# Start the service
service sea-orm-pro-plus start

# To view the service log
journalctl -u sea-orm-pro-plus -f