🐳Docker
Authors: [Vince | Nodeify]
Last updated at date: 10.04.2024 - updated opgeth and opnode images
System Requirements
8c CPU
Ubuntu 22.04
>= 16GB
>= 5TB
Base 🔵
Official Docs https://docs.base.org/guides/run-a-base-node/
Pre-requisites
Update, upgrade, and clean the system, and then firewall management (ufw), Docker, and the Git version control system.
sudo apt update -y && sudo apt upgrade -y && sudo apt auto-remove -y
sudo apt install docker.io docker-compose git ufw -ySet explicit default UFW rules
sudo ufw default deny incoming
sudo ufw default allow outgoingAllow SSH, HTTP and HTTPS
sudo ufw allow 22/tcp
sudo ufw allow 80
sudo ufw allow 443Setting up a domain name to access RPC
Get the IP address of the host machine, you can use the following command in a terminal or command prompt
Set an A record for a domain, you need to access the domain's DNS settings and create an A record that points to the IP address of the host machine. This configuration allows users to reach your domain by resolving the domain name to the specific IP address associated with your host machine. Example video of How to Point a Domain Name to an IP Address
Create base directory
The first command, mkdir base, will create a new directory named base in the current location. The second command, cd base, will change your current working directory to the newly created base directory. Now you are inside the base directory and can start storing docker-compose and related files in it.
Create .env file
Paste the following into the file.
Ensure you have an Ethereum L1 full node RPC available. It needs to be synced before Base will be able to fully sync
Make configuration directory
Download genesis.json and rollup.json
Create base_geth_data docker volume
Initialize Geth
It's required to initialize Geth if you plan to sync from scratch.
If you are going to sync using the snapshot, you shouldn't need to initialize Geth. The docker-compose would do the trick
This command runs a Docker container using the op-geth image. It mounts two volumes: base_geth_data to /data inside the container and /root/base/config to /config. The container then initializes the Ethereum client with a genesis file located at /config/genesis-l2.json using the --datadir option to specify the data directory as /data
Create jwt.hex
Create docker-compose.yml
Assuming that this guide is current, you’ll be able to paste the following into the docker-compose.yml and then ctrl + x and y to save file. The more likely scenario is that this .yml template is a bit outdated and you will need to update the version under the opnode > image as well as the geth > image sections. You can find the latest releases of the op-node and geth nodes here: https://docs.optimism.io/builders/node-operators/releases.
Paste the following into the docker-compose.yml
Optional/Recommended: Download Base Snapshot
This is an optional step based on whether you want to sync the node from scratch or sync the node from a snapshot. Based on InfraDAO’s experience, we recommend downloading a snapshot and syncing the node from that snapshot. Syncing the node from the scratch took around two weeks while the snapshot took requires 9-10 hours to download, 4-6 hours to unzip, and roughly 24 hours to sync from that point.
To sync from a snapshot, visit the Base Docs to validate the recommended approach for restoring from snapshot: https://docs.base.org/tutorials/run-a-base-node/#snapshots. Next, in the home directory of your (i.e. the base folder), create a folder named geth-data. If you already have this folder, remove it to clear the existing state and then recreate it. Next, run the following code and wait for the operation to complete.
As downloading a snapshot takes about 9 hrs it is better to run it in a screen session
Use aria2c to download the most recent Mainnet Archive Snapshot
press ctrl+A and D to return to previous screen and continue installation
You'll then need to untar the downloaded snapshot and place the geth subfolder inside of it in the geth-data folder you created (unless you changed the location of your data directory)
Next, you’ll need to move the snapshot to the where the geth data was stored in the docker container. If you initially tried to sync the node from scratch and are now trying with a snapshot:
Run Base Node
Monitor Logs
Use docker logs to monitor your geth and op-node. The -f flag ensures you are following the log output
Once your Base node starts syncing, the logs should look like this:
for op-geth:
for op-node:
The result will return false if a node is fully synced
Alternatively you can run
and it will return more details about syncing progress
Sync speed will be highly dependent on your Layer 1 RPC
Last updated
Was this helpful?