Skip to content

Commit 24a2efa

Browse files
authored
[SEQ-31] Setup script for local OP Stack devnet (#2)
* feat: Add post-create script for devnet * doc: Add comment on devnet initialization * feat: Switch to Justfile for installation * fix: Justfile setup * chore: Remove bash script * refactor: Dramatically simplify PATH export This also improves Foundry handling, which lets Foundry installs succeed on the first attempt * chore: Fix Justfile syntax * chore: Clean up Justfile to be more idiomatic * feat: Copy justfile to home directory for devnet commands * docs: Specify that devnet is op-devnet In contrast to an eventual Metabased devnet
1 parent 2e781c6 commit 24a2efa

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Ubuntu Latest LTS Dev Container",
2+
"name": "Metabased Dev Container",
33
// From https://github.com/devcontainers/images/tree/main/src/base-ubuntu
44
// The default image is pinned to Ubuntu Focal 20.04: https://github.com/devcontainers/images/blob/main/src/universal/.devcontainer/Dockerfile#L6
55
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
@@ -53,6 +53,11 @@
5353
// Use 'forwardPorts' to make a list of ports inside the container available locally.
5454
// "forwardPorts": [],
5555

56+
// Update package lists
57+
// Without this, just won't be found
58+
// After that, initialize the devnet
59+
"postCreateCommand": "sudo apt update && sudo apt install -y just && just -f ${containerWorkspaceFolder}/.devcontainer/justfile all",
60+
5661
// Configure tool-specific properties.
5762
"customizations": {
5863
// Configure properties specific to VS Code.

.devcontainer/justfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Add Foundry's bin directory to the PATH for all recipes
2+
export PATH := env_var('PATH') + ":" + env_var('HOME') + "/.foundry/bin"
3+
4+
# Clone the Optimism repository
5+
clone:
6+
git clone https://github.com/ethereum-optimism/optimism.git ~/optimism
7+
8+
# Install Foundry
9+
install-foundry:
10+
just --working-directory ~/optimism install-foundry
11+
12+
# Initialize op-devnet
13+
op-devnet-up:
14+
make --directory ~/optimism op-devnet-up
15+
@echo "OP Devnet initialized"
16+
17+
# Shut down devnet
18+
op-devnet-down:
19+
make --directory ~/optimism op-devnet-down
20+
@echo "OP Devnet shut down"
21+
22+
# Run all steps in sequence
23+
# OP Devnet setup based on https://docs.optimism.io/chain/testing/dev-node
24+
all: clone install-foundry op-devnet-up op-devnet-down copy-justfile
25+
@echo "Post-create script completed successfully"
26+
27+
# Copy Justfile to ~/Metabased.justfile
28+
# This gives easy access to op-devnet commands after the container is created
29+
copy-justfile:
30+
cp {{justfile()}} ~/metabased-devnet.justfile
31+
@echo "Justfile copied to ~/metabased-devnet.justfile"

0 commit comments

Comments
 (0)