Skip to main content

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.

  1. Navigate to Services in the sidebar
  2. Click Create Service and select PostgreSQL
  3. Configure your database:
FieldValue
Nameapp-db
PostgreSQL Version16 (latest)
Compute ClassEco
FlavorSmall
Storage5Gi
Storage ClassStandard

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.

  1. 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}

Connection String

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:

  1. Go to Project Settings > Registry Credentials
  2. Click Add Credentials
  3. Configure:
FieldValue
Namemy-registry
Registry URLghcr.io or docker.io or your private registry
UsernameYour registry username
PasswordYour access token or password
  1. Click Save
GitHub Container Registry

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.

  1. Go to Containers in the sidebar
  2. Click Create Container
  3. Configure the container:
FieldValue
Nameweb-app
ImageYour Docker image
PortYour app's listening port
Compute ClassEco
CPU0.5 vCPU

Environment Variables​

Add your database connection as environment variables:

  1. Scroll to Environment Variables
  2. Add the following:
KeyValue
DATABASE_URLpostgresql://postgres:[email protected]:5432/postgres
NODE_ENVproduction
  1. 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.

  1. Navigate to Gateways
  2. Click Create Gateway
  3. Configure:
FieldValue
Nameweb-gateway
TypeHTTP/HTTPS
  1. Add a route:

    • Path: /
    • Target: web-app
    • Port: Your app's port
  2. 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:

  1. Go to Gateways > your gateway
  2. Click Add Listener
  3. Enter your hostname (e.g., app.yourdomain.com)
  4. SailOps will automatically create the DNS record and provision the SSL certificate

Option B: Manual DNS Configuration

  1. Go to your gateway details and copy the IP Address
  2. Create an A record in your DNS provider:
    app.yourdomain.com  A  <gateway-ip-address>
  3. Wait for DNS propagation (a few minutes to 24h)
  4. Add the listener in SailOps with your hostname
  5. SSL certificate will be provisioned automatically
DNS Provider Integration

Configure your DNS provider (Cloudflare, AWS Route53, etc.) in Project Settings > DNS Providers for automatic DNS management.

Step 5: Verify Your Deployment​

  1. Access your configured domain (e.g., https://app.yourdomain.com)
  2. Your application should load with HTTPS
  3. 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:

  1. Go to your container's Logs tab
  2. Look for error messages
  3. 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:

  1. Go to Containers > web-app > Autoscaling
  2. Enable autoscaling
  3. Configure:
SettingValue
Min Replicas1
Max Replicas5
CPU Target70%

Your application will now automatically scale based on load.

Common Deployment Patterns​

Multi-Service Architecture​

Deploy multiple containers that communicate internally:

Blue-Green Deployments​

  1. Deploy a new version to a new container
  2. Test it with a separate gateway
  3. Switch the main gateway to the new container
  4. Delete the old container

Environment Separation​

Create separate projects for different environments:

  • production - Live customer-facing app
  • staging - Pre-release testing
  • development - 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:

  1. Set up a custom domain
  2. Configure monitoring alerts
  3. Enable database backups
  4. Invite team members

Need deployment help? Contact us at [email protected]