Skip to content

Instantly share code, notes, and snippets.

@jeremysmithco
Created February 1, 2026 01:55
Show Gist options
  • Select an option

  • Save jeremysmithco/1aa202287fc64333a24f8ad059d64d1b to your computer and use it in GitHub Desktop.

Select an option

Save jeremysmithco/1aa202287fc64333a24f8ad059d64d1b to your computer and use it in GitHub Desktop.
Conductor Setup for Rails App 2026-01-31
#======================
# Setup
#======================
docker compose -f $CONDUCTOR_ROOT_PATH/docker-compose.yml up -d
sed -e "s/^DATABASE_PREFIX=$/DATABASE_PREFIX=${CONDUCTOR_WORKSPACE_NAME}-/" \
"$CONDUCTOR_ROOT_PATH/.env.development" > .env.development
sed -e "s/^DATABASE_PREFIX=$/DATABASE_PREFIX=${CONDUCTOR_WORKSPACE_NAME}-/" \
"$CONDUCTOR_ROOT_PATH/.env.test" > .env.test
bundle install
yarn install
bin/rails db:prepare
RAILS_ENV=test bin/rails db:prepare
#======================
# Run
#======================
docker compose -f $CONDUCTOR_ROOT_PATH/docker-compose.yml up -d
PORT=$CONDUCTOR_PORT bin/dev
#======================
# Archive
#======================
eval "$(mise activate bash)"
docker compose -f $CONDUCTOR_ROOT_PATH/docker-compose.yml up -d
bin/rails log:clear tmp:clear
bin/rails db:drop
RAILS_ENV=test bin/rails db:drop
@jeremysmithco
Copy link
Author

jeremysmithco commented Feb 1, 2026

I've been using Conductor pretty heavily since last weekend, and iterating on my scripts for various Rails apps.

I'm finding that there are so many things that are particular to one setup that might determine what should go in these scripts.

For me and the Rails apps I work on, it's the following:

  • Bash for shell
  • Mise for Ruby/Node version management
  • Docker Compose for Postgres/Redis services
  • dotenv for local ENV var management
  • Foreman for process management

Here’s an explanation of each script…

Setup

  • Start up my database services and run in detach mode (if they aren't already started)
  • Copy environment variable files from the conductor root path to the new workspace and change the database prefix environment variable to the workspace name with a dash. This will allow for separate databases per workspace when I use a database URL environment variable like this: DATABASE_URL=postgres://postgres:password@localhost:5442/${DATABASE_PREFIX}app_development
  • Install Ruby gems and JavaScript packages
  • Create and seed development and test databases for the workspace

Run

  • Start up my database services and run in detach mode (if they aren't already started)
  • Start Foreman processes and use the CONDUCTOR_PORT for the web server

Archive

  • Activate Mise (I'm not sure why this is needed here)
  • Start up my database services and run in detach mode (if they aren't already started)
  • Clear Rails logs and tmp directory
  • Drop development and test databases for the workspace

Also, depending on the app, I may need to use sed to replace other ENV var port values with CONDUCTOR_PORT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment