presslabs/zinc.
N.B. If implementing your own app it's your responsibility to call
ip.mark_policy_records_dirty if the IP changes, so that zinc's reconcile loop will
actually pick up the changes.
Zinc will create a Route53 Health Check for each IP. If Route53 deems the IP unavailable, it will stop routing traffic to it.
Currently the Health Checks are hardcoded to expect all servers to accept requests with the
same FQDN (defaults to node.presslabs.net, set ZINC_HEALTH_CHECK_FQDN to change).
A policy groups several IPs together. There are 2 types of policies:
Note that an IP can be a member of multiple Policies at the same time. A PolicyMember can has it's own enabled flag, so you can disable an IP for one Policy only, or you can disable the it for all Policies by setting the enabled flag on the IP model.
Trafic will be routed to all IP's based on their weights. Bigger weight means more trafic.
Each IP you add to a Policy will have a region specified as well. The region must be an AWS region. IPs will still have weights, which will be used to balance the trafic within a region. When a cliend does a DNS lookup, they'll get directed to the region with the lowest latency, and then an IP will be picked based on weight.
The resulting setup will be similar to the example described here: [***]
Your desired DNS record. In Route53 it will be an alias to the Latency or Weighted records that make up a Policy.
For simple records in a zone (anything except a PolicyRecord) AWS is the Sigle Source of Truth. Zinc never stores those locally.
For Zones, HealthChecks and PolicyRecords Zinc's database is the single source of truth. Zinc runs reconcile loops and attempts to update your AWS data to match the expected state in the DB. To minimize throttling by AWS, in most cases, Zinc only attempts to reconcile objects marked deemed dirty. This means it is possible to have a missmatch between what you have in AWS and Zinc's expected state if you make changes bypassing Zinc (using the AWS console, or the api).
You are encouraged to install django-rest-swagger, run zinc locally and explore the API at http://localhost:8000/swagger
Policies are read only trough the API. You can define them in the admin.
GET /policies
GET /policies/{id}
GET /policies/344b7bee-da33-4234-b645-805cc26adab0 { "id": "344b7bee-da33-4234-b645-805cc26adab0", "name": "policy-one", "members": [ { "id": "6bcb4e77-04dc-45f7-bebb-a2fcfadd7669", "region": "us-east-1", "ip": "192.0.2.11", "weight": 10, "enabled": true }, { "id": "4f83d47f-af0c-4fa7-80c8-710cb32e4928", "region": "us-west-1", "ip": "192.0.2.11", "weight": 10, "enabled": true } ], "url": "[***]" }
GET /zones/
POST /zones/
Args:
| argument | required | default | description |
|---|---|---|---|
| root | required | - | The domain name of this zone. Trailing dot is optional. |
Returns the newly created zone object.
DELETE /zones/{zone_id}/
GET /zones/{zone_id}
Example:
GET /zones/102 { "root": "zinc.example.presslabs.net.", "url": "[***]", "records_url": "[***]", "records": [ { "name": "@", "fqdn": "zinc.example.presslabs.net.", "type": "NS", "values": [ "ns-389.awsdns-48.com.", "ns-1596.awsdns-07.co.uk.", "ns-1008.awsdns-62.net.", "ns-1294.awsdns-33.org." ], "ttl": ***, "dirty": false, "id": "Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0", "url": "[***]", "managed": true }, { "name": "@", "fqdn": "zinc.example.presslabs.net.", "type": "SOA", "values": [ "ns-389.awsdns-48.com. awsdns-hostmaster.amazon.com. 1 7200 900 *** 86400" ], "ttl": 900, "dirty": false, "id": "Z6k504rwKzbamNZ6Z7doJ0yg98j9zA", "url": "[***]", "managed": true } ], "route53_id": "Z8QRF09VVGAC6", "dirty": false, "ns_propagated": false }
GET /zones/{zone_id}/records
Example:
GET /zones/102/records [ { "name": "@", "fqdn": "zinc.example.presslabs.net.", "type": "NS", "values": [ "ns-389.awsdns-48.com.", "ns-1596.awsdns-07.co.uk.", "ns-1008.awsdns-62.net.", "ns-1294.awsdns-33.org." ], "ttl": ***, "dirty": false, "id": "Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0", "url": "[***]", "managed": true }, { "name": "@", "fqdn": "zinc.example.presslabs.net.", "type": "SOA", "values": [ "ns-389.awsdns-48.com. awsdns-hostmaster.amazon.com. 1 7200 900 *** 86400" ], "ttl": 900, "dirty": false, "id": "Z6k504rwKzbamNZ6Z7doJ0yg98j9zA", "url": "[***]", "managed": true } ]
POST /zones/{zone_id}/records
Args:
| argument | required | default | description |
|---|---|---|---|
| name | required | - | The domain name (without the zone root). |
| type | required | - | The record type. Must be either POLICY_ROUTED or a valid record type. |
| values | required | - | List of values. Should be one IP for A, MX records, a policy id for POLICY_ROUTED, one or more domain names for NS records. |
| ttl | optional | 300 | The TTL for DNS. |
DELETE /zones/{zone_id}/records/{record_id}
GET /zones/{zone_id}/records/{record_id}
Example:
GET /zones/102/records/Z6k504rwKzbamNZ1ZxLxRR4BKly04J { "name": "www", "fqdn": "[***]", "type": "POLICY_ROUTED", "values": [ "344b7bee-da33-4234-b645-805cc26adab0" ], "ttl": null, "dirty": false, "id": "Z6k504rwKzbamNZ1ZxLxRR4BKly04J", "url": "[***]", "managed": false }
PATCH /zones/{zone_id}/records/{record_id}
The type and name can't be changed. Missing attributes don't change.
| argument | required | default | description |
|---|---|---|---|
| values | optional | - | List of values. Should be one IP for A, MX records, a policy id for POLICY_ROUTED, one or more domain names for NS records. |
| ttl | optional | - | The TTL for DNS. |
The recomended way to get up and running is using our Docker container.
cd contrib/ docker-compose up
If you run the django project with default settings, you can configure zinc by setting environment variables. If you're using the provided docker-compose.yml you can set the environment in ./zinc.env
The following are essential and required:
ZINC_AWS_KEY - AWS Key ZINC_AWS_SECRET - AWS Secret ZINC_SECRET_KEY - Django secret
You can also set the following:
ZINC_ALLOWED_HOSTS - Django Allowed Hosts ZINC_BROKER_URL - Celery Broker URL, defaults to ${REDIS_URL}/0 ZINC_CELERY_RESULT_BACKEND - Celery Result Backend, defaults to ${REDIS_URL}/1 ZINC_DATA_DIR - PROJECT_ROOT ZINC_DB_ENGINE - The django db engine to use. Defaults to 'django.db.backends.sqlite3' ZINC_DB_HOST - ZINC_DB_NAME - zinc ZINC_DB_PASSWORD - password ZINC_DB_PORT - ZINC_DB_USER - zinc ZINC_DEBUG - Django debug. Defaults to False. Set to the string "True" to turn on debugging. ZINC_DEFAULT_TTL - 300 ZINC_ENV_NAME - The environment for sentry reporting. ZINC_GOOGLE_OAUTH2_KEY - For use with social-django. If you don't set this, social-django will be disabled. ZINC_GOOGLE_OAUTH2_SECRET - For use with social-django. ZINC_SOCIAL_AUTH_ADMIN_EMAILS - List of email addresses that will be automatically granted admin access. ZINC_SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS - see [***] ZINC_HEALTH_CHECK_FQDN - Hostname to use in Health Checks. Defaults to 'node.presslabs.net.' ZINC_LOCK_SERVER_URL - Used with redis-lock. Defaults to ${REDIS_URL}/2. ZINC_LOG_LEVEL - Defaults to INFO ZINC_NS_CHECK_RESOLVERS - NameServers to use when checking zone propagation. Default: ['8.8.8.8'] ZINC_REDIS_URL - Defaults to 'redis://localhost:6379' ZINC_SECRET_KEY - The secret key used by the django app. ZINC_SENTRY_DSN - Set this to enable sentry error reporting. ZINC_STATIC_URL - Defaults to '/static/' ZINC_ZONE_OWNERSHIP_COMMENT - Set this comment on records, to Defaults to 'zinc'
Warning! Don't use production AWS credentials when developing or testing Zinc!
After you've cloned the code:
pip install -r requirements.dev.txt python setup.py develop cp local_settings.py.example local_settings.py # open local_settings.py in your favorite editor, and set AWS credentials
To run the tests:
# all tests py.test . # to skip tests that need AWS py.test -k 'not with_aws' .
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务