This guide shows you how to set up, update, and maintain a self-hosted Sure application with Docker Compose.Documentation Index
Fetch the complete documentation index at: https://sure-917046f5-docs-backup-restore-clarity.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Docker Engine installed and running
- Basic familiarity with the command line
Installation
Install Docker
- Follow the official Docker installation guide
- Start the Docker service on your machine
- Verify the installation:
Create your application directory
Create a directory where your app will run:Download the Docker Compose file
Download the sample compose file from the Sure repository:compose.yml file in your current directory with the default configuration.
Configuration
By default, thecompose.example.yml file runs without any configuration. For production deployments or if you’re running outside of a local network, follow these steps to add security.
Email configuration
To enable email notifications and password resets, configure SMTP settings in your.env file:
SSL/TLS options
For SMTP servers with custom SSL certificates or self-signed certificates: Skip TLS verification (not recommended for production):SSL_CA_FILE option allows you to specify a custom CA certificate file for SSL verification when connecting to SMTP servers with self-signed or internal certificates.
Create an environment file
Create a.env file where Docker will read environment variables:
Generate a secret key
Generate a secret key using one of these methods: With OpenSSL:Configure environment variables
Open the.env file in your text editor and add:
Market data provider variables
Sure supports multiple securities pricing providers. You can configure them through environment variables or in the UI under Settings > Self-Hosting. See market data providers for details on each provider.Setting
SECURITIES_PROVIDERS as an environment variable takes precedence over the UI setting. Leave it unset to manage providers from the UI only.Running the application
Start the application
Start the app to verify everything is working:http://localhost:3000. You should see the Sure login screen.
Create your account
On first run, register a new account:- Click “Create your account” on the login page
- Enter your email
- Enter a password
Run in the background
To run Sure in the background:- Stop the current process with
Ctrl+C - Start in detached mode:
http://localhost:3000.
Updating
The Docker image in yourcompose.yml file controls which version of Sure you’re running:
Recommended images
ghcr.io/we-promise/sure:latest- Latest alpha releaseghcr.io/we-promise/sure:stable- Latest stable release
Update to the latest version
Your app does not automatically update. To update:Change update channel
To switch between update channels, edit thecompose.yml file:
Backup service
The Docker Compose configuration includes an optional backup service that automatically backs up your PostgreSQL database.What to back up
For a complete recovery plan, make sure you know which of these apply to your deployment:- PostgreSQL database: accounts, transactions, settings, users, and metadata
- Local file storage: uploaded files stored on disk by the app
- External object storage: uploaded files stored in S3, R2, or another object store
- Environment and deployment config: your
.env,compose.yml, secrets, and any reverse proxy or DNS setup needed to bring the app back online
Enabling backups
The backup service uses Docker Compose profiles and is disabled by default. To enable it:Configure backup settings
The backup service uses the following default settings:- Schedule: Daily at midnight
- Retention: 7 daily backups, 4 weekly backups, 6 monthly backups
- Location:
/opt/sure-data/backupson your host machine
backup service in your compose.yml file:
Backup schedule options
You can use cron syntax or these shortcuts:@hourly- Every hour@daily- Once per day at midnight@weekly- Once per week@monthly- Once per month- Custom cron:
0 2 * * *(2 AM daily)
Restore from a PostgreSQL backup
Use this process when you have a SQL dump created by the backup service or withpg_dump.
[!NOTE] If you customized the PostgreSQL username, password, or database name in your.envorcompose.yml, replacesure_userandsure_productionin the commands below.
- Stop the application containers so they do not write to the database during the restore:
- Start or keep the database container running:
-
Locate the backup file in your backup directory, for example
/opt/sure-data/backups. - Restore the SQL backup into PostgreSQL:
- Restart the app:
Restore local uploaded files
If your Sure instance stores uploaded files on the local filesystem, restoring the database alone is not enough. You must also restore the app’s storage directory from the matching file backup. The exact host path depends on how you mapped volumes incompose.yml. Restore the same directory that Sure uses for local storage, then restart the app containers.
If you are using external object storage instead of local disk, restore those files using that provider’s backup or versioning workflow instead.
Verify the restore
After restoring, check the following:- You can sign in successfully
- Your accounts and transactions appear as expected
- Uploaded files open correctly, if you use uploads
- The web and worker containers start cleanly without repeated errors
Verifying backups
Check that backups are running correctly:SSL certificate configuration
For self-hosted environments using self-signed certificates or custom certificate authorities, Sure provides SSL configuration options.Environment variables
Add these variables to your.env file:
- Your environment uses self-signed certificates
- You need to trust a custom certificate authority
- Corporate proxies inject their own certificates
true)
- Set to
falseto disable SSL verification (not recommended for production) - Only disable verification in development or testing environments
compose.yml:
Optional: SSL/TLS Configuration
Sure supports additional SSL/TLS configuration options for secure email delivery and API connections.Custom CA Certificate
If you’re using a custom Certificate Authority (CA) or self-signed certificates, you can specify a CA file:- Running Sure in a corporate environment with internal CAs
- Using self-signed certificates for development
- Connecting to services with custom certificate chains
Skip TLS Verification for Email
For development or testing environments, you can disable TLS verification for the email mailer:- Development environments with self-signed certificates
- Testing email functionality locally
- Internal mail servers with custom certificates
- Always use valid SSL/TLS certificates in production
- Use the
SSL_CA_FILEoption instead of disabling verification - Ensure your SMTP server supports STARTTLS
Mailer SSL configuration
For SMTP connections, additional SSL options are available:true)
SMTP_OPENSSL_VERIFY_MODE: SSL verification mode for SMTP
none: Skip SSL verificationpeer: Verify the server certificate (default)
Security considerations
For production deployments:- Use properly signed certificates from a trusted CA
- Keep
SSL_VERIFY=true - Use
SMTP_OPENSSL_VERIFY_MODE=peer - If you must use self-signed certificates, provide a CA bundle via
SSL_CA_FILE
Troubleshooting
Database connection errors
If you encounterActiveRecord::DatabaseConnectionError on first startup, Docker may have initialized the Postgres database with a different default role from a previous attempt.
Reset the database:
Slow CSV imports
If CSV imports are processing rows slower than expected, check your worker logs for errors:sure-worker container requires Redis to process CSV imports.
Getting help
If you find bugs or have feature requests:- Read the contributing guide
- Ask in the Discord
- Open an issue