Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codex: add initial testnet version #588

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions codex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Codex

[Codex](https://codex.storage) is a durable, decentralised storage protocol designed to safeguard the world's most valuable information. Join the testnet to help secure a resilient digital future.

Codex recently announced launch of `testnet` - please follow a [Discord](https://discord.gg/codex-storage) guide to participate!

## Deploy

You will need to provide a `PRIV_KEY` and `CODEX_NAT` environment variables in the deployment.

Private key is any Ethereum Wallet private key (keep in mind the security risks of pasting your key into an Akash deployment manifest!). You can generate one using any wallet or by using a CLI command

```
openssl rand --hex 32
```

The environment variable `CODEX_NAT` refers to the public IP of the deployment - once you perform initial deployment (with empty `CODEX_NAT`), check the assigned IP and update the dpeloyment, so that other nodes in the network can connect to your node.
vpavlin marked this conversation as resolved.
Show resolved Hide resolved
101 changes: 101 additions & 0 deletions codex/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
version: "2.0"

endpoints:
nodeip:
kind: ip

services:
codex:
image: codexstorage/nim-codex:0.1.6
expose:
# - port: 8080 # You probably don't want to expose the API globally:) Consider using reverse proxy with some auth?
# as: 8080
# to:
# - global: true
# ip: nodeip
- port: 8070
as: 8070
proto: tcp
to:
- global: true
ip: nodeip
- port: 8090
as: 8090
proto: udp
to:
- global: true
ip: nodeip
env:
- DATA_DIR=/codex/data
- PRIV_KEY=
- CODEX_NAT=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With k8s, I believe you could do something like:

env:
  - name: CODEX_NAT
    valueFrom:
      fieldRef:
        fieldPath: status.hostIP

not sure this is possible here. I guess you'd know. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not, Akash is special - in this regard - we need to buy external IP and that is not propagated to the container in any way. There are some providers which are able to do this by using some particular netowrking setup/k8s plugins, but you cannot rely on it, so manual intervention is the best bet right now.

I have one idea I'd like to try to implement in Akash that would help, but I don't have time:D So I'd stick with manul copy for now

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

- CODEX_LOG_LEVEL=debug
- CODEX_BLOCK_TTL=30d
command:
- sh
- -c
args:
- >
if [ -z "${CODEX_NAT}" ]; then
echo "Missing \$CODEX_NAT=public_ip_of_the_deplyoment"
sleep 120
exit 1
fi

mkdir -p ${DATA_DIR}
chmod 0700 ${DATA_DIR}

exec /docker-entrypoint.sh codex \
--bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P \
--bootstrap-node=spr:CiUIAhIhAyUvcPkKoGE7-gh84RmKIPHJPdsX5Ugm_IHVJgF-Mmu_EgIDARo8CicAJQgCEiEDJS9w-QqgYTv6CHzhGYog8ck92xflSCb8gdUmAX4ya78QoemesAYaCwoJBES39Q2RAnVOKkYwRAIgLi3rouyaZFS_Uilx8k99ySdQCP1tsmLR21tDb9p8LcgCIG30o5YnEooQ1n6tgm9fCT7s53k6XlxyeSkD_uIO9mb3 \
--bootstrap-node=spr:CiUIAhIhA6_j28xa--PvvOUxH10wKEm9feXEKJIK3Z9JQ5xXgSD9EgIDARo8CicAJQg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RAnV2KkYwRAIgXO3bzd5VF8jLZG8r7dcLJ_FnQBYp1BcxrOvovEa40acCIDhQ14eJRoPwJ6GKgqOkXdaFAsoszl-HIRzYcXKeb7D9 \
--storage-quota=11811160064 \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 11Gib? Should this be configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is configurable, but you need to match the config option value and the storage request in the manifest

image
image

In theory, we could also automatically resolve the value from the mounted stored

image

Which would be probably best - we can do

df --output=size /codex | tail -1

And then all the deployer needs to do is to configure the storage request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pused a commit with udpate

--data-dir=${DATA_DIR} \
--api-port=8080 \
--api-bindaddr=0.0.0.0 \
--disc-port=8090 \
--listen-addrs=/ip4/0.0.0.0/tcp/8070 \
persistence \
--eth-provider=https://rpc.testnet.codex.storage

params:
storage:
codex:
mount: /codex
readOnly: false

profiles:
compute:
codex:
resources:
cpu:
units: 2
memory:
size: 2Gi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No one is probably running it with this little RAM atm so I'm not sure this will always work, particularly with larger files. But we can always change it later. Caveat emptor. 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I am fine bumping it, I probably just started from an existing deployment and never modified this

storage:
- size: 1Gi
- size: 10Gi
name: codex
attributes:
persistent: true
class: beta3

placement:
dcloud:
pricing:
codex:
denom: uakt
amount: 100000

deployment:
codex:
dcloud:
profile: codex
count: 1