From a1bb77263dd11c7ae4b4f727724c7c4f2ff0637d Mon Sep 17 00:00:00 2001 From: CyMule1 Date: Sat, 4 Feb 2023 10:53:26 -0500 Subject: [PATCH 1/3] Make default start method mount host files Previously `docker compose up` would use docker volumes. This pull request requires users to first make 2 folders, one for cache and one for unchained. The override file now allows users to use docker volumes where it previously mounted the users 2 host files for the cache/unchained storage. `docker-compose.local.example` is renamed to `docker-compose.volume-override.yml` because of the previosuly stated changes. `scripts/up.sh` is deleted because the command `docker compose up` is now the primary command used instead of the longer override command. Closes #379 --- .gitignore | 3 +- README.md | 55 ++++++++++++++---------------- docker-compose.local.example | 15 -------- docker-compose.volume-override.yml | 14 ++++++++ docker-compose.yml | 10 ++++-- scripts/up.sh | 3 -- 6 files changed, 49 insertions(+), 51 deletions(-) delete mode 100644 docker-compose.local.example create mode 100644 docker-compose.volume-override.yml delete mode 100755 scripts/up.sh diff --git a/.gitignore b/.gitignore index dda6b81..ea0393e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .DS_Store .env .save_env -docker-compose.local.yml -publish.sh \ No newline at end of file +publish.sh diff --git a/README.md b/README.md index b4c371b..2212d9b 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,11 @@ - [Locally running RPC endpoints](#locally-running-rpc-endpoints) - [Configuration](#configuration) - [Running the tool](#running-the-tool) - - [Method 1](#method-1) - - [Method 2](#method-2) - [Using the API](#using-the-api) - [Using `chifra`](#using-chifra) - [The unchained index](#the-unchained-index) - [Data science](#data-science) +- [Quick Alternative Method to Start the Container](#quick-alternative-method-to-start-the-container) - [Other](#other) ## Introduction @@ -28,7 +27,7 @@ TrueBlocks is a local-first indexing / data access solution that you may use for This docker repo is intentionally minimal. See [the core repo](https://github.com/TrueBlocks/trueblocks-core) for more information about the Unchained Index, chifra (our command-line tool), and the TrueBlocks data API. -This repo is pre-alpha and comes with no warrenty implied or otherwise. Use at your own discretion. +This repo is pre-alpha and comes with no warranty implied or otherwise. Use at your own discretion. ## Requirements @@ -40,7 +39,7 @@ This repo is pre-alpha and comes with no warrenty implied or otherwise. Use at y While TrueBlocks and chifra work with remote RPC endpoints, it is highly recommended that you have you own locally running endpoints. An excellent way to do that is to run Erigon on a `dAppNode`. -If you use a shared, rate-limted endpoint such as the many RPC-for-a-service offerings, there is a high likelyhood that you will be rate limited. Because TrueBlocks was designed for direct-to-local-endpoint use cases, such rate limiting is not currently in the code. +If you use a shared, rate-limited endpoint such as the many RPC-for-a-service offerings, there is a high likelihood that you will be rate limited. Because TrueBlocks was designed for direct-to-local-endpoint use cases, such rate limiting is not currently in the code. Just so that you're aware. @@ -60,18 +59,9 @@ The `ETHERSCAN_APIKEY` key is optional, but useful to enable the articulation fe ## Running the tool -### Method 1 +1. Make sure your `.env` file is configured [Configuration](#configuration) -This method uses docker volumes to persist the Unchained Index and binary caches. If you plan to use `chifra` directly in the future, it is recommended to use method 2. - -```[bash] -docker compose up -``` - -### Method 2 - -This method uses folders on your host machine to persist the Unchained Index and binary caches. -Create two folders on your host machine: +2. Create two folders on your host machine to persist the Unchained Index and binary caches: ```[shell] mkdir -p /Users/user/Data/cache @@ -80,29 +70,22 @@ mkdir -p /Users/user/Data/unchained **Note:** Adjust these paths appropriately for your machine. -Next, create a file called `docker-compose.local.yml` in the current folder. See the [docker-compose.local.example](docker-compose.local.example) for more information. +3. Replace the `source` paths in `docker-compose.yml` with the paths you just made in step 2. -```[shell] -services: - core: +```yml +... volumes: - type: bind - source: /Users/user/Data/docker/cache + source: /Users/user/Data/cache <--- REPLACE THIS WITH YOUR PATH target: /cache - type: bind - source: /Users/user/Data/docker/unchained + source: /Users/user/Data/unchained <--- REPLACE THIS WITH YOUR PATH target: /unchained +... ``` -**Note:** Adjust the `source` paths appropriately for your machine. - -The above process attaches (binds) the *internal-to-docker* `target` folders to the *external-on-the-host* `source` folders. This allows the files created internally by the docker to be visible on your host machine. +3. Run `docker compose up` -Assuming you've completed the above instructions, start the container by running this command: - -```[bash] -docker compose -f docker-compose.yml -f docker-compose.local.yml up -``` ### Using the API @@ -169,6 +152,20 @@ Allow this process to continue running in its own terminal window or `tmux` sess TODO: Add tutorials. +## Quick Alternative Method to Start the Container + +This alternative uses docker volumes to persist the Unchained Index and binary caches. +This method is great if you plan to always use docker to run chifra or to quickly +try out chifra. + +1. Make sure your `.env` file is configured [Configuration](#configuration) + +2. Run the command: + +```[bash] +docker compose -f docker-compose.yml -f docker-compose.volume-override.yml up +``` + ## Other **Documentation** diff --git a/docker-compose.local.example b/docker-compose.local.example deleted file mode 100644 index 2ebf3a1..0000000 --- a/docker-compose.local.example +++ /dev/null @@ -1,15 +0,0 @@ -# There are many things you can do with a docker-compose file. Here we simple attach the internal-to-docker -# folders to the external-to-the-host folders we've described in the .env file. This is a good way to -# keep your data safe and persistent. -# -# Note that the name of the service (`core`) must match that found in `docker-compose.yml`. Also, we've -# found that the easiest way to get this to work is to make the `source` and `target` paths absolute. -services: - core: - volumes: - - type: bind - source: /Users/user/Data/cache - target: /cache - - type: bind - source: /Users/user/unchained - target: /unchained diff --git a/docker-compose.volume-override.yml b/docker-compose.volume-override.yml new file mode 100644 index 0000000..dcf6990 --- /dev/null +++ b/docker-compose.volume-override.yml @@ -0,0 +1,14 @@ +# There are many things you can do with a docker-compose file. Here we +# are using docker volumes to persist data rather than mounting files from +# your host machine into the container +# +# Note that the name of the service (`core`) must match that found in `docker-compose.yml`. +services: + core: + volumes: + volumes: + - unchained:/unchained + - cache:/cache +volumes: + unchained: + cache: diff --git a/docker-compose.yml b/docker-compose.yml index 174b664..4f6cd18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,14 @@ services: ports: - "8080:${SERVE_PORT-8080}" volumes: - - unchained:/unchained - - cache:/cache + - type: bind + source: /Users/user/Data/cache + target: /cache + - type: bind + source: /Users/user/Data/unchained + target: /unchained + network_mode: "host" volumes: unchained: cache: + diff --git a/scripts/up.sh b/scripts/up.sh deleted file mode 100755 index 44ce43f..0000000 --- a/scripts/up.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker compose -f docker-compose.yml -f docker-compose.local.yml up From 3c9faa7cdcc09f8597508be899627a2a2a61aa58 Mon Sep 17 00:00:00 2001 From: CyMule1 Date: Sun, 5 Feb 2023 15:32:51 -0500 Subject: [PATCH 2/3] Make suggested changes --- README.md | 12 ++++++------ docker-compose.yml | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2212d9b..4d4e9e0 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ The `ETHERSCAN_APIKEY` key is optional, but useful to enable the articulation fe 2. Create two folders on your host machine to persist the Unchained Index and binary caches: ```[shell] -mkdir -p /Users/user/Data/cache -mkdir -p /Users/user/Data/unchained +mkdir -p /Users/user/Data/docker/cache +mkdir -p /Users/user/Data/docker/unchained ``` **Note:** Adjust these paths appropriately for your machine. @@ -76,10 +76,10 @@ mkdir -p /Users/user/Data/unchained ... volumes: - type: bind - source: /Users/user/Data/cache <--- REPLACE THIS WITH YOUR PATH + source: /Users/user/Data/docker/cache # <--- REPLACE THIS WITH ANY VALID PATH target: /cache - type: bind - source: /Users/user/Data/unchained <--- REPLACE THIS WITH YOUR PATH + source: /Users/user/Data/docker/unchained # <--- REPLACE THIS WITH ANY VALID PATH target: /unchained ... ``` @@ -155,8 +155,8 @@ TODO: Add tutorials. ## Quick Alternative Method to Start the Container This alternative uses docker volumes to persist the Unchained Index and binary caches. -This method is great if you plan to always use docker to run chifra or to quickly -try out chifra. +It is a great option if you intend to always use docker, you don't need need the +Unchained index files externally, or if you want to quickly try out chifra. 1. Make sure your `.env` file is configured [Configuration](#configuration) diff --git a/docker-compose.yml b/docker-compose.yml index 4f6cd18..99e857b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,12 +9,13 @@ services: - "8080:${SERVE_PORT-8080}" volumes: - type: bind - source: /Users/user/Data/cache + # The source should match the folder you made to store the cache + source: /Users/user/Data/docker/cache target: /cache - type: bind - source: /Users/user/Data/unchained + # The source should match the folder you made to store the Unchained index + source: /Users/user/Data/docker/unchained target: /unchained - network_mode: "host" volumes: unchained: cache: From 63f151eb1d4a0bb60bc6c2f9632596655d1447e7 Mon Sep 17 00:00:00 2001 From: tjayrush Date: Sat, 11 Mar 2023 23:14:43 -0500 Subject: [PATCH 3/3] Updates to version v0.60.0-beta --- .gitignore | 1 + ChatGPT-Instructions.md | 39 +++++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- docker-compose.yml | 2 +- scripts/build.sh | 2 +- scripts/publish.sh | 2 +- 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 ChatGPT-Instructions.md diff --git a/.gitignore b/.gitignore index ea0393e..acb44f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +docker-compose.local.yml .DS_Store .env .save_env diff --git a/ChatGPT-Instructions.md b/ChatGPT-Instructions.md new file mode 100644 index 0000000..236fed7 --- /dev/null +++ b/ChatGPT-Instructions.md @@ -0,0 +1,39 @@ +Step 1: Install Docker + +Before you can run the TrueBlocks Docker version, you need to have Docker installed on your machine. Docker is a platform that allows you to run applications in isolated environments called containers. You can download Docker from the official website: https://www.docker.com/products/docker-desktop + +Step 2: Download the TrueBlocks Docker image + +Once you have Docker installed, you need to download the TrueBlocks Docker image. You can do this by opening your terminal or command prompt and running the following command: + +```[bash] +docker pull trueblocks/trueblocks +``` + +This command will download the latest version of the TrueBlocks Docker image from the Docker Hub repository. + +Step 3: Create a Docker container + +Now that you have the TrueBlocks Docker image, you can create a Docker container. A container is an instance of the Docker image that you can run and interact with. To create a container, run the following command: + +```[yaml] +docker run -d -p 8545:8545 -p 3000:3000 --name trueblocks trueblocks/trueblocks +``` + +This command will create a new Docker container named "trueblocks" and map port 8545 (the RPC port) and port 3000 (the web UI port) to the corresponding ports on your host machine. The "-d" flag tells Docker to run the container in detached mode, which means it will run in the background. + +Step 4: Check the logs + +After you've created the Docker container, you can check the logs to see if everything is working correctly. To view the logs, run the following command: + +```[bash] +docker logs -f trueblocks +``` + +This command will show you the logs for the "trueblocks" container in real-time. If everything is working correctly, you should see a message that says "TrueBlocks started". + +Step 5: Access the TrueBlocks web UI + +Once the container is up and running, you can access the TrueBlocks web UI by opening a web browser and navigating to http://localhost:3000. You should see the TrueBlocks dashboard, which allows you to interact with the TrueBlocks API, view block data, and manage your Ethereum accounts. + +That's it! You now have the TrueBlocks Docker version up and running on your machine. If you have any issues or questions, consult the TrueBlocks documentation or community forums. diff --git a/Dockerfile b/Dockerfile index 52eacfa..45aeae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /root # ARG UPSTREAM_VER=feature/docker-version # ADD https://api.github.com/repos/TrueBlocks/trueblocks-core/git/refs/heads/$UPSTREAM_VER version.json -ARG UPSTREAM_VER=v0.55.0-beta +ARG UPSTREAM_VER=v0.60.0-beta # ARG UPSTREAM_VER=develop RUN git clone -b "${UPSTREAM_VER}" --single-branch --progress --depth 1 \ https://github.com/TrueBlocks/trueblocks-core.git && \ diff --git a/docker-compose.yml b/docker-compose.yml index 99e857b..bf547a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ name: TrueBlocksCore services: core: - image: trueblocks/core:v0.55.0-beta + image: trueblocks/core:v0.60.0-beta build: ./ env_file: .env ports: diff --git a/scripts/build.sh b/scripts/build.sh index a535741..85a82dd 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,4 +1,4 @@ #!/bin/bash -VERSION=v0.55.0-beta +VERSION=v0.60.0-beta docker build . --tag trueblocks/core:$VERSION diff --git a/scripts/publish.sh b/scripts/publish.sh index e20b3f6..2db283a 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION=v0.55.0-beta +VERSION=v0.60.0-beta docker build . --tag trueblocks/core:$VERSION docker push trueblocks/core:$VERSION