Skip to content

Commit

Permalink
Brew install is working! Minimal setup and in-line with their specifi…
Browse files Browse the repository at this point in the history
…cations.
  • Loading branch information
GatlenCulp committed Sep 15, 2024
1 parent 9d07e87 commit c432bed
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .env.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
POSTGRES_DB=vivaria
POSTGRES_USER=vivaria
POSTGRES_PASSWORD=WAWT29rM9PM6YFEyhrVm5XpTkay+Hy42GXNc2su8Ez0=
PG_READONLY_USER=vivariaro
PG_READONLY_PASSWORD=Xsn6yvwN5K5I2HR2Giw4BPdSKqvq/dU4BbxqR7psvyA=
11 changes: 11 additions & 0 deletions .env.server
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ACCESS_TOKEN_SECRET_KEY=wVPfe2P9Wikisy2ZJmaaZSqW7Z8h581h/JrYBuWbkig=
ACCESS_TOKEN=dyMeB7g3/6Ny+NGlIczL2+Gq5uVQvRjQugDfgBQBfRs=
ID_TOKEN=XCJy1Y9WD9ouTYLzwUMD1tFAg0egvcVN2uz77vSuPbo=
AGENT_CPU_COUNT=1
AGENT_RAM_GB=4
DOCKER_BUILD_PLATFORM=linux/arm64
PGDATABASE=vivaria
PGUSER=vivaria
PGPASSWORD=WAWT29rM9PM6YFEyhrVm5XpTkay+Hy42GXNc2su8Ez0=
PG_READONLY_USER=vivariaro
PG_READONLY_PASSWORD=Xsn6yvwN5K5I2HR2Giw4BPdSKqvq/dU4BbxqR7psvyA=
70 changes: 23 additions & 47 deletions Formula/vivaria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class Vivaria < Formula
desc "Task environment setup tool for AI research"
# AUTHORS: METR <[email protected]>
homepage "https://vivaria.metr.org/"
url "https://github.com/GatlenCulp/vivaria/archive/refs/tags/v0.1.1.tar.gz"#, tag: "v0.1.0"
url "https://github.com/GatlenCulp/vivaria/archive/refs/tags/v0.1.2.tar.gz"#, tag: "v0.1.0"

Check failure on line 6 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Layout/LeadingCommentSpace: Missing space after `#`.

Check failure on line 6 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Layout/SpaceBeforeComment: Put a space before an end-of-line comment.

Check failure on line 6 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Layout/LeadingCommentSpace: Missing space after `#`.

Check failure on line 6 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Layout/SpaceBeforeComment: Put a space before an end-of-line comment.
version "0.1.0" # TODO: Grab the version from the tag(?)
sha256 "3360781d374e010e2b6c7a86b2cc5a91b51d6b2c5337d14788858a719af943d2"
sha256 "2ad566ffd8836670dd5a5639b8f30efbbedf0fb76d250315aae9b38085188042"
license "MIT"
head "https://github.com/METR/vivaria.git", branch: "main"

Expand All @@ -17,6 +17,7 @@ class Vivaria < Formula
depends_on "docker" => :run
depends_on "docker-compose" => :run
depends_on "[email protected]"
depends_on "rust" => :build # Needed for pydantic

Check failure on line 20 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

FormulaAudit/DependencyOrder: dependency "rust" (line 20) should be put before dependency "[email protected]" (line 19)

Check failure on line 20 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

FormulaAudit/DependencyOrder: dependency "rust" (line 20) should be put before dependency "[email protected]" (line 19)

DEV_MODE = false

Expand Down Expand Up @@ -91,55 +92,30 @@ class Vivaria < Formula
end

def install

# Install dependencies and the CLI in a virtualenv
venv = virtualenv_create(libexec/"venv", "python3.11")
venv.pip_install resources
venv.pip_install buildpath/"cli"

Check failure on line 99 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Layout/TrailingWhitespace: Trailing whitespace detected.

Check failure on line 99 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Layout/TrailingWhitespace: Trailing whitespace detected.
# Install scripts (places in prefix/bin and HOMEBREW_PREFIX/bin)
bin.install libexec / "venv/bin/viv"
bin.install "scripts/setup-docker-compose.sh" => "viv-setup-docker-compose"
bin.install "scripts/configure-cli-for-docker-compose.sh" => "viv-configure-cli-for-docker-compose"

Check failure on line 104 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Layout/TrailingWhitespace: Trailing whitespace detected.

Check failure on line 104 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Layout/TrailingWhitespace: Trailing whitespace detected.
# # Set permissions if necessary
# chmod 0755, bin/"viv-setup-docker-compose"
# chmod 0755, bin/"viv-configure-cli-for-docker-compose"

Check failure on line 108 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Layout/TrailingWhitespace: Trailing whitespace detected.

Check failure on line 108 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Layout/TrailingWhitespace: Trailing whitespace detected.
# Copy everything except certain directories
prefix.install Dir["*"]
prefix.install Dir[".*"].select { |f| File.file?(f) }

# Exclude specific directories if they exist
rm_rf prefix/".devcontainer"
rm_rf prefix/".github"
rm_rf prefix/".vscode"

# Set permissions for scripts
# chmod 0755, prefix/"scripts/setup-docker-compose.sh"
# chmod 0755, prefix/"scripts/configure-cli-for-docker-compose.sh"

# These scripts must be run in the prefix directory to generate the files in the correct location
Dir.chdir(prefix) do
# TODO: Check if libxec is a better way to run these scripts
# TODO: Check if it is better to set up docker compose in etc since these are configuration files.
system "./scripts/setup-docker-compose.sh"
raise "Setup script failed" unless $?.success?

# NOTE: Viv must be available via the command line before this is run.
# system "./scripts/configure-cli-for-docker-compose.sh"
# raise "Configuration script failed" unless $?.success?
end

# def cli_setup
# # TODO: Set up a "developer install" of the CLI. Is this useful or should they just work from a cloned repo?
# Dir.chdir(prefix) do

# venv = libexec/"venv"
# ENV["VIRTUAL_ENV"] = venv
# venv.mkpath
# system "python3", "-m", "venv", venv

# with_env(PATH: "#{venv}/bin:#{ENV["PATH"]}") do
# system "#{venv}/bin/pip", "install", "-v", "--no-deps", buildpath/"cli"
# end

# # Create the wrapper script in the bin directory
# (bin/"viv").write <<~EOS
# #!/bin/bash
# VENV_PATH="#{venv}"
# source "$VENV_PATH/bin/activate"
# "$VENV_PATH/bin/viv" "$@"
# deactivate
# EOS
# chmod 0755, bin/"viv"
# end
# Clean up unnecessary directories
rm_rf ".devcontainer"

Check failure on line 114 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.

Check failure on line 114 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.
rm_rf ".github"

Check failure on line 115 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.

Check failure on line 115 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.
rm_rf ".vscode"

Check failure on line 116 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.

Check failure on line 116 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.
rm_rf "cli" # This is installed in the virtualenv

Check failure on line 117 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.

Check failure on line 117 in Formula/vivaria.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

Homebrew/NoFileutilsRmrf: Use `rm` or `rm_r` instead of `rm_rf`, `rm_f`, or `rmtree`.
rm_rf "ignore"

(etc/"vivaria").mkpath

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

`curl -L https://github.com/GatlenCulp/vivaria/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256`

= `eabcf6b3d0d63ba37cd6af03c0566e981d333b5a06fd38dd61102e9f72941ecd`
= `2ad566ffd8836670dd5a5639b8f30efbbedf0fb76d250315aae9b38085188042`

brew update-python-resources vivaria

Uncertain why this is needed before installing:
`brew link docker`
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
proxy:
image: quay.io/panubo/sshd
ports:
- "2222:22"
volumes:
- "${SSH_PUBLIC_KEY_PATH-~/.ssh/id_rsa.pub}:/etc/authorized_keys/agent:ro"
environment:
TCP_FORWARDING: true
SSH_USERS: "agent:48:48"
networks:
- full-internet
- no-internet

0 comments on commit c432bed

Please sign in to comment.