6.9 KiB
Getting Started with Containr
Welcome to Containr! This guide will walk you through setting up your first project and deploying your first application.
Prerequisites
Before you begin, make sure you have:
- A Containr instance running (either self-hosted or using our hosted version)
- A Git repository with your application code
- Basic knowledge of Docker and containerization concepts
Step 1: Create Your Account
- Navigate to your Containr instance URL
- Click "Sign Up" in the top-right corner
- Fill in your email, name, and password
- Verify your email address (if required)
- Log in to your new account
Step 2: Create Your First Project
- From the dashboard, click "New Project"
- Enter a project name (e.g., "my-awesome-app")
- Add an optional description
- Click "Create Project"
You'll be taken to your project's main canvas view.
Step 3: Connect Your Git Repository
Option A: Using GitHub (Recommended)
- Click "Add Service" → "Connect Git Repository"
- Select "GitHub" as the provider
- Click "Connect to GitHub" and authorize Containr
- Browse your repositories and select the one you want to deploy
- Choose the branch (usually
mainormaster) - Select the root directory if your app isn't in the root
- Click "Connect Repository"
Option B: Using Other Git Providers
Containr also supports GitLab and Bitbucket:
- Click "Add Service" → "Connect Git Repository"
- Select your preferred provider
- Follow the authorization flow
- Select your repository and branch
Step 4: Configure Your Service
After connecting your repository, Containr will:
- Auto-detect your stack (Node.js, Python, Go, etc.)
- Generate a build plan using Nixpacks
- Show you the configuration
Basic Configuration
- Service Name: Give your service a descriptive name
- Build Command: Auto-detected, but you can customize
- Start Command: Auto-detected, but you can customize
- Environment Variables: Add any needed variables
Example: Node.js Application
For a typical Node.js app:
# Build Command (auto-detected)
npm install && npm run build
# Start Command (auto-detected)
npm start
Example: Go Application
For a Go application:
# Build Command (auto-detected)
go build -o app .
# Start Command (auto-detected)
./app
Step 5: Add Environment Variables
Most applications need environment variables:
- Go to the "Variables" tab in your service
- Add your variables as key-value pairs:
NODE_ENV=productionDATABASE_URL=postgresql://...API_KEY=your-secret-key
- Variables are automatically encrypted and injected at runtime
Step 6: Deploy Your Application
- Click "Deploy" in the top-right corner
- Choose your deployment method:
- Deploy Latest Commit: Deploy the latest commit from your branch
- Manual Deploy: Specify a commit SHA
- Click "Start Deployment"
Containr will:
- Pull your code from Git
- Build a Docker image using Nixpacks
- Start the container
- Assign a public URL
Step 7: Monitor Your Deployment
While deploying, you can:
- View Build Logs: See the build process in real-time
- Check Status: Monitor deployment progress
- Get Notifications: Receive alerts on success or failure
Once deployed, you'll see:
- Public URL: Your application is live at
https://your-service-name.containr.app - Status: Green checkmark if running successfully
- Metrics: CPU, memory, and network usage
Step 8: Add a Database (Optional)
Most applications need a database:
- Click "Add Service" → "Add Database"
- Choose your database type:
- PostgreSQL: For relational data
- Redis: For caching and sessions
- MySQL: For MySQL compatibility
- Configure:
- Database name
- Version
- Size allocation
- Click "Create Database"
Connect Your Application
Once the database is created:
- Go to your service's "Variables" tab
- Add the database connection URL:
DATABASE_URL=postgresql://username:password@hostname:port/database_name - Redeploy your application
Step 9: Set Up Preview Environments
Enable automatic preview environments for pull requests:
- Go to project settings
- Enable "Preview Environments"
- Configure:
- Automatic cleanup (e.g., 7 days)
- Branch patterns (e.g.,
feature/*,fix/*)
- Save settings
Now when you create a pull request:
- A preview environment is automatically created
- You get a unique URL for testing
- Environment is cleaned up after merging
Step 10: Configure Custom Domain (Optional)
To use your own domain:
- Go to your service's "Settings" tab
- Click "Add Custom Domain"
- Enter your domain (e.g.,
app.yourdomain.com) - Configure DNS:
CNAME app.yourdomain.com -> your-service-name.containr.app - Wait for SSL certificate provisioning
Troubleshooting Common Issues
Build Failures
Problem: Build fails during deployment
Solutions:
- Check build logs for specific error messages
- Verify your
package.json,go.mod, orrequirements.txtis valid - Ensure all dependencies are properly declared
- Check for syntax errors in your code
Runtime Errors
Problem: Application starts but crashes
Solutions:
- Check runtime logs in the "Logs" tab
- Verify environment variables are correctly set
- Ensure your application listens on the correct port (default:
$PORT) - Check database connection strings
Port Issues
Problem: Application can't be accessed
Solutions:
- Ensure your application listens on the
$PORTenvironment variable - Don't hardcode ports in your application
- Example for Node.js:
const port = process.env.PORT || 3000; app.listen(port, () => { console.log(`Server running on port ${port}`); });
Best Practices
Security
- Never commit secrets to your repository
- Use environment variables for all sensitive data
- Enable HTTPS (automatic on Containr)
- Keep dependencies updated
Performance
- Optimize Docker images by using
.dockerignore - Enable caching for faster builds
- Monitor resource usage and scale as needed
- Use CDN for static assets
Development Workflow
- Use feature branches for new features
- Enable preview environments for testing
- Write tests and run them in CI/CD
- Monitor deployments and set up alerts
Next Steps
Now that you have your first application deployed:
- Explore the Advanced Configuration guide
- Learn about Scaling and Load Balancing
- Set up Monitoring and Alerts
- Join our Community
Need Help?
- Documentation: containr.dev/docs
- Community: GitHub Discussions
- Support: support@containr.dev
- Status: status.containr.dev
Happy deploying! 🚀