diff --git a/agents.md b/agents.md index 6c517ec..2f7181f 100644 --- a/agents.md +++ b/agents.md @@ -32,11 +32,7 @@ ### curl Usage When using curl commands, always set a timeout to 5 seconds: -```bash -curl --max-time 5 -# or -curl -m 5 -``` +curl -m 5 ## Procedures @@ -57,6 +53,7 @@ curl -m 5 - 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 - Add any required firewall rules, services, or users + - Create A record at Cloudflare if needed 4. **Local Testing** - Test the build locally: `nixos-rebuild build --flake .#` @@ -88,27 +85,46 @@ curl -m 5 - Check Let's Encrypt logs: `journalctl -u certbot -f` - 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 " \ + -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 " \ + -H "Content-Type: application/json" \ + --data '{"type":"A","name":"","content":"","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** - - After successful deployment, propose 3 suggestions to add to agents.md that would help with future deployments: - 1. [Specific pattern or configuration approach discovered] - 2. [Common pitfall to avoid] - 3. [Useful command or tool discovered] + - After successful deployment, propose 3 new tools to add to agents.md. -### Infrastructure Tasks +### Useful Commands -#### Planned Work +```bash +# Check generated configuration before deployment +nix eval '.#nixosConfigurations..config.services..enable' -1. **Borg Backup Server** - - Set up a dedicated Borg backup server for automated backups - - Configure backup schedules for critical systems - - Implement retention policies and pruning rules +# List systemd services from new config +ls /nix/store/-nixos-system-/etc/systemd/system/*.service -2. **Secrets Management with sops-nix** - - Implement sops-nix for secrets management - - Move all hardcoded secrets from server configs into sops-nix - - Set up encryption keys and key rotation policies - - Document the secrets management workflow +# Test nginx configuration +ssh 'nginx -t' +# Check ACME certificate status +ssh 'ls -la /var/lib/acme//' + +# Verify certificate issuer +openssl s_client -connect :443 | openssl x509 -noout -issuer +``` ## Remote System Management @@ -151,6 +167,13 @@ ssh 'journalctl -u -f' # Rebuild if build fails ssh 'cd ~/src/nixos && git pull && sudo nixos-rebuild switch --flake .#' + +# Test site availability via IP +ssh 'curl -k -I https://localhost:' +curl -I https:// -H "Host: " + +# Get public IP +curl -s https://api.ipify.org ``` ### Repository