This project provides tools to manage frontend deployments using Oyster CVM and DNS management capabilities.
- Rust (latest stable version)
- Docker
- Access to the Optimism network
- Wallet with sufficient funds for contract deployment
- Domain name to manage
- Oyster CVM CLI tool (v4.0.0) installed
oyster-fe-manager/
├── dns-client/ # Rust client for DNS record management
├── dns-manager/ # Rust manager to run inside the enclave
├── caddy.json # Caddy server configuration
└── Readme.md # This file
-
Clone the repository:
git clone https://github.com/marlinprotocol/3dns-manager cd 3dns-manager -
Build the DNS client:
cd dns-client cargo build --release -
Make dns-client globally available: Copy the built dns-client from the release folder to
/usr/local/bin/and give it execute permission.sudo cp target/release/dns-client /usr/local/bin/ sudo chmod +x /usr/local/bin/dns-client
-
Buy a domain at 3dns.
-
Transfer the domain to the domain manager:
dns-client transfer-domain --domain letsgoo.tech --wallet-private-key ***** -
Set WHOIS delegate:
dns-client set-whois --domain letsgoo.tech --wallet-private-key ***** -
Deploy KMS verifier contract:
oyster-cvm kms-contract deploy --wallet-private-key **** -
Compute the image ID:
oyster-cvm compute-image-id \ --contract-address 0x166EeA146F559FC842D37C5899632eef8B7FB458 \ --chain-id 42161 \ --docker-compose docker-compose.yml \ --arch amd64 \ --preset debug
Note: Running in debug mode might expose sensitive data.oyster-cvm compute-image-id \ --contract-address 0x166EeA146F559FC842D37C5899632eef8B7FB458 \ --chain-id 42161 \ --docker-compose docker-compose.yml \ --arch amd64 \
-
Approve the image ID in the contract:
oyster-cvm kms-contract approve \ --wallet-private-key <key> \ --image-id <image_id> \ --contract-address <address>
-
Set the KMS keys:
dns-client set-kms-key \ --domain letsgoo.tech \ --kms-contract-address <KMS_CONTRACT_ADDRESS> \ --wallet-private-key ******
-
Build and push Docker images:
- Build and push your website image:
docker build -t <your_dockerhub_username>/oyster-fe-kit:latest . docker push <your_dockerhub_username>/oyster-fe-kit:latest
- Build and push the DNS manager image:
cd dns-manager docker build -t <your_dockerhub_username>/dns-manager:latest . docker push <your_dockerhub_username>/dns-manager:latest
- Build and push your website image:
-
Modify configuration files:
- In
caddy.json, set:"host": ["<YOUR_DOMAIN_NAME>"]
- In
docker-compose.yml, update:services: caddy: image: <DOCKERHUB_USERNAME>/oyster-fe-kit:latest network_mode: host volumes: - caddy_data:/data - caddy_config:/config dns-manager: image: <DOCKERHUB_USERNAME>/dns-manager:latest network_mode: host environment: - DOMAIN_NAME=<DOMAIN_NAME> volumes: - caddy_data:/data volumes: caddy_data: caddy_config:
- In
-
Deploy the entire setup with Oyster CVM:
oyster-cvm deploy \ --duration-in-minutes 180 \ --docker-compose ./docker-compose.yml \ --wallet-private-key *** \ --debug \ --arch amd64 \ --instance-type c5n.xlarge \ --contract-address <KMS_VERIFIER_CONTRACT> \ --chain-id 42161 \ --region us-west-2 \ --preset debug \ --image-url https://artifacts.marlin.org/oyster/eifs/base-blue_v3.0.0_linux_amd64.eif
Note: Running in debug mode might expose sensitive data.oyster-cvm deploy \ --duration-in-minutes 180 \ --docker-compose ./docker-compose.yml \ --wallet-private-key *** \ --arch amd64 \ --instance-type c5n.xlarge \ --contract-address <KMS_VERIFIER_CONTRACT> \ --chain-id 42161 \ --region us-west-2
Note: Note down the IP address returned by the Oyster CVM CLI. You will need this in the next step.
Note: Make sure the computed image ID returned by this command matches the computed image ID from Step 5.
-
Set DNS records with the DNS client:
dns-client set-dns --domain letsgoo.tech --enclave-ip <ENCLAVE_IP> --wallet-private-key ****
-
Wait for DNS propagation: It may take a few minutes for DNS propagation. Once complete, your site should be available at your domain.
- Ensure your wallet has admin permissions on the contract before setting DNS records.
- The enclave IP should be accessible from your machine.
- Keep your private keys secure and never share them.
- Always verify DNS propagation after making changes.
- If you get "AccessControl" errors, ensure your wallet has admin permissions.
- If DNS records are not updating, check:
- Contract transaction status
- DNS propagation time (can take up to 24 hours)
- Enclave connectivity
- Subdomain management
- Add mechanisms for delays between setting CAA and A records to avoid race conditions in record propagation
- Race condition possible between propagation of CAA and A records as records are propagated individually, so not a good idea to set them together.
- A record should only be set after setting CAA record to ensure security.
- TTL for records should be configurable
- Expand support to ACME services apart from Let's Encrypt