{"id":18375774,"url":"https://github.com/factomproject/factomd-testnet-toolkit","last_synced_at":"2025-04-06T20:31:11.391Z","repository":{"id":50207610,"uuid":"132923493","full_name":"FactomProject/factomd-testnet-toolkit","owner":"FactomProject","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-08T02:05:06.000Z","size":21,"stargazers_count":4,"open_issues_count":3,"forks_count":4,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-22T06:26:29.377Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FactomProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-10T16:00:02.000Z","updated_at":"2021-08-01T21:04:27.000Z","dependencies_parsed_at":"2023-01-24T21:30:11.633Z","dependency_job_id":null,"html_url":"https://github.com/FactomProject/factomd-testnet-toolkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Ffactomd-testnet-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Ffactomd-testnet-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Ffactomd-testnet-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Ffactomd-testnet-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FactomProject","download_url":"https://codeload.github.com/FactomProject/factomd-testnet-toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247547303,"owners_count":20956531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T00:20:17.934Z","updated_at":"2025-04-06T20:31:11.155Z","avatar_url":"https://github.com/FactomProject.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Factomd Control Plane\n\nThis repository is responsible for maintaining the control plane for factomd M3.\n\nIt includes 4 containers:\n  1. FactomD\n  \u003e Runs the factom node\n  2. SSH\n  \u003e Permits ssh access only to _this specific container_. Mounts the factomd database volume for debugging purposes.\n  3. Filebeat\n  \u003e Reports stdout/stderr of all docker containers to our elasticsearch instance\n  4. Metricbeat\n  \u003e Reports hardware metrics of all docker containers to our elasticsearch instance.\n\n# Install docker\n\nPlease follow the instructions [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/) to install docker-ce to your machine. If you run Ubuntu 18.04 you can use the docker.io package `sudo apt-get install docker.io` as it's recent enough to support swarm and iptables without modification.\n\nThen, run `usermod -aG docker $USER` and logout/login.\n\n\n# Configure Firewall for Docker\n\nIn order to join the swarm, first ensure that your firewall rules allow access on the following ports. All swarm communications occur over a self-signed TLS certificate. Due to the way iptables and docker work you cannot use the `INPUT` chain to block access to apps running in a docker container as it's not a local destination but a `FORWARD` destination. By default when you map a port into a docker container it opens up to `any` host. To restrict access we need to add our rules in the `DOCKER-USER` chain [reference](https://docs.docker.com/network/iptables/).\n\n- TCP port `2376` _only to_ `54.171.68.124` for secure Docker engine communication. This port is required for Docker Machine to work. Docker Machine is used to orchestrate Docker hosts. As this is a local service we use the `INPUT` chain.\n\nIn addition,  the following ports must be opened for factomd to function which we add to the `DOCKER-USER` chain:\n- `2222` to `54.171.68.124`, which is the SSH port used by the `ssh` container\n- `8088` to `54.171.68.124`, the factomd API port\n- `8090` to `0.0.0.0`, the factomd Control panel\n  - Keeping this open to the world is beneficial on testnet for debugging purposes\n- `8110` to the world, the factomd testnet port\n\nAn example using `iptables`:\n```\nsudo iptables -A INPUT ! -s 54.171.68.124/32 -p tcp -m tcp --dport 2376 -m conntrack --ctstate NEW,ESTABLISHED -j REJECT --reject-with icmp-port-unreachable\nsudo iptables -A DOCKER-USER ! -s 54.171.68.124/32  -i \u003cexternal if\u003e -p tcp -m tcp --dport 8090 -j REJECT --reject-with icmp-port-unreachable\nsudo iptables -A DOCKER-USER ! -s 54.171.68.124/32  -i \u003cexternal if\u003e -p tcp -m tcp --dport 2222 -j REJECT --reject-with icmp-port-unreachable\nsudo iptables -A DOCKER-USER ! -s 54.171.68.124/32  -i \u003cexternal if\u003e -p tcp -m tcp --dport 8088 -j REJECT --reject-with icmp-port-unreachable\nsudo iptables -A DOCKER-USER -p tcp -m tcp --dport 8110 -j ACCEPT\n```\n\nDon't forget to [save](https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands#saving-rules) the rules!\n\n# Configure and Run the Docker Engine\n\nThere are a number of ways to run `dockerd` and two effectively mutually\nexclusive ways to configure `dockerd`. The ways to run `dockerd` are discussed\nbelow, but it is also important to understand the two ways that it can be\nconfigured.\n\n## Choose one of the following options for configuring `dockerd`\nYou can either use the `/etc/docker/daemon.json` file to specify `dockerd`\noptions, or you can specify options on the command line. Note that while these\nmethods can be used together, *if the same option is specified in both\nlocations, `dockerd` will fail to start even if the options agree*. For this\nreason it is best to either specify all options on the command line or all\noptions in `/etc/docker/daemon.json`.\n\n### 1. Using `daemon.json` (recommended)\n\nYou can configure the docker daemon using a default config file, located at\n`/etc/docker/daemon.json`. Create this file if it does not exist.\n\nExample configuration:\n```\n{\n  \"tls\": true,\n  \"tlscert\": \"/path/to/cert.pem\",\n  \"tlskey\": \"/path/to/key.pem\",\n  \"hosts\": [\"tcp://0.0.0.0:2376\", \"unix:///var/run/docker.sock\"]\n}\n```\nAs noted above, please make sure that you do not also specify any of these\noptions on the command line for `dockerd`. Please make sure to specify the\ncorrect paths for `\"tlscert\"` and `\"tlskey\"`. If you are using `systemd` to run\nthe `docker.service` you will need an additional host in your host list:\n`\"fd://\"`. See `systemd` below.\n\n### 2. Options on the command line\n\nFor the same options as described above, you would use the following command\nline options:\n\n```\ndockerd -H=unix:///var/run/docker.sock -H=0.0.0.0:2376 --tls --tlscert=/path/to/cert.pem --tlskey=/path/to/key.pem\n```\n\n## Choose one of the following 3 options for starting dockerd\nRemeber that if you specify an option on the command line, you can't have the\nsame option in your `/etc/docker/daemon.json` file.\n### 1. On RedHat\n\nOpen (using `sudo`) `/etc/sysconfig/docker` in your favorite text editor.\n\nAppend `-H=unix:///var/run/docker.sock -H=0.0.0.0:2376 --tls --tlscert=\u003cpath to cert.pem\u003e --tlskey=\u003cpath to key.pem\u003e` to the pre-existing OPTIONS\n\nThen, `sudo service docker restart`.\n\n### 2. Using `systemd`\n\nRun `sudo systemctl edit docker.service`. This creates an override directory at\n`/etc/systemd/system/docker.service.d/` and an override file called\n`override.conf`. Alternatively, you can create this directory and file manually\nand you can give the file a more descriptive name so long as it ends with\n`.conf`.\n\nEdit the override file to match this:\n```\n[Service]\nExecStart=\nExecStart=/usr/bin/dockerd\n```\nand make sure that you add `\"fd://\"` to the `\"hosts\"` array in\n`/etc/docker/daemon.json` if you are using it for your config.\n\nIf you are *not* using `/etc/docker/daemon.json` use the following for your\nservice file override.\n```\n[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376 --tls --tlscert \u003cpath to cert.pem\u003e --tlskey \u003cpath to key.pem\u003e\n```\nThen reload the configuration and the `docker.service`\n```\nsudo systemctl daemon-reload\nsudo systemctl restart docker.service\n```\n\n### 3. I don't want to use a process manager\n\nYou can manually start the docker daemon via:\n\n```\nsudo dockerd -H=unix:///var/run/docker.sock -H=0.0.0.0:2376 --tlscert=\u003cpath to cert.pem\u003e --tlskey=\u003cpath to key.pem\u003e\n```\nor just\n```\nsudo dockerd\n```\nif you are using the `/etc/docker/daemon.json` file for configuration.\n\n## Troubleshooting\n\nIf `dockerd` fails to start review the error output carefully. It generally\ntells you exactly what the problem is.\n\nIf you are using systemd and the service fails to start, finding the relevant\nlogs can be a challenge since the service is configured to just keep restarting\nwhich can bury the logs.\n\nIn this case, stop the service: `sudo systemctl stop docker`.\n\nThen manually start `dockerd`: `sudo dockerd`\n\nYou will then be able to see the `dockerd` output which should point you at the\nproblem. Fix those and then try starting the service with systemd again.\n\n# Create the FactomD volumes\n\nFactomd relies on two volumes,`factom_database` and `factom_keys`. Please create these before joining the swarm.\n\n1. `docker volume create factom_database`\n2. `docker volume create factom_keys`\n\nThese volumes will be used to store information by the `factomd` container.\n\nIf you already have a synced node and would like to avoid resyncing, run:\n\n`sudo cp -r \u003cpath to your database\u003e /var/lib/docker/volumes/factom_database/_data`.\n\nIf you used the old docker setup your database will most likely be in `/var/lib/docker/volumes/communitytestnet_factomd_volume/_data/m2/`\n\nThe directory in `_data` after the copy should be `custom-database`, as the volume is mounted at `$HOME/.factom/m2`.\n\nIn addition, please place your `factomd.conf` file in `/var/lib/docker/volumes/factom_keys/_data`. This file can also be found in `/var/lib/docker/volumes/communitytestnet_factomd_volume/_data/m2/`.\n\n# Join the Docker Swarm\n\nFinally, to join the swarm:\n```\ndocker swarm join --token SWMTKN-1-0bv5pj6ne5sabqnt094shexfj6qdxjpuzs0dpigckrsqmjh0ro-87wmh7jsut6ngmn819ebsqk3m 54.171.68.124:2377\n\n```\n\nAs a reminder, joining as a worker means you have no ability to control containers on another node.\n\nOnce you have joined the network, you will be issued a control panel login by Flying_Viking or a Factom employee after messaging Flying Viking or one of the Factom engineers on discord. You should private message the following for **each** node:\n- NodeID (`docker info | grep NodeID`)\n- IP Address\n- Docker engine listening port (`2376`)\n\n**Only accept logins at https://testnet.federation.factomd.com/. Any other login endpoints are fraudulent and not to be trusted.**\n\n# Starting FactomD Container\n\nThere are two means of launching your `factomd` instance:\n\n### From the Docker CLI (recommended and better tested)\n\nRun this command _exactly_: `docker run -d --name \"factomd\" -v \"factom_database:/root/.factom/m2\" -v \"factom_keys:/root/.factom/private\" -p \"8088:8088\" -p \"8090:8090\" -p \"8110:8110\" -l \"name=factomd\" factominc/factomd:v5.0.0-alpine -broadcastnum=16 -network=CUSTOM -customnet=fct_community_test -startdelay=600 -faulttimeout=120 -config=/root/.factom/private/factomd.conf\n`\n\n### From the Portainer UI\n\nOnce you have logged into the [control panel](https://testnet.federation.factomd.com/), please ensure your node is selected in the top left dropdown menu.\n\nThen, click `containers \u003e add container`.\n\n**:heavy_exclamation_mark: These instructions must be followed exactly, otherwise you risk being kicked from the authority set. :heavy_exclamation_mark:**\n\n1. Name your container `factomd`.\n\n2. Enter the image name `factominc/factomd:v5.0.0-alpine`\n\n3. Mark additional ports `8088:8088`, `8110`:`8110`, `8090:8090`.\n\n4. Do _not_ modify access control.\n\n5. Either this command for the command:  `-broadcastnum=16 -network=CUSTOM -customnet=fct_community_test -startdelay=600 -faulttimeout=120 -config=/root/.factom/private/factomd.conf`or your own flags. But be careful!\n\n6. Click \"volumes\", and map `/root/.factom/m2` to `factom_database`, and `/root/.factom/private` to `factom_keys`.\n\n7. Click \"labels\" and add a label `name:name` = `value:factomd`\n\n8. Click \"deploy the container\"\n\n9. You are done!\n\n\n### NOTE: The Swarm cluster is still experimental, so please pardon our dust! If you have an issues, please contact ian at factom dot com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactomproject%2Ffactomd-testnet-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffactomproject%2Ffactomd-testnet-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactomproject%2Ffactomd-testnet-toolkit/lists"}