Skip to content
Snippets Groups Projects
Commit be563114 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add basic config for demo

parent 4ad833ee
No related branches found
No related tags found
No related merge requests found
FROM debian:latest
LABEL maintainer="Richard T. Carback III <rick@xx.network>"
RUN apt update
RUN apt upgrade -y
# Compile and install the worldtree xx docker demo
# https://users.rust-lang.org/t/unable-to-find-libclang-the-libclang-issue/70746
# ENV LIBCLANG_PATH="/usr/lib/llvm17/lib"
# https://github.com/rust-lang/wg-cargo-std-aware/issues/70
# https://users.rust-lang.org/t/dynamic-linking-in-alpine/105608
# ENV RUSTFLAGS="-Ctarget-feature=-crt-static -Lnative=/usr/lib"
# https://github.com/mattn/go-sqlite3/issues/1164
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
ENV PATH="/root/.cargo/bin:/usr/local/go/bin:$PATH"
RUN apt install -y build-essential git clang curl pkg-config \
libssl-dev && \
curl -L -O https://go.dev/dl/go1.22.5.linux-amd64.tar.gz && \
echo "904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0 go1.22.5.linux-amd64.tar.gz" > shasum.txt && \
shasum -c shasum.txt && \
tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz && \
curl -L -o rust.sh https://sh.rustup.rs && chmod +x rust.sh && \
./rust.sh -y && \
git clone --branch xx-demo --depth 1 https://github.com/xxfoundation/world-tree.git && \
rustup toolchain install nightly && \
rustup default nightly && \
rustup update && \
cd world-tree && \
cargo build -r --features xxdk && \
cd .. && \
mv world-tree/target/release/world-tree /usr/sbin/ && \
rm -fr world-tree /root/.cargo /root/.cache /root/.rustup /rust.sh \
/usr/local/go *.gz *.txt && \
apt purge -y build-essential git clang curl pkg-config
# Configure supervisor for running inside a container
RUN apt install supervisor openssl rsync
RUN mkdir -p /var/log/supervisor/
COPY supervisord.conf /etc/supervisord.conf
COPY start.sh /start.sh
RUN chmod +x *.sh
STOPSIGNAL SIGQUIT
# world-tree ports (for local testing)
EXPOSE 8080
RUN mkdir -p /data/world-tree
COPY ndf.json /data/ndf.json
COPY world_tree.toml /data/world-tree/world_tree.toml
RUN mv /var/log /data/logs && ln -s /data/logs /var/log
RUN cp -r /data /data-initial
VOLUME /data
CMD [ "/start.sh" ]
# worldtree-xx-docker # worldtree-xx-docker
This builds an xx network capable world-tree service into a docker image.
The configuration should work if you have a local RPC set up at
`http://localhost:31080`. If not, edit the `worldtree_config.toml`
file to modify the RPC endpoint.
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps. You can start it with:
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
``` ```
cd existing_repo docker run -d -p32080:8080 -v /zfspool/docker-volumes/worldtree-xx-demo:/data --name worldtree-xx-demo carback1/worldtree-xx-demo:v0.0.1
git remote add origin https://git.xx.network/xx_network/worldtree-xx-docker.git
git branch -M master
git push -uf origin master
``` ```
## Integrate with your tools After it syncs (5-20 minutes). You should be able to query it with
curl as follows:
- [ ] [Set up project integrations](https://git.xx.network/xx_network/worldtree-xx-docker/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name ```
Choose a self-explaining name for your project. curl -X POST http://localhost:32080/inclusionProof -H "Content-Type: application/json" -d '{ "identityCommitment": "0x3017972D13A39795AD0D1C3A670D3D36A399B4435E61A510C2D57713D4F5C3DE" }'
```
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing You can run the same command with the xxclient as follows:
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. ```
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. ```
## Authors and acknowledgment You will need the xx cMix Server ID and Public Key to run this
Show your appreciation to those who have contributed to the project. command. You can get them from the logs:
## License ```
For open source projects, say how it is licensed.
## Project status ```
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
This diff is collapsed.
start.sh 0 → 100644
#!/bin/bash
if [ ! -f /data/.initialized ]
then
touch /data/.initialized
rsync -avz /data-initial/ /data/
echo "Data volume empty, initialized fresh state!"
fi
mkdir -p /var/log/supervisor
# Redirect to "syslog" file but keep printing out in this console as well
exec > >(tee -a "/data/syslog") 2>&1
echo "Starting supervisord..."
exec /usr/bin/supervisord -c /etc/supervisord.conf
# keep supervisord in the foreground and rotate/delete logs appropriately
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=5MB
logfile_backups=2
loglevel=info
user=root
# supervisorctl access file
[unix_http_server]
file = /tmp/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
[program:world-tree]
command=/usr/sbin/world-tree --config /data/world-tree/world_tree.toml
autostart=true
autorestart=true
startretries=5
startsecs=8
stopwaitsecs=10
stopsignal=INT
priority=500
process_name=%(program_name)s_%(process_num)02d
stderr_logfile=/var/log/%(program_name)s_stderr.log
stderr_logfile_maxbytes=10MB
stdout_logfile=/var/log/%(program_name)s_stdout.log
stdout_logfile_maxbytes=10MB
[program:showlogs]
command=/bin/sh -c "/usr/bin/tail -f /var/log/*.log"
autostart=true
autorestart=true
startretries=2
startsecs=0
priority=999
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/1
stderr_logfile_maxbytes=0
# Depth of the onchain merkle tree
tree_depth = 30
# Socket address for the service to listen to for incoming inclusion proof requests
socket_address = "0.0.0.0:8080"
[cache]
# Cache file to store the tree state
cache_file = "/data/world-tree/tree-cache"
# Flag to purge existing cache on startup
# purge_cache = true
# Ethereum Mainnet configuration
[canonical_tree]
# Address of the WorldIdIdentityManager contract
address = "0xf7134CE138832c1456F2a91D64621eE90c2bddEa"
# Creation block of the WorldIdIdentityManager contract
creation_block = 17636832
# RPC endpoint
provider.rpc_endpoint = "http://lovelace.carback.int:31080/rpc"
# Requests per second throttle
provider.throttle = 50
# Blockscanner window size; the maximum number of blocks to query at a time
window_size = 1000
# Note that the following bridged trees are identitified with [bridged_trees.<network>]
# however this could be any unique identifier, e.g. [bridged_trees.0], [bridged_trees.a], etc.
# # OP Mainnet
# [bridged_trees.optimism]
# # Address of the BridgedWorldId contract
# address = "0xB3E7771a6e2d7DD8C0666042B7a07C39b938eb7d"
# # Creation block of the BridgedWorldId contract
# creation_block = 109906421
# # RPC endpoint
# provider.rpc_endpoint = ""
# # Requests per second throttle
# provider.throttle = 150
# # Blockscanner window size; the maximum number of blocks to query at a time
# window_size = 10000
# # Polygon
# [bridged_trees.polygon]
# # Address of the BridgedWorldId contract
# address = "0xa6d85F3b3bE6Ff6DC52C3aaBe9A35d0ce252b79F"
# # Creation block of the BridgedWorldId contract
# creation_block = 47860919
# # RPC endpoint
# provider.rpc_endpoint = ""
# # Requests per second throttle
# provider.throttle = 150
# # Blockscanner window size; the maximum number of blocks to query at a time
# window_size = 10000
[cmix]
# Path to the xx network definition file
ndf_path="/data/ndf.json"
# Path to the network state folder
storage_dir="/data/xxstate"
# A secret you choose, to encrypt the state folder
secret="ALocalSecret"
# The reception ID to listen on, you can run with this blank and read
# the generated one from the logs. base64 encoded.
reception_id=""
# A base64 encoded private key, it is recommened to leave this empty
# and use the generated public key from the logs for clients
private_key=""
# [telemetry]
# service_name = "world-tree"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment