Combine stacks.

This commit is contained in:
2024-04-02 18:02:54 -05:00
parent 343d31c324
commit d7f06ad51e
12 changed files with 168 additions and 255 deletions
@@ -0,0 +1,104 @@
# go-nitro-auth
Deploy a stack for demoing Nitro-based auth, using either a local fixturenet (fully self-contained) or remote testnet.
## Local Fixturenet (Self-Contained)
### Clone required repositories
```
$ laconic-so --stack fixturenet-eth setup-repositories
$ laconic-so --stack go-nitro-auth setup-repositories
```
### Build containers
```
$ laconic-so --stack fixturenet-eth build-containers
$ laconic-so --stack go-nitro-auth build-containers
```
### Create a deployment
```
$ laconic-so --stack fixturenet-eth deploy init --output nitro-net.yml
$ laconic-so --stack fixturenet-eth deploy create --spec-file nitro-net.yml --deployment-dir /srv/nitro-net
$ laconic-so --stack go-nitro-auth deploy init --map-ports-to-host any-same --output nitro-auth.yml
$ laconic-so --stack go-nitro-auth deploy create --spec-file nitro-auth.yml --deployment-dir /srv/nitro-auth
# Place them both in the same namespace (TODO: support setting the deployment name via --cluster).
$ cp /srv/nitro-net/deployment.yml /srv/nitro-auth/deployment.yml
```
### Start the containers
```
$ laconic-so deployment --dir /srv/nitro-net up
$ laconic-so deployment --dir /srv/nitro-auth up
```
### Open the webapp
Visit http://localhost:5678
## Remote Testnet
This example will use the Linea Sepolia testnet.
### Clone required repositories
```
$ laconic-so --stack go-nitro-auth setup-repositories
```
### Build containers
```
$ laconic-so --stack go-nitro-auth build-containers
```
### Create a deployment
```
$ laconic-so --stack go-nitro-auth deploy init --map-ports-to-host any-same --output nitro-auth.yml
$ laconic-so --stack go-nitro-auth deploy create --spec-file nitro-auth.yml --deployment-dir /srv/nitro-auth
```
### Set your keys, contract addresses, etc.
You must set the private keys for two accounts with funds on the target network, as well as the contract addresses
(if they already exist) or else an account to create them. You must also set the URL to use for WebSocket connections,
eg, `wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY>`
#### Config
```
$ vim /srv/nitro-auth/config.env
# Addresses of existing contracts.
CERC_CA_ADDRESS="0x1Ae815c3e7556e16ceaB6B6d46306C1870EB6d24"
CERC_NA_ADDRESS="0xc453C5E3f304bb545A3Df7bBa02fe6274A056636"
CERC_VPA_ADDRESS="0xA11af80D75b1150631FA78178c94fa451c7172a8"
# Else the private key of an account and RPC URL to use create them.
CERC_PRIVATE_KEY_DEPLOYER=<PRIV_KEY_HERE>
CERC_ETH_RPC_ENDPOINT=https://rpc.sepolia.linea.build
# The WebSocket chain URL.
CERC_NITRO_CHAIN_URL=wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY_HERE>
# Private key for "Alice" account (payer)
CERC_NITRO_CHAIN_PK_ALICE=<ALICE_PRIVATE_KEY_HERE>
j
# Private key for "Bob" account (payee)
CERC_NITRO_CHAIN_PK_BOB=<BOB_PRIVATE_KEY_HERE>
```
### Start the stack
```
$ laconic-so deployment --dir /srv/nitro-auth up
```
### Open the webapp
Visit http://localhost:5678
@@ -1,11 +1,14 @@
version: "1.0"
name: linea-testnet-nitro-auth
name: go-nitro-auth
description: "Stack to demonstrate payments between various services"
repos:
# nitro repo
- github.com/cerc-io/go-nitro@telackey/update
containers:
# nitro
- cerc/nitro-contracts
- cerc/go-nitro
- cerc/nitro-rpc-client
pods:
- linea-testnet-go-nitro-auth
- nitro-contracts
- go-nitro-auth
@@ -1,55 +0,0 @@
# linea-testnet-nitro-auth
Deployes a demo stack for Nitro-based auth using the Linea Sepolia testnet.
## Clone required repositories
```
$ laconic-so --stack linea-testnet-nitro-auth setup-repositories
```
## Build containers
```
$ laconic-so --stack linea-testnet-nitro-auth build-containers
```
## Create a deployment
```
$ laconic-so --stack linea-testnet-nitro-auth deploy init --map-ports-to-host any-same --output linea-testnet-nitro-auth-spec.yml
$ laconic-so --stack linea-testnet-nitro-auth deploy create --spec-file linea-testnet-nitro-auth-spec.yml --deployment-dir linea-testnet-nitro-auth-deployment
```
## Set your keys
You must set the private keys for two accounts with funds on the target network. You must also set the URL to use
for a WebSocket connection, eg, `wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY>`
```
# For the first account (payer).
$ vim linea-testnet-nitro-auth-deployment/config/alice.env
CERC_NITRO_CHAIN_PK=<MY_PRIVATE_KEY>
CERC_NITRO_CHAIN_URL=wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY>
# For the second account (payee).
$ vim linea-testnet-nitro-auth-deployment/config/bob.env
CERC_NITRO_CHAIN_PK=<MY_PRIVATE_KEY>
CERC_NITRO_CHAIN_URL=wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY>
# For the bootnode, just set the URL.
$ vim linea-testnet-nitro-auth-deployment/config/bootnode.env
CERC_NITRO_CHAIN_URL=wss://linea-sepolia.infura.io/ws/v3/<MY_API_KEY>
```
## Start the stack
```
$ laconic-so deployment --dir linea-testnet-nitro-auth-deployment start
```
## Open the webapp
Visit http://localhost:5678