Database Setup for Self-Hosting
Overview
When you first start your self-hosted DeployStack instance, you’ll need to choose and configure a database. This guide will walk you through the process step-by-step. Important: This setup only needs to be done once when you first install DeployStack.What You’ll Need
- Your DeployStack instance running (backend and frontend)
- Access to your server’s environment variables (if choosing cloud databases)
- About 5-10 minutes to complete the setup
Step 1: Access the Setup Page
- Start your DeployStack instance following your installation guide
- Open your web browser and navigate to your DeployStack URL
- You’ll be automatically redirected to the setup page at
/setup
Step 2: Choose Your Database
You’ll see two database options. Here’s what each one means:Option 1: SQLite (Recommended for Most Users)
- Best for: Small to medium teams, development, testing
- Pros:
- No additional setup required
- Works immediately
- No external dependencies
- Perfect for getting started
- Cons:
- Single server only (no clustering)
- Limited to one database file
Option 2: Turso (For Advanced Users)
- Best for: Advanced users needing distributed databases
- Pros:
- Multi-region replication
- Advanced SQLite features
- Good performance
- Cons:
- Requires Turso account
- More complex setup
Step 3: Configure Your Chosen Database
If You Chose SQLite (Easiest)
- Select “SQLite” from the options
- Click “Setup Database”
- Wait for confirmation (usually takes 10-30 seconds)
- Done! You’ll be redirected to the main application
If You Chose Turso
Before you can use Turso, you need to set up environment variables:Prerequisites
- Create a Turso account at turso.tech
- Install Turso CLI and create a database:
- Get your database URL and auth token:
Server Configuration
Add these environment variables to your server:Complete Setup
- Restart your DeployStack instance after setting the environment variables
- Go back to the setup page (
/setup
) - Select “Turso”
- Click “Setup Database”
- Wait for confirmation
Step 4: Verify Setup
After successful setup, you should:- See a success message confirming database initialization
- Be redirected to the main application
- Be able to create your first user account
Troubleshooting
”Database setup has already been performed”
- This means your database is already configured
- You can proceed to use the application normally
- If you need to change databases, contact your system administrator
”Configuration incomplete” or “Missing environment variables”
- For Turso: Check that both Turso environment variables are set correctly
- Restart your server after setting environment variables
”Failed to connect” or “Network error”
- Check your internet connection
- For Turso: Verify your database URL and auth token are correct
- Check server logs for more detailed error messages
Setup page keeps loading
- Check that your backend server is running
- Verify the backend is accessible from your browser
- Check browser console for any JavaScript errors
Changing Databases Later
Important: Once you’ve set up a database, changing to a different type requires:- Backing up your data (if you have important information)
- Stopping your DeployStack instance
- Removing the database selection file (
persistent_data/db.selection.json
) - Updating environment variables for the new database type
- Restarting and going through setup again
Getting Help
If you’re having trouble with database setup:- Check the server logs for detailed error messages
- Verify environment variables are set correctly
- Ensure your server has internet access (for cloud databases)
- Contact support with your error messages and setup details
Security Notes
- Keep your API tokens secure - never share them publicly
- Use environment variables - don’t put credentials directly in code
- Regularly rotate API tokens for cloud databases
- Backup your SQLite database file if using SQLite
Next Steps
After successful database setup:- Create your administrator account
- Configure your application settings
- Set up user authentication (email, GitHub, etc.)
- Invite your team members