Add DNS management and deployment procedures to agents.md
This commit is contained in:
parent
7c014f6534
commit
7db4dc3f25
1 changed files with 43 additions and 20 deletions
63
agents.md
63
agents.md
|
|
@ -32,11 +32,7 @@
|
||||||
|
|
||||||
### curl Usage
|
### curl Usage
|
||||||
When using curl commands, always set a timeout to 5 seconds:
|
When using curl commands, always set a timeout to 5 seconds:
|
||||||
```bash
|
curl -m 5
|
||||||
curl --max-time 5 <url>
|
|
||||||
# or
|
|
||||||
curl -m 5 <url>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Procedures
|
## Procedures
|
||||||
|
|
||||||
|
|
@ -57,6 +53,7 @@ curl -m 5 <url>
|
||||||
- Add the necessary configuration to the appropriate server file in `servers/`
|
- Add the necessary configuration to the appropriate server file in `servers/`
|
||||||
- Include nginx reverse proxy configuration if the app needs to be accessible via HTTP/HTTPS
|
- Include nginx reverse proxy configuration if the app needs to be accessible via HTTP/HTTPS
|
||||||
- Add any required firewall rules, services, or users
|
- Add any required firewall rules, services, or users
|
||||||
|
- Create A record at Cloudflare if needed
|
||||||
|
|
||||||
4. **Local Testing**
|
4. **Local Testing**
|
||||||
- Test the build locally: `nixos-rebuild build --flake .#<system>`
|
- Test the build locally: `nixos-rebuild build --flake .#<system>`
|
||||||
|
|
@ -88,27 +85,46 @@ curl -m 5 <url>
|
||||||
- Check Let's Encrypt logs: `journalctl -u certbot -f`
|
- Check Let's Encrypt logs: `journalctl -u certbot -f`
|
||||||
- Manually trigger certificate renewal if needed
|
- Manually trigger certificate renewal if needed
|
||||||
|
|
||||||
|
### DNS Management
|
||||||
|
|
||||||
|
#### Create DNS Record via Cloudflare API
|
||||||
|
```bash
|
||||||
|
# Get zone ID for domain
|
||||||
|
ZONE_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones?name=symbiotrip.com" \
|
||||||
|
-H "Authorization: Bearer <CLOUDFLARE_API_TOKEN>" \
|
||||||
|
-H "Content-Type: application/json" | jq -r '.result[0].id')
|
||||||
|
|
||||||
|
# Create A record
|
||||||
|
curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" \
|
||||||
|
-H "Authorization: Bearer <CLOUDFLARE_API_TOKEN>" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data '{"type":"A","name":"<subdomain>","content":"<IP_ADDRESS>","ttl":1,"proxied":true}'
|
||||||
|
```
|
||||||
|
**Common DNS Issues:**
|
||||||
|
- Local DNS caching: Add entry to `/etc/hosts` temporarily for testing
|
||||||
|
- Use Cloudflare's proxy IPs directly if DNS propagation is slow
|
||||||
|
|
||||||
8. **Process Improvement**
|
8. **Process Improvement**
|
||||||
- After successful deployment, propose 3 suggestions to add to agents.md that would help with future deployments:
|
- After successful deployment, propose 3 new tools to add to agents.md.
|
||||||
1. [Specific pattern or configuration approach discovered]
|
|
||||||
2. [Common pitfall to avoid]
|
|
||||||
3. [Useful command or tool discovered]
|
|
||||||
|
|
||||||
### Infrastructure Tasks
|
### Useful Commands
|
||||||
|
|
||||||
#### Planned Work
|
```bash
|
||||||
|
# Check generated configuration before deployment
|
||||||
|
nix eval '.#nixosConfigurations.<system>.config.services.<service>.enable'
|
||||||
|
|
||||||
1. **Borg Backup Server**
|
# List systemd services from new config
|
||||||
- Set up a dedicated Borg backup server for automated backups
|
ls /nix/store/<path>-nixos-system-<system>/etc/systemd/system/*.service
|
||||||
- Configure backup schedules for critical systems
|
|
||||||
- Implement retention policies and pruning rules
|
|
||||||
|
|
||||||
2. **Secrets Management with sops-nix**
|
# Test nginx configuration
|
||||||
- Implement sops-nix for secrets management
|
ssh <hostname> 'nginx -t'
|
||||||
- Move all hardcoded secrets from server configs into sops-nix
|
|
||||||
- Set up encryption keys and key rotation policies
|
|
||||||
- Document the secrets management workflow
|
|
||||||
|
|
||||||
|
# Check ACME certificate status
|
||||||
|
ssh <hostname> 'ls -la /var/lib/acme/<domain>/'
|
||||||
|
|
||||||
|
# Verify certificate issuer
|
||||||
|
openssl s_client -connect <domain>:443 | openssl x509 -noout -issuer
|
||||||
|
```
|
||||||
|
|
||||||
## Remote System Management
|
## Remote System Management
|
||||||
|
|
||||||
|
|
@ -151,6 +167,13 @@ ssh <hostname> 'journalctl -u <service> -f'
|
||||||
|
|
||||||
# Rebuild if build fails
|
# Rebuild if build fails
|
||||||
ssh <hostname> 'cd ~/src/nixos && git pull && sudo nixos-rebuild switch --flake .#'
|
ssh <hostname> 'cd ~/src/nixos && git pull && sudo nixos-rebuild switch --flake .#'
|
||||||
|
|
||||||
|
# Test site availability via IP
|
||||||
|
ssh <hostname> 'curl -k -I https://localhost:<port>'
|
||||||
|
curl -I https://<IP> -H "Host: <domain>"
|
||||||
|
|
||||||
|
# Get public IP
|
||||||
|
curl -s https://api.ipify.org
|
||||||
```
|
```
|
||||||
|
|
||||||
### Repository
|
### Repository
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue