Your First Deployment
A complete walkthrough of deploying a real application on SailOps.
This guide walks you through deploying a complete web application with a database, from start to finish.
What We'll Build
We'll deploy a simple web application with:
- A Container running your application
- A PostgreSQL Database for data storage
- A Gateway with HTTPS for public access
Prerequisites
- A SailOps account with a configured project
- A Docker image (public or private registry)
- A domain name (SailOps doesn't provide default domains)
Step 1: Create a Database
Let's start with the database since our application will need to connect to it.
- Navigate to Services in the sidebar
- Click Create Service and select PostgreSQL
- Configure your database:
| Field | Value |
|---|---|
| Name | app-db |
| PostgreSQL Version | 16 (latest) |
| Compute Class | Eco |
| Flavor | Small |
| Storage | 5Gi |
| Storage Class | Standard |
During the trial, use Eco, Small, and Standard storage with 5Gi. The console uses Gi for GiB: 5Gi is 5 GiB (5,120 MiB), the PostgreSQL trial limit.
- Click Create
The database will be ready in about 30 seconds. Note down the connection details:
Host: app-db-rw.your-project
Port: 5432
Database: postgres
Username: postgres
Password: [auto-generated]
The host uses the internal DNS format: {db-name}-rw.{project-name}
You can copy the full connection string from the database details page.
Step 2: Configure Registry Credentials (Optional)
If you're using a private Docker registry, configure the credentials first:
- Go to Project Settings > Registry Credentials
- Click Add Credentials
- Configure:
| Field | Value |
|---|---|
| Name | my-registry |
| Registry URL | ghcr.io or docker.io or your private registry |
| Username | Your registry username |
| Password | Your access token or password |
- Click Save
For GitHub (ghcr.io), use a Personal Access Token with read:packages scope as the password.
Step 3: Deploy Your Application
Now let's deploy the application container.
- Go to Containers in the sidebar
- Click Create Container
- Configure the container:
| Field | Value |
|---|---|
| Name | web-app |
| Image | Your Docker image |
| Port | Your app's listening port |
| Compute Class | Eco |
| CPU | 0.5 vCPU |
Environment Variables
Add your database connection as environment variables:
- Scroll to Environment Variables
- Add the following:
| Key | Value |
|---|---|
DATABASE_URL | postgresql://postgres:[email protected]:5432/postgres |
NODE_ENV | production |
- Click Create
Your container is created in Stopped state. Open web-app from the container list, click Start, and confirm. Wait until the container is healthy: the current console shows Running, with all instances ready. Your application can then use the database connection configured above.
Step 4: Expose Your Application
Create a gateway to make your app publicly accessible.
- Navigate to Gateways
- Click Create Gateway
- Configure:
| Field | Value |
|---|---|
| Name | web-gateway |
| Type | HTTP/HTTPS |
-
Add a route:
- Path:
/ - Target:
web-app - Port: Your app's port
- Path:
-
Click Create
Configure Your Domain
SailOps doesn't provide default domains. You need to configure your own:
Option A: Automatic DNS Management (Recommended)
If you've configured a DNS provider in your project settings:
- Go to Gateways > your gateway
- Click Add Listener
- Enter your hostname (e.g.,
app.yourdomain.com) - SailOps will automatically create the DNS record and provision the SSL certificate
Option B: Manual DNS Configuration
- Go to your gateway details and copy the IP Address
- Create an A record in your DNS provider:
app.yourdomain.com A <gateway-ip-address> - Wait for DNS propagation (a few minutes to 24h)
- Add the listener in SailOps with your hostname
- SSL certificate will be provisioned automatically
Configure your DNS provider (Cloudflare, AWS Route53, etc.) in Project Settings > DNS Providers for automatic DNS management.
Step 5: Verify Your Deployment
- Access your configured domain (e.g.,
https://app.yourdomain.com) - Your application should load with HTTPS
- Verify database connectivity by testing your app's features
Check Container Health
In Containers > web-app:
- Status should be
Running, with all instances ready - Health should show successful checks
- Metrics should display CPU and memory usage
Check Logs
If something isn't working:
- Go to your container's Logs tab
- Look for error messages
- Check the Events tab for deployment issues
Step 6: Configure Autoscaling (Optional)
During the trial, keep one replica and skip this step. The example below requires an organization outside the trial.
To handle traffic spikes:
- Go to Containers > web-app > Autoscaling
- Enable autoscaling
- Configure:
| Setting | Value |
|---|---|
| Min Replicas | 1 |
| Max Replicas | 5 |
| CPU Target | 70% |
Your application will now automatically scale based on load.
Common Deployment Patterns
Multi-Service Architecture
Deploy multiple containers that communicate internally:
Blue-Green Deployments
- Deploy a new version to a new container
- Test it with a separate gateway
- Switch the main gateway to the new container
- Delete the old container
Environment Separation
Create separate projects for different environments:
production- Live customer-facing appstaging- Pre-release testingdevelopment- Developer testing
Deployment Checklist
- Registry credentials configured (if using private images)
- Database created and accessible
- Container deployed and running
- Environment variables configured
- Gateway created with correct routes
- Domain configured with A record pointing to gateway IP
- SSL certificate provisioned
- Application accessible via HTTPS
- Autoscaling configured (if needed)
- Monitoring alerts set up
Troubleshooting
Container Crashes on Start
- Check Logs for error messages
- Verify environment variables are set correctly
- Ensure the image exists and is accessible
Image Pull Error
- Verify registry credentials are configured correctly
- Check the image name and tag exist
- For private registries, ensure the access token has read permissions
Database Connection Failed
- Verify the connection string is correct
- Check the database is
Ready - Use the internal hostname, not external
Gateway Returns 502
- Container might still be starting
- Check container health status
- Verify the port mapping is correct
Next Steps
Your application is now deployed! Consider:
Need deployment help? Contact us at [email protected]