Skip to content

Commit ef45b40

Browse files
committed
feat: create deploy your rollup section
Remove kurtosis from wordle tutorial. Rename wordle tutorial in menu to build your rollup. Create overview for deployments sections. Create docker compose deployment tutorial. Create kurtosis deployment tutorial. Refactor tutorials to reduce duplication.
1 parent fe845b2 commit ef45b40

File tree

5 files changed

+666
-470
lines changed

5 files changed

+666
-470
lines changed

.vitepress/config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,24 @@ function sidebarHome() {
256256
},
257257
],
258258
},
259+
{
260+
text: "Deploy Your Rollup",
261+
collapsed: true,
262+
items: [
263+
{
264+
text: "Overview",
265+
link: "/tutorials/deploy-overview",
266+
},
267+
{
268+
text: "Docker Compose",
269+
link: "/tutorials/docker-compose",
270+
},
271+
{
272+
text: "Kurtosis",
273+
link: "/tutorials/kurtosis",
274+
},
275+
],
276+
},
259277
],
260278
},
261279
{

tutorials/deploy-overview.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description: This page provides an overview of some common ways to deploy rollups.
3+
---
4+
5+
# Deploying Your Rollup
6+
7+
One of the benefits of building rollups with Rollkit is the flexibility you have as a developer to choose things like the DA layer, the settlement scheme, and the execution environment.
8+
9+
The challenge that comes with this flexibility is that there are more services that now need to be deployed and managed while running your rollup.
10+
11+
In the tutorials so far, you've seen various helper scripts used to make things easier. While great for tutorials, there are better ways to deploy and manage rollups than using various bash scripts.
12+
13+
In this section, you'll see a few examples of how you can deploy your rollup environment with all your services running in a more production-ready way.
14+
15+
:::warning Disclaimer
16+
These examples are for educational purposes only. Before deploying your rollup for production use you should fully understand the services you are deploying and your choice in deployment method.
17+
:::
18+
19+
* [Deploy with Docker Compose](/tutorials/docker-compose)
20+
* [Deploy with Kurtosis](/tutorials/kurtosis)

tutorials/docker-compose.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# 🐳 Docker Compose
2+
3+
This tutorial is going to show you how to deploy the [wordle rollup](/tutorials/wordle.md) using Docker Compose.
4+
5+
You can learn more about Docker Compose [here](https://docs.docker.com/compose/).
6+
7+
<!-- markdownlint-disable MD033 -->
8+
<script setup>
9+
import Callout from '../.vitepress/components/callout.vue'
10+
import constants from '../.vitepress/constants/constants.js'
11+
</script>
12+
13+
:::tip
14+
<Callout />
15+
:::
16+
<!-- markdownlint-enable MD033 -->
17+
18+
## 💻 Pre-requisites {#prerequisites}
19+
20+
Make sure you have your wordle rollup ready by completing [the Build Your Rollup tutorial](/tutorials/wordle.md).
21+
22+
## 🛠️ Dependencies {#dependencies}
23+
24+
### 💻 Docker Compose {#docker-compose}
25+
26+
You can [install docker compose here](https://docs.docker.com/compose/install/).
27+
28+
Once installed, you can verify the installation by running:
29+
30+
```bash
31+
docker compose version
32+
```
33+
```bash
34+
Docker Compose version v2.23.0-desktop.1
35+
```
36+
37+
## 🛠️ Setting up Your Environment {#setting-up-your-environment}
38+
39+
The wordle rollup is a relatively simple rollup in that there are just 2 nodes involved: the rollup and the data availability network (DA) node.
40+
41+
We will use a local DA node for this tutorial and run it with our rollup.
42+
43+
To save time, we can use the [local DA Dockerfile found here.](https://github.com/rollkit/local-da/blob/main/Dockerfile)
44+
45+
This will allow us to focus on how we can run the wordle rollup with Docker Compose.
46+
47+
### 🐳 Dockerfile {#dockerfile}
48+
49+
First, we need to create a Dockerfile for our wordle rollup. Create a new file called `Dockerfile` in the root of the `wordle` directory and add the following code:
50+
51+
```dockerfile
52+
# Stage 1: Install ignite CLI and rollkit
53+
FROM golang as base
54+
55+
# Install dependencies
56+
RUN apt update && \
57+
apt-get install -y \
58+
build-essential \
59+
ca-certificates \
60+
curl
61+
62+
# Install rollkit
63+
RUN curl -sSL https://rollkit.dev/install.sh | sh -s v0.13.6
64+
65+
# Install ignite
66+
RUN curl https://get.ignite.com/[email protected]! | bash
67+
68+
# Set the working directory
69+
WORKDIR /app
70+
71+
# cache dependencies.
72+
COPY ./go.mod .
73+
COPY ./go.sum .
74+
RUN go mod download
75+
76+
# Copy all files from the current directory to the container
77+
COPY . .
78+
79+
# Build the chain
80+
RUN ignite chain build && ignite rollkit init --local-da
81+
82+
# Initialize the rollkit.toml file
83+
RUN rollkit toml init
84+
85+
# Run rollkit command to initialize the entrypoint executable
86+
RUN rollkit
87+
88+
# Stage 2: Set up the runtime environment
89+
FROM debian:bookworm-slim
90+
91+
# Install jq
92+
RUN apt update && \
93+
apt-get install -y \
94+
jq
95+
96+
# Set the working directory
97+
WORKDIR /root
98+
99+
# Copy over the rollkit binary from the build stage
100+
COPY --from=base /go/bin/rollkit /usr/bin
101+
102+
# Copy the entrypoint and rollkit.toml files from the build stage
103+
COPY --from=base /app/entrypoint ./entrypoint
104+
COPY --from=base /app/rollkit.toml ./rollkit.toml
105+
106+
# Copy the $HOME/.wordle directory from the build stage.
107+
# This directory contains all your chain config.
108+
COPY --from=base /root/.wordle /root/.wordle
109+
110+
# Ensure the entrypoint script is executable
111+
RUN chmod +x ./entrypoint
112+
113+
# Keep the container running after it has been started
114+
CMD tail -f /dev/null
115+
```
116+
117+
This Dockerfile sets up the environment to build the rollup and run the wordle node. It then sets up the runtime environment to run the rollup. This allows you as the developer to modify any files, and then simply rebuild the Docker image to run the new rollup.
118+
119+
Build the docker image by running the following command:
120+
121+
```bash
122+
docker build -t wordle .
123+
```
124+
125+
You can then see the built image by running:
126+
127+
```bash
128+
docker images
129+
```
130+
131+
You should see the following output:
132+
133+
```bash
134+
REPOSITORY TAG IMAGE ID CREATED SIZE
135+
wordle latest 5d3533c1ea1c 8 seconds ago 443MB
136+
```
137+
138+
### 🐳 Docker Compose File {#docker-compose-file}
139+
140+
Next we need to create our `compose.yaml` file for docker compose to use.
141+
142+
In the root of the `wordle` directory, create a new file called `compose.yaml` and add the following code:
143+
144+
```yml
145+
version: "3"
146+
services:
147+
# Define the wordle rollup service
148+
wordle:
149+
# Set the name of the docker container for ease of use
150+
container_name: wordle
151+
# Use the image we just built
152+
image: wordle
153+
# Used for networking between the two services
154+
network_mode: host
155+
# The command config is used for launching the GM rollup once the Docker container is running
156+
command: rollkit start --rollkit.aggregator --rollkit.da_address http://localhost:7980
157+
# Ensures the local-da service is up and running before starting the rollup
158+
depends_on:
159+
- local-da
160+
161+
# Define the local DA service
162+
local-da:
163+
# Use the published image from rollkit
164+
image: ghcr.io/rollkit/local-da:v0.2.1
165+
# Set the name of the docker container for ease of use
166+
container_name: local-da
167+
# Publish the ports to connect
168+
ports:
169+
- "7980:7980"
170+
```
171+
172+
We now have all we need to run the wordle rollup and connect to a local DA node.
173+
174+
### 🚀 Run Wordle Rollup {#run-wordle-rollup}
175+
176+
Run your wordle rollup by running the following command:
177+
178+
```bash
179+
docker compose up
180+
```
181+
182+
You'll see logs of your rollup being output.
183+
184+
Congratulations! You have successfully run the wordle rollup with Docker Compose.
185+
186+
## 🚀 Interacting with the Rollup {#interacting-with-the-rollup}
187+
188+
Since we are using docker images, we can interact with the rollup by entering the docker container.
189+
190+
You can see the docker containers running with the wordle rollup and the local DA node by running the following command:
191+
192+
```bash
193+
docker ps
194+
```
195+
196+
You should see output like the following:
197+
198+
```bash
199+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
200+
cbf66a881cb2 wordle:latest "/bin/sh -c 'rollkit…" 5 seconds ago Up 4 seconds 0.0.0.0:26657->26657/tcp wordle
201+
09bdf1e94862 ghcr.io/rollkit/local-da:v0.2.1 "local-da -listen-all" 6 seconds ago Up 5 seconds 0.0.0.0:7980->7980/tcp local-da
202+
```
203+
204+
We can see the wordle rollup running in container `wordle` and the local DA network running in container `local-da`.
205+
206+
Since our rollup is running in a docker container, we want to enter the docker container to interact with it via the Rollkit CLI. We can do this by running:
207+
208+
```bash
209+
docker exec -it wordle sh
210+
```
211+
212+
Now that you are in the docker container, you can interact with the rollup using the Rollkit CLI and the example commands you used in the [Wordle tutorial](/tutorials/wordle#interacting-with-the-rollup).
213+
214+
Once you are done interacting with your rollup, you can exit out of your docker container with:
215+
216+
```bash
217+
exit
218+
```
219+
220+
Then you can shut down your rollup environment by running `CRTL+C` in your terminal.
221+
222+
## 🎉 Next steps
223+
224+
Congratulations again! You now know how to run your rollup with docker compose and interact with it using the Rollkit CLI in the docker container.

0 commit comments

Comments
 (0)