No CNAME's added
Blood13 opened this issue · comments
Hello.
I'm using Docker Swarm mode, Traefik 1.7.24 and latest image of docker-traefik-cloudflare-companion.
Here's my compose file:
version: '3.5'
services:
cloudflare-companion:
image: tiredofit/traefik-cloudflare-companion:latest
environment:
TRAEFIK_VERSION: 1
CF_EMAIL: my@email.com
CF_TOKEN: my-custom-cf-token
DOMAIN1: mydomain.com
DOMAIN1_ZONE_ID: my-zone-id
DOMAIN1_PROXIED: "true"
TARGET_DOMAIN: target.mydomain.com
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- traefik-net
- internal
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: none
networks:
traefik-net:
name: traefik-net
attachable: true
internal:
external: false
After start container logs:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 00-functions: applying...
[fix-attrs.d] 00-functions: exited 0.
[fix-attrs.d] 01-s6: applying...
[fix-attrs.d] 01-s6: exited 0.
[fix-attrs.d] 02-zabbix: applying...
[fix-attrs.d] 02-zabbix: exited 0.
[fix-attrs.d] 03-logrotate: applying...
[fix-attrs.d] 03-logrotate: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-startup: executing...
[cont-init.d] 00-startup: exited 0.
[cont-init.d] 01-timezone: executing...
[cont-init.d] 01-timezone: exited 0.
[cont-init.d] 02-permissions: executing...
[cont-init.d] 02-permissions: exited 0.
[cont-init.d] 03-zabbix: executing...
[cont-init.d] 03-zabbix: exited 0.
[cont-init.d] 04-cron: executing...
[NOTICE] ** [cron] Disabling Cron
[cont-init.d] 04-cron: exited 0.
[cont-init.d] 05-smtp: executing...
[NOTICE] ** [smtp] Disabling SMTP Features
[cont-init.d] 05-smtp: exited 0.
[cont-init.d] 10-cloudflare-companion: executing...
[NOTICE] ** [traefik-cloudflare-companion] Setting Traefik 1.x Mode
[cont-init.d] 10-cloudflare-companion: exited 0.
[cont-init.d] 99-container: executing...
[cont-init.d] 99-container: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[INFO] ** [zabbix] Starting Zabbix Agent
[INFO] ** [traefik-cloudflare-companion] Starting Traefik Cloudflare Companion
Then i start service with compose file:
version: '3'
services:
landing:
image: my-company/my-image:version
networks:
- traefik-net
deploy:
replicas: 1
labels:
- traefik.frontend.rule=Host:app.mydomain.com
- traefik.port=80
- traefik.enable=true
placement:
constraints:
- node.role == manager
restart: always
networks:
traefik-net:
external: true
Companion logs is empty (no new entries). No new records in Cloudflare.
What am i doing wrong?
Looks very similar to #8 - I still need to get on this, just have not had the time. Are you able to follow through the steps we were able to perform in that issue and see if it is the same?
Can you try SWARM_MODE=TRUE
on tiredofit/traefik-cloudflare-companion:develop
. Not sure if it will work as I don't have a swarm system to access to test.
@tiredofit after trying develop
image with SWAM_MODE: "true"
(also SWARM_MODE: "true"
) i have same information message over and over again:
[INFO] ** [traefik-cloudflare-companion] Starting Traefik Cloudflare Companion
Traceback (most recent call last):
File "/usr/sbin/cloudflare-companion", line 58, in <module>
init()
File "/usr/sbin/cloudflare-companion", line 48, in init
check_container(c)
File "/usr/sbin/cloudflare-companion", line 30, in check_container
for prop in c.attrs.get(u'Spec').get(u'Labels'):
AttributeError: 'NoneType' object has no attribute 'get'
Good catch. Spelling mistake there.
Glad you are around, I am just pushing a brand new copy of develop right now which I have succesfully working on my own swarm install. Can you give it a quick try?
There is still an issue. Need 5 more minutes.
Sure, waiting for you.
Alright, I believe It's good to go now. Try pulling tiredofit/traefik-cloudflare-companion:develop
again and see if you get results.
Looks like it's working!
I've got many log entries:
Found Container: None with Hostname app.mydomain.com
Created new record: app.mydomain.com to point to target.mydomain.com
** app.mydomain.com - 81053 An A, AAAA or CNAME record already exists with that host.
Indeed, i already have that entry (A record). It would be nice to check records and have options what to do with them (update, skip). It's a bit scary, cause i don't want to mess up my dns records.
Thank you so much!
Fantastic. There's an option "REFRESH_ENTRIES=TRUE" which will allow updating the record, but that error that it listed is normal as it is just saying it already exists and by default Cloudflare won't update an already existing record.
This script has taken a bit of a life on it's own in the past little bit. I'm going to push this new release (5.0.0) out today and then think about rewriting the entire thing in neat future and also take into consideration the SKIP/UPDATE factor you have suggested.
Now rewritten as tiredofit/traefik-cloudflare-companion:6.0.0
in pure Python3 - Thanks for the boost of confidence.