Local Development
This tutorial walks you through installing a development Rack and deploying your first application to it.
Prerequisites
Before you begin, install the following:
Verify your rack
Confirm that your development Rack is running:
$ convox rack
Name dev
Provider local
Router router.dev.localdev.convox.cloud
Status running
Version 3.23.3
Deploy an example application
Clone the example
git clone https://github.com/convox-examples/rails.git
cd rails
Review the convox.yml
resources:
database:
type: postgres
services:
web:
build: .
health: /health
port: 3000
resources:
- database
This manifest defines:
- A
webService that listens on port 3000 with a health check at/health - A PostgreSQL Resource named
database, whose connection string is injected as theDATABASE_URLenvironment variable
Create the app
convox apps create rails
Start local development
convox start
The first run will take longer than usual as images are pulled and built for the first time.
Once running, you will see application logs streaming in your terminal.
View the application
In a second terminal, find the URL for your application:
$ convox services
SERVICE DOMAIN PORTS
web web.rails.dev.localdev.convox.cloud 443:3000
Open https://web.rails.dev.localdev.convox.cloud in your browser.
Your browser will show a certificate warning because the local Rack uses self-signed TLS certificates. This is expected for local development.
Make a change
Edit config/routes.rb and add the following line before the final end:
get "/test", to: proc { [200, {}, ["Hello World!"]] }
You will see the file sync in your first terminal:
convox | sync: config/routes.rb to /usr/src/app on web
Open https://web.rails.dev.localdev.convox.cloud/test to see your change.
Run a command
Use convox run to execute one-off commands against your application:
convox run web rake db:migrate
Next steps
- Deploying an Application to deploy to a production Rack
- Running Locally for more details on
convox start