I’d like to try the new Codex AI and see if it’s suitable for our use cases.

This is an example of how to set it up for a Rails project.

Requirements

Create a new environment

Create a new environment

Select the organisation and repository you want to set up

Add any required environment variables for your dev environment;

Exporting variables from the setup script does not work

You must add environment variables using the UI, the script runs as a bash script and the variables are only available when it’s executing.

Select the correct Ruby version for your application from the preinstalled packages.

Configure the Setup Script for your application.

This is an example for my Rails application. I want Codex to be able to run tests, and to avoid it executing commands on dev and getting lost, I’m setting RAILS_ENV=test in the environment variables.

Because I noticed Claude and Codex usually run migrations on dev and get lost, I’m forcing the environment to always be test.

  • Database URL, in this example: postgresql://postgres:portgres@localhost:5432/gondola_test
[#!/bin/bash
set -e

# Install PostgreSQL
apt-get update
apt-get install -y --no-install-recommends postgresql

# Install chrome and chromedriver to be able to run system tests
npx --yes puppeteer browsers install chrome@stable 
npx --yes puppeteer browsers install chromedriver@stable

# Get the latest Chrome path
export CHROME_PATH=$(npx puppeteer browsers list | grep '^chrome@' | tail -n1 | awk '{ print $3 }')
ln -sf "$CHROME_PATH" /usr/local/bin/google-chrome
chmod +x /usr/local/bin/google-chrome

# Get matching ChromeDriver path
export CHROMEDRIVER_PATH=$(npx puppeteer browsers list | grep '^chromedriver@' | tail -n1 | awk '{ print $3 }')
ln -sf "$CHROMEDRIVER_PATH" /usr/local/bin/chromedriver
chmod +x /usr/local/bin/chromedriver

# Start PostgreSQL
service postgresql start

# Set password for postgres user
su - postgres -c "psql -c \"ALTER USER postgres WITH PASSWORD 'postgres';\""

# Install Ruby dependencies
bundle install

# Prepare test DB
RAILS_ENV=test bin/rails db:create db:schema:load](<# Install PostgreSQL and Chrome Driver
apt-get update
apt-get install -y --no-install-recommends postgresql

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt install -y ./google-chrome-stable_current_amd64.deb

# Start PostgreSQL
service postgresql start

# Set password to portgres user to allow Rails connections
su - postgres -c "psql -c \"ALTER USER postgres WITH PASSWORD 'postgres';\""

# Install dependencies
bundle install
# Setup Test DB
RAILS_ENV=test bin/rails db:create db:schema:load>)

Ensure that you initialise the test terminal and can run your tests successfully.

That’s it, it requires a bit of trial and error, but you can test right there.

Buggy inteface

I noticed my setup script being updated after running a failed test, so make sure you save the environment before running the test terminal.

I’m curious to see if I will be able to get anything good out of it. I will let you know…

References