Skip to content

Commit

Permalink
small azure updates, added aws deploy section
Browse files Browse the repository at this point in the history
  • Loading branch information
sambukowski committed Oct 18, 2023
1 parent 46e09f1 commit 58f5f5e
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 62 deletions.
Binary file added docs/dusknet/assets/cname-record-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/dusknet/cloud-rollup-deployment/3-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ curl 20.72.189.135
</body>
</html>
```

## Creating your own Genesis Account

You can add genesis account(s) to your rollup during configuration.
Expand Down Expand Up @@ -261,12 +262,12 @@ Export this file to the env vars as follows:
export ROLLUP_CONF_FILE=<YOUR_ROLLUP_NAME>-rollup-conf.yaml
```

## Create new sequencer account

```bash
astria-cli sequencer account create
```

## Create new sequencer account

```bash
Create Sequencer Account
Expand Down
234 changes: 174 additions & 60 deletions docs/dusknet/cloud-rollup-deployment/4-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@ https://portal.aws.amazon.com/gp/aws/developer/registration/index.html

## Install `aws` CLI

https://formulae.brew.sh/formula/awscli

```bash
brew install awscli
```
Installation links for your OS can be found here:
- https://aws.amazon.com/cli/

## Create an Access Key

https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html

<aside>
❗ This doesn’t follow best security practices, do not do this on an important AWS account which has production resources on it
To create an access key, follow the instructions here:
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html

</aside>
:::danger
This doesn’t follow best security practices, do not do this on an important AWS
account which has production resources on it.
:::

Go to IAM section of console: https://console.aws.amazon.com/iam/

Expand Down Expand Up @@ -97,13 +95,18 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/cont

```bash
kubectl get svc -n ingress-nginx
```

You should see something like this:

```bash
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.100.151.220 ac1f86093ea7240c89457da3d5f71fc4-947b3172412ab75c.elb.us-east-1.amazonaws.com 80:30416/TCP,443:31448/TCP 3m55s
ingress-nginx-controller-admission ClusterIP 10.100.208.56 <none> 443/TCP 3m55s
```

Check the console for a new Elastic Load Balancer (ELB) in the EC2 > Load Balancers section
Check the console for a new Elastic Load Balancer (ELB) in the EC2 > Load
Balancers section using the `EXTERNAL-IP` from the previous `kubectl` output.

```bash
curl ac1f86093ea7240c89457da3d5f71fc4-947b3172412ab75c.elb.us-east-1.amazonaws.com
Expand All @@ -119,23 +122,73 @@ curl ac1f86093ea7240c89457da3d5f71fc4-947b3172412ab75c.elb.us-east-1.amazonaws.c

## Create a friendly CNAME record

<aside>
❗ You must configure a DNS record because our ingress configuration uses name based virtual routing (https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting)
:::danger
You must configure a DNS record because our ingress configuration uses name
based virtual routing.
More info here: https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting
:::

![CNAME record Example](../assets/cname-record-example.png)

## Creating your own Genesis Account

You can add genesis account(s) to your rollup during configuration.

You can create an account using

```bash
cast w new
```

to create a new account:

```bash
Successfully created new keypair.
Address: 0xfFe9...5f8b # <GENESIS_ADDRESS>
Private key: 0x332e...a8fb # <GENESIS_PRIVATE_KEY>
```

You can then `export` the genesis accounts like so:
```bash
export ROLLUP_GENESIS_ACCOUNTS=<GENESIS_ADDRESS>:<BALANCE>
```

</aside>
`export` the private key to the env vars using:
```bash
export ROLLUP_FAUCET_PRIV_KEY=<GENESIS_PRIVATE_KEY>
```

![Screenshot 2023-10-17 at 8.14.12 PM.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/c6b9fdea-c5a3-4c8e-aa04-45f2a9a65eca/2dcc4c16-0813-461c-bd34-7ee65a4e7cf9/Screenshot_2023-10-17_at_8.14.12_PM.png)
:::danger
__NEVER__ use a private key you use on a live network.
:::

## Configure and Deploy Rollup

### Modify Dev-Cluster
### Update the `helm` Chart

Pull the [Astria dev-cluster repo](https://github.com/astriaorg/dev-cluster):
```bash
git clone [email protected]:astriaorg/dev-cluster.git
cd dev-cluster
```

<aside>
**********TODO:********** Create an example PR for this to show the diff
Within the dev-cluster repo, update the ingress template
`chart/rollup/templates/ingress.yaml` so that each hostname ends in
`<YOUR_HOSTNAME>` instead of `localdev.me`

</aside>
```yaml
...
- host: executor.{{ .Values.config.rollup.name }}.<YOUR_HOSTNAME>
...
- host: ws-executor.{{ .Values.config.rollup.name }}.<YOUR_HOSTNAME>
...
- host: faucet.{{ .Values.config.rollup.name }}.<YOUR_HOSTNAME>
...
- host: blockscout.{{ .Values.config.rollup.name }}.<YOUR_HOSTNAME>
...
```

Modify https://github.com/astriaorg/dev-cluster/blob/main/charts/rollup/templates/ingress.yaml
Add an IngressClass so that the `metadata` section in the same file looks like:

```yaml
metadata:
Expand All @@ -145,77 +198,123 @@ metadata:
kubernetes.io/ingress.class: nginx
```
```yaml
- host: executor.{{ .Values.config.rollup.name }}.cryptarch.xyz
- host: ws-executor.{{ .Values.config.rollup.name }}.cryptarch.xyz
- host: faucet.{{ .Values.config.rollup.name }}.cryptarch.xyz
- host: blockscout.{{ .Values.config.rollup.name }}.cryptarch.xyz
```
:::tip
You can see an example of these changes in [this PR here](https://github.com/astriaorg/dev-cluster/pull/119/files).
:::
### Get Sequencer Block Height
## Install the `astria-cli`

Pull the [Astria repo](https://github.com/astriaorg/astria) and install the `astria-cli`

```bash
curl -s https://rpc.sequencer.dusk-1.devnet.astria.org/block | jq .result.block.header.height
git clone [email protected]:astriaorg/astria.git
cd astria
just install-cli
```

"9452"
### Get Current Sequencer Block Height

```bash
astria-cli sequencer blockheight get \
--sequencer-url https://rpc.sequencer.dusk-1.devnet.astria.org/
```

Save the returned value for later. You will replace the
`<INITIAL_SEQUENCER_BLOCK_HEIGHT>` tag in the following sections with this
value.

### Set Environment Variables

```yaml
Replace the tags in the commands and env vars below, as follows:

| Var Name | Var Type | Description |
|-----|-----|-----|
| `<YOUR_ROLLUP_NAME>` | String | The name of your rollup |
| `<YOUR_NETWORK_ID>` | u64 | The id of your network |
| `<INITIAL_SEQUENCER_BLOCK_HEIGHT>` | u64 | The height of the sequencer (found above) |
| `<GENESIS_ADDRESS>` | [u8; 40] | A wallet address |
| `<BALANCE>` | u64 | A balance. It is useful to make this a large value. |
<!-- TODO: potentially remove the initial sequencer block height as that may be found automatically -->

<!-- TODO: add this back in when the automated block height is added -->
<!-- :::tip
You can also optionally leave out the `--sequencer.initial-block-height` input
in the command above, and the cli will fetch the initial sequencer block height
for you.
::: -->

You can use environment variables to set the configuration for the rollup
config creation. Replace all the `<>` tags with their corresponding values.

```bash
export ROLLUP_USE_TTY=true
export ROLLUP_LOG_LEVEL=DEBUG
export ROLLUP_NAME=josh-aws
export ROLLUP_CHAIN_ID=0x1234
export ROLLUP_NETWORK_ID=111121
export ROLLUP_NAME=<YOUR_ROLLUP_NAME>
export ROLLUP_NETWORK_ID=<YOUR_NETWORK_ID>
export ROLLUP_SKIP_EMPTY_BLOCKS=false
# address from cast new
export ROLLUP_GENESIS_ACCOUNTS=0x7380E82605879574c468959508A7A5868b8AB022:100000000000000000000
export ROLLUP_SEQUENCER_INITIAL_BLOCK_HEIGHT=9452
export ROLLUP_GENESIS_ACCOUNTS=<GENESIS_ADDRESS>:<BALANCE>
export ROLLUP_SEQUENCER_INITIAL_BLOCK_HEIGHT=<INITIAL_SEQUENCER_BLOCK_HEIGHT>
export ROLLUP_SEQUENCER_WEBSOCKET=wss://rpc.sequencer.dusk-1.devnet.astria.org/websocket
export ROLLUP_SEQUENCER_RPC=https://rpc.sequencer.dusk-1.devnet.astria.org
```

### Create Config

Once the environment variables shown above are set, run the following command to
create the rollup config:
```bash
./astria-cli rollup config create
astria-cli rollup config create
```

```bash
cat josh-aws-rollup-conf.yaml
You can then run:

```sh
cat <YOUR_ROLLUP_NAME>-rollup-conf.yaml
```

to print out the config file contents to double check everything:

```sh
config:
useTTY: true
logLevel: DEBUG
rollup:
name: josh-aws
chainId: '0x1234'
networkId: 111121
skipEmptyBlocks: false
genesisAccounts:
- address: 7380E82605879574c468959508A7A5868b8AB022
balance: '100000000000000000000'
name: <YOUR_ROLLUP_NAME>
chainId: # derived from rollup name
networkId: <YOUR_NETWORK_ID>
skipEmptyBlocks: true
genesisAccounts:
- address: 0x<GENESIS_ADDRESS>
balance: '<BALANCE>'
sequencer:
initialBlockHeight: 9452
websocket: wss://rpc.sequencer.dusk-1.devnet.astria.org/websocket
rpc: https://rpc.sequencer.dusk-1.devnet.astria.org
initialBlockHeight: <INITIAL_SEQUENCER_BLOCK_HEIGHT>
websocket: ws://rpc.sequencer.dusk-1.devnet.astria.org/websocket
rpc: http://rpc.sequencer.dusk-1.devnet.astria.org
celestia:
fullNodeUrl: http://celestia-service:26658
```

Export this file to the env vars as follows:
```bash
export ROLLUP_CONF_FILE=<YOUR_ROLLUP_NAME>-rollup-conf.yaml
```

## Create new sequencer account

```bash
./astria-cli sequencer account create
astria-cli sequencer account create
```

```bash
Create Sequencer Account
Private Key: "7ff36352b6348e72ef0a1578f6b350ee0f2d6e4c3c3f2490915f805af2ad7c2d"
Public Key: "76d8d3b44ef9ddf4b3b554c04c78620934142dc86cc9db83283a0bc3c66d1e91"
Address: "34f2832ff6d3c23404a4adbe3eef504f82bc6b50"
Private Key: "0981...691c"
Public Key: "f08e...8a4d"
Address: "8f40...64fb"
```

```bash
export COMPOSER_PRIV_KEY=7ff36352b6348e72ef0a1578f6b350ee0f2d6e4c3c3f2490915f805af2ad7c2d
# priv key from cast new
export ROLLUP_FAUCET_PRIV_KEY=e71016b4bd662720f8424972bad190a9ed1793a020a4a96af93772c3eae6e05f
export SEQUENCER_PRIV_KEY=0981...691c
```

### Create Namespace
Expand All @@ -224,13 +323,28 @@ export ROLLUP_FAUCET_PRIV_KEY=e71016b4bd662720f8424972bad190a9ed1793a020a4a96af9
kubectl apply -f kubernetes/namespace.yml
```

### Deploy Rollup
### Use locally modified chart

:::danger
You __must__ have modified your local `helm` chart to use your own domain name
as described in [this section here](#update-the-helm-chart).
:::

Because you needed to modify the host names inside your ingress template you must deploy your rollup using your local chart:

```bash
export ROLLUP_CHART_PATH="/your_path_to/dev-cluster/charts/rollup"
```

### Deploy the Rollup Node

Use the `astria-cli` to deploy the node.

```bash
./astria-cli rollup deployment create \
--config josh-aws-rollup-conf.yaml \
astria-cli rollup deployment create \
--config $ROLLUP_CONF_FILE \
--faucet-private-key $ROLLUP_FAUCET_PRIV_KEY \
--sequencer-private-key $COMPOSER_PRIV_KEY --chart-path charts/rollup
--sequencer-private-key $SEQUENCER_PRIV_KEY
```

## Observe your Deployment
Expand Down

0 comments on commit 58f5f5e

Please sign in to comment.