linuxserver / docker-mods

Documentation and Examples of base container modifications
GNU General Public License v3.0
1.02k stars 265 forks source link

universal-cloudflared: Error `requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.` #307

Closed tuxpeople closed 2 years ago

tuxpeople commented 2 years ago

I'm trying to set up Overseerr together with the universal-cloudflared but it fails.

This is my compose:

---
version: "2.4"
services:
  overseerr:
    image: lscr.io/linuxserver/overseerr
    container_name: overseerr
    environment:
      PUID: 911
      PGID: 911
      TZ: Europe/Zurich
      DOCKER_MODS: linuxserver/mods:universal-cloudflared
      CF_ZONE_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxx
      CF_API_TOKEN: xxxxxxxxxxxxxxxxxxxxxxxxxx
      CF_TUNNEL_CONFIG: |
        ingress:
          - hostname: plexrequest.xxxxxxxxxxxxxxxxxxxxx
            service: http://localhost:5055
          - service: http_status:404
    volumes:
      - /opt/compose/overseerr/data:/config
    ports:
      - 5055:5055
    restart: unless-stopped
    cpus: "0.5"
    healthcheck:
      test: wget http://localhost:5055/api/v1/status -qO /dev/null || exit 1
      interval: 1m00s
      timeout: 15s
      retries: 3

And this is what happens:

Attaching to overseerr
overseerr    | [mod-init] Curl/JQ was not found on this system for Docker mods installing
overseerr    | fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
overseerr    | fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
overseerr    | (1/4) Installing libcurl (7.79.1-r0)
overseerr    | (2/4) Installing curl (7.79.1-r0)
overseerr    | (3/4) Installing oniguruma (6.9.7.1-r0)
overseerr    | (4/4) Installing jq (1.6-r1)
overseerr    | Executing busybox-1.33.1-r6.trigger
overseerr    | OK: 62 MiB in 44 packages
overseerr    | [mod-init] Attempting to run Docker Modification Logic
overseerr    | [mod-init] Applying linuxserver/mods:universal-cloudflared files to container
overseerr    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
overseerr    | [s6-init] ensuring user provided files have correct perms...exited 0.
overseerr    | [fix-attrs.d] applying ownership & permissions fixes...
overseerr    | [fix-attrs.d] done.
overseerr    | [cont-init.d] executing container initialization scripts...
overseerr    | [cont-init.d] 01-envfile: executing...
overseerr    | [cont-init.d] 01-envfile: exited 0.
overseerr    | [cont-init.d] 02-tamper-check: executing...
overseerr    | [cont-init.d] 02-tamper-check: exited 0.
overseerr    | [cont-init.d] 10-adduser: executing...
overseerr    | usermod: no changes
overseerr    |
overseerr    | -------------------------------------
overseerr    |           _         ()
overseerr    |          | |  ___   _    __
overseerr    |          | | / __| | |  /  \
overseerr    |          | | \__ \ | | | () |
overseerr    |          |_| |___/ |_|  \__/
overseerr    |
overseerr    |
overseerr    | Brought to you by linuxserver.io
overseerr    | -------------------------------------
overseerr    |
overseerr    | To support the app dev(s) visit:
overseerr    | Overseerr Github Sponsors: https://github.com/sponsors/sct
overseerr    | Overseerr Patreon: https://patreon.com/overseerr
overseerr    |
overseerr    | To support LSIO projects visit:
overseerr    | https://www.linuxserver.io/donate/
overseerr    | -------------------------------------
overseerr    | GID/UID
overseerr    | -------------------------------------
overseerr    |
overseerr    | User uid:    911
overseerr    | User gid:    911
overseerr    | -------------------------------------
overseerr    |
overseerr    | [cont-init.d] 10-adduser: exited 0.
overseerr    | [cont-init.d] 30-config: executing...
overseerr    | [cont-init.d] 30-config: exited 0.
overseerr    | [cont-init.d] 90-custom-folders: executing...
overseerr    | [cont-init.d] 90-custom-folders: exited 0.
overseerr    | [cont-init.d] 95-apt-get: executing...
overseerr    | [cont-init.d] 95-apt-get: exited 0.
overseerr    | [cont-init.d] 98-cloudflared-config: executing...
overseerr    | **** Cloudflared setup script init... ****
overseerr    | **** Checking cloudflared setup script requirements... ****
overseerr    | **** Linux architecture found: amd64 ****
overseerr    | **** Linux distro found: alpine ****
overseerr    | **** Checking for cloudflared setup script dependencies... ****
overseerr    | **** Temporarily installing /tmp/yq... ****
overseerr    | **** jq already installed, skipping... ****
overseerr    | **** curl already installed, skipping... ****
overseerr    | **** Installing cloudflared...****
overseerr    | **** Moving /cloudflared/cloudflared-amd64 to /usr/local/bin/cloudflared... ****
overseerr    | **** Deleting tmp /cloudflared dir... ****
overseerr    | **** Cloudflared installed ****
overseerr    | cloudflared version 2022.1.2 (built 2022-01-13-1339 UTC)
overseerr    | **** Checking for optional cloudflare tunnel parameters... ****
overseerr    | **** Optional parameters blank or missing, skipped cloudflare tunnel setup ****
overseerr    | **** Cleaning up cloudflared setup script dependencies if required... ****
overseerr    | **** Uninstalling /tmp/yq... ****
overseerr    | **** Cloudflared setup script done, exiting... ****
overseerr    | [cont-init.d] 98-cloudflared-config: exited 0.
overseerr    | [cont-init.d] 99-custom-files: executing...
overseerr    | [custom-init] no custom files found exiting...
overseerr    | [cont-init.d] 99-custom-files: exited 0.
overseerr    | [cont-init.d] done.
overseerr    | [services.d] starting services
overseerr    | [services.d] done.
overseerr    | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr    | See 'cloudflared tunnel run --help'.
overseerr    | yarn run v1.22.10
overseerr    | $ NODE_ENV=production node dist/index.js
overseerr    | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr    | See 'cloudflared tunnel run --help'.
overseerr    | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.

It doesn't make a difference if I specify CF_TUNNEL_NAME or not. Is this a bug or am I using it wrong?

dephcon commented 2 years ago

I'm seeing a similar problem, I'm passing tunnel name, along with tunnel pass and token, neither seem to work

aptalca commented 2 years ago

Please post the full config you used.

I just tested this with tautulli, set all the env vars listed in the readme and it worked just fine

dephcon commented 2 years ago

After playing with it some more, it seems I need a minimum of CF_TUNNEL_PASSWORD to get past the error above, but I don't know what the password is. When the tunnel gets created it's stored in the .json file as "TunnelSecret"

You seem to be taking the CF_TUNNEL_PASSWORD, hitting it with base64 to generate the TunnelSecret. Is it possible to just pass it though as a CF_TUNNEL_SECRET variable or something?

When creating a tunnel at command line, the only info you get from the generated json file is AccountTag, TunnelSecret, TunnelID and TunnelName

Only applying CF_API_TOKEN and CF_TUNNEL_NAME doesn't seem to be enough as i get the "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file error

aptalca commented 2 years ago

I don't follow what you're suggesting. The tunnel name and password are required for this mod to work. You need to set all the vars.

What difference would it make between setting a password vs secret? They're the same thing with different encoding.

dephcon commented 2 years ago

sorry, i'll see if i can explain this better. If i create a new tunnel for this example:

root@vault13:~# cloudflared tunnel create git_example
Tunnel credentials written to /etc/cloudflared/e48bbd65-75c6-4666-9142-6f167bb548c2.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.

Created tunnel git_example with id e48bbd65-75c6-4666-9142-6f167bb548c2
2022-02-04T17:21:59Z WRN Your version 2022.1.3 is outdated. We recommend upgrading it to 2022.2.0

root@vault13:~# cat /mnt/cache/appdata/cloudflared/e48bbd65-75c6-4666-9142-6f167bb548c2.json 
{"AccountTag":"notmyaccountnumber","TunnelSecret":"t3MmVS0t8GjaFyBmv9sLEkZ7DC0+LKjtWcuFk+Qwn1Y=","TunnelID":"e48bbd65-75c6-4666-9142-6f167bb548c2","TunnelName":"git_example"}

So I've got AccountTag, TunnelSecret, TunnelID and TunnelName. Then I assign these to your CF variables, plus an api token i created incase it was required:

CF_TUNNEL_NAME: git_example
CF_ACCOUNT_ID: notmyaccountnumber
CF_TUNNEL_PASSWORD: t3MmVS0t8GjaFyBmv9sLEkZ7DC0+LKjtWcuFk+Qwn1Y=
CF_API_TOKEN: myapitoken

The problem seems to be that you're taking my TunnelSecret as CF_TUNNEL_PASSWORD and converting it to base64 and saving that as $TunnelSecret in your script:

"credentials_file": {
"AccountTag": "notmyaccountnumber",
"TunnelID": "e48bbd65-75c6-4666-9142-6f167bb548c2",
"TunnelName": "git_example",
"TunnelSecret": "dDNNbVZTMHQ4R2phRnlCbXY5c0xFa1o3REMwK0xLanRXY3VGaytRd24xWT0K"
}

then it fails because the tunnelsecret is wrong:

2022-02-04T17:24:48Z ERR Register tunnel error from server side error="Unauthorized: Invalid tunnel secret" connIndex=0
aptalca commented 2 years ago

Ah, gotcha. So you are getting a little ahead of yourself. You're not supposed to really create any tunnels manually. The mod takes care of it all. You just define a tunnel name and password (you make them up), and the mod will create the tunnel and set it up with the config you pass in yaml format.

You don't have to do anything in cli. Just set the vars and create the container.

dephcon commented 2 years ago

ugh, sorry for going off script here. I was running a dedicated cloudflared container so i figured i was just supposed to move that config over.

Back to the OPs problem, if i pick a unique TunnelName, and supply a random password and my API Token, it get the same error: "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.

aptalca commented 2 years ago

The password needs to be between 32 and 64 characters long, is that so in your case?

dephcon commented 2 years ago

Yes, i used the TunnelSecret from my git_example above, which is 44 chars

aptalca commented 2 years ago

That error suggests an issue with the algorithm that sets the arguments from the vars (or missing vars). Can you post a full log?

dephcon commented 2 years ago

not much about the vars in the container log, is there a local log i can cat?

[mod-init] Curl/JQ was not found on this system for Docker mods installing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/1) Installing jq (1.6-r1)
Executing busybox-1.33.1-r6.trigger
OK: 257 MiB in 228 packages
[mod-init] Attempting to run Docker Modification Logic
[mod-init] Applying linuxserver/mods:swag-dashboard files to container
[mod-init] Applying linuxserver/mods:universal-cloudflared files to container
[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] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[env-init] cannot find secret in FILE__CF_TUNNEL_CONFIG
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 02-tamper-check: executing...
[cont-init.d] 02-tamper-check: exited 0.
[cont-init.d] 10-adduser: executing...

-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/

Brought to you by linuxserver.io
-------------------------------------

To support the app dev(s) visit:
Certbot: https://supporters.eff.org/donate/support-work-on-certbot

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid: 99
User gid: 100
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
Variables set:
PUID=99
PGID=100
TZ=America/New_York
URL=<redacted>.net
SUBDOMAINS=<redacted>
EXTRA_DOMAINS=
ONLY_SUBDOMAINS=true
VALIDATION=dns
CERTPROVIDER=
DNSPLUGIN=cloudflare
EMAIL=<redacted>
STAGING=

Using Let's Encrypt as the cert provider
SUBDOMAINS entered, processing
SUBDOMAINS entered, processing
Only subdomains, no URL in cert
Sub-domains processed are: <redacted>
E-mail address entered: <redacted>
dns validation via cloudflare plugin is selected
Certificate exists; parameters unchanged; starting nginx
[cont-init.d] 50-config: exited 0.
[cont-init.d] 60-renew: executing...
The cert does not expire within the next day. Letting the cron script handle the renewal attempts overnight (2:08am).
[cont-init.d] 60-renew: exited 0.
[cont-init.d] 70-templates: executing...
[cont-init.d] 70-templates: exited 0.
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 95-apt-get: executing...
[cont-init.d] 95-apt-get: exited 0.
[cont-init.d] 98-cloudflared-config: executing...
**** Cloudflared setup script init... ****
**** Checking cloudflared setup script requirements... ****
**** Linux architecture found: amd64 ****
**** Linux distro found: alpine ****
**** Checking for cloudflared setup script dependencies... ****
**** Temporarily installing /tmp/yq... ****
**** jq already installed, skipping... ****
**** curl already installed, skipping... ****
**** Installing cloudflared...****
**** Moving /cloudflared/cloudflared-amd64 to /usr/local/bin/cloudflared... ****
**** Deleting tmp /cloudflared dir... ****
**** Cloudflared installed ****
cloudflared version 2022.2.0 (built 2022-02-04-1139 UTC)
**** Checking for optional cloudflare tunnel parameters... ****
**** Optional parameters blank or missing, skipped cloudflare tunnel setup ****
**** Cleaning up cloudflared setup script dependencies if required... ****
**** Uninstalling /tmp/yq... ****
**** Cloudflared setup script done, exiting... ****
[cont-init.d] 98-cloudflared-config: exited 0.
[cont-init.d] 98-dashboard-config: executing...
Applying the SWAG dashboard mod...
**** Installing/updating goaccess ****
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
OK: 257 MiB in 228 packages
Applied the SWAG dashboard mod
[cont-init.d] 98-dashboard-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
Server ready
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.

I'm using unraid so i dont have a nice docker compose to show but i do have variables set for:

DOCKER_MODS: linuxserver/mods:swag-dashboard|linuxserver/mods:universal-cloudflared
CF_TUNNEL_NAME: unraid_swag
CF_TUNNEL_PASSWORD: t3MmVS0t8GjaFyBmv9sLEkZ7DC0+LKjtWcuFk+Qwn1Y=
CF_API_TOKEN: myapitoken
FILE__CF_TUNNEL_CONFIG: /config/tunnelconfig.yml
aptalca commented 2 years ago

[env-init] cannot find secret in FILE__CF_TUNNEL_CONFIG

dephcon commented 2 years ago

i wrote my config per the instructions:

ingress:
  - hostname: home.redacted.net
    service: http://localhost:80
  - service: http_status:404

that said, the config file in my cloudflared container also define

tunnel: redacted
credentials-file: /home/nonroot/.cloudflared/redacted.json
aptalca commented 2 years ago

Can you do docker exec -it swag cat /config/tunnelconfig.yml ?

I don't understand the reference to the clouflared container. It is not needed here.

dephcon commented 2 years ago

Sorry, i was just refering to the working config.yml from my cloudfalred container.

root@vault13:~# docker exec -it swag cat /config/tunnelconfig.yaml
ingress:
  - hostname: home.redacted.net
    service: http://localhost:80
  - service: http_status:404

if it's expecting a reference to the secret via the tunnelID .json file you'd need to ammend that config after the tunnel is generated right? I cant possibly pre-populate the tunnelsecret prior to creation

aptalca commented 2 years ago

you didn't use the same command I posted yml != yaml

Either rename the file, or fix the env var

aptalca commented 2 years ago

if it's expecting a reference to the secret via the tunnelID .json file you'd need to ammend that config after the tunnel is generated right? I cant possibly pre-populate the tunnelsecret prior to creation

It's not expecting anything to be done prior. You just make up a tunnel name and password, and the mod handles all creation and management of the tunnel based on all the vars entered (including the config).

In your case, it can't set up the tunnel properly because you misspelled your var and it can't find the config

dephcon commented 2 years ago

ah good catch, i renamed the file to tunnelconfig.yml to match what i set in the variable but it's the same result, except the file is read in the log [env-init] CF_TUNNEL_CONFIG set from FILE__CF_TUNNEL_CONFIG

just as an aside, on the read-me you reference tunnelconfig.yml and tunnelconfig.yaml, pwned myself with copy pasta

aptalca commented 2 years ago

Still missing some vars?

These are all needed:

      CF_ZONE_ID:
      CF_ACCOUNT_ID:
      CF_API_TOKEN:
      CF_TUNNEL_NAME:
      CF_TUNNEL_PASSWORD:
      CF_TUNNEL_CONFIG:
aptalca commented 2 years ago

Please post your full docker run along with a full log.

dephcon commented 2 years ago

maybe some clarificaiton on what the ZONE_ID and ACCOUNT_ID are at CF. Lookign at my api token it SEEMS that the zone is mydomain.net and account ID is my email, but seems to not be working:


ErrorWarningSystemArrayLogin

[mod-init] Curl/JQ was not found on this system for Docker mods installing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/1) Installing jq (1.6-r1)
Executing busybox-1.33.1-r6.trigger
OK: 257 MiB in 228 packages
[mod-init] Attempting to run Docker Modification Logic
[mod-init] Applying linuxserver/mods:swag-dashboard files to container
[mod-init] Applying linuxserver/mods:universal-cloudflared files to container
[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] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[env-init] CF_TUNNEL_CONFIG set from FILE__CF_TUNNEL_CONFIG
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 02-tamper-check: executing...
[cont-init.d] 02-tamper-check: exited 0.
[cont-init.d] 10-adduser: executing...

-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/

Brought to you by linuxserver.io
-------------------------------------

To support the app dev(s) visit:
Certbot: https://supporters.eff.org/donate/support-work-on-certbot

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid: 99
User gid: 100
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing...
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing...
Variables set:
PUID=99
PGID=100
TZ=America/New_York
URL=<redacted>
SUBDOMAINS=<redacted>
EXTRA_DOMAINS=
ONLY_SUBDOMAINS=true
VALIDATION=dns
CERTPROVIDER=
DNSPLUGIN=cloudflare
EMAIL=<redacted>
STAGING=

Using Let's Encrypt as the cert provider
SUBDOMAINS entered, processing
SUBDOMAINS entered, processing
Only subdomains, no URL in cert
Sub-domains processed are: <redacted>
E-mail address entered: <redacted>
dns validation via cloudflare plugin is selected
Certificate exists; parameters unchanged; starting nginx
[cont-init.d] 50-config: exited 0.
[cont-init.d] 60-renew: executing...
The cert does not expire within the next day. Letting the cron script handle the renewal attempts overnight (2:08am).
[cont-init.d] 60-renew: exited 0.
[cont-init.d] 70-templates: executing...
[cont-init.d] 70-templates: exited 0.
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 95-apt-get: executing...
[cont-init.d] 95-apt-get: exited 0.
[cont-init.d] 98-cloudflared-config: executing...
**** Cloudflared setup script init... ****
**** Checking cloudflared setup script requirements... ****
**** Linux architecture found: amd64 ****
**** Linux distro found: alpine ****
**** Checking for cloudflared setup script dependencies... ****
**** Temporarily installing /tmp/yq... ****
**** jq already installed, skipping... ****
**** curl already installed, skipping... ****
**** Installing cloudflared...****
**** Moving /cloudflared/cloudflared-amd64 to /usr/local/bin/cloudflared... ****
**** Deleting tmp /cloudflared dir... ****
**** Cloudflared installed ****
cloudflared version 2022.2.0 (built 2022-02-04-1139 UTC)
**** Checking for optional cloudflare tunnel parameters... ****
**** Cloudflare tunnel parameters found, starting cloudflare tunnel setup... ****
**** Creating cloudflare tunnel (swag) via API... ****
{
"success": false,
"errors": [
{
"code": 7003,
"message": "Could not route to /accounts/<redacted>/tunnels, perhaps your object identifier is invalid?"
},
{
"code": 7000,
"message": "No route for that URI"
}
],
"messages": [],
"result": null
}
/var/run/s6/etc/cont-init.d/98-cloudflared-config: line 91: [[: 7003
7000: syntax error in expression (error token is "7000")
**** Saving cloudflare tunnel (swag) credentials json... ****
null
**** Cloudflare tunnel (swag) credentials saved to /etc/cloudflared/null.json ****
**** Generating config.yml for cloudflare tunnel (swag)... ****
tunnel: null
credentials-file: /etc/cloudflared/null.json
no-autoupdate: true
ingress:
- hostname: home.<redacted>.net
service: http://localhost:80
- service: http_status:404
**** Config for cloudflare tunnel (swag) saved to /etc/cloudflared/config.yml ****
**** Validating cloudflared tunnel rules... ****
{
"success": false,
"errors": [
{
"code": 7003,
"message": "Could not route to /accounts/<redacted>/tunnels, perhaps your object identifier is invalid?"
},
{
"code": 7000,
"message": "No route for that URI"
}
],
"messages": [],
"result": null
}
/var/run/s6/etc/cont-init.d/98-cloudflared-config: line 91: [[: 7003
7000: syntax error in expression (error token is "7000")
**** Saving cloudflare tunnel (swag) credentials json... ****
null
**** Cloudflare tunnel (swag) credentials saved to /etc/cloudflared/null.json ****
**** Generating config.yml for cloudflare tunnel (swag)... ****
tunnel: null
credentials-file: /etc/cloudflared/null.json
no-autoupdate: true
ingress:
- hostname: home.<redacted>.net
service: http://localhost:80
- service: http_status:404
**** Config for cloudflare tunnel (swag) saved to /etc/cloudflared/config.yml ****
**** Validating cloudflared tunnel rules... ****
Validating rules from /etc/cloudflared/config.yml
OK
**** Updating cloudflare zone... ****
**** Searching zone for hostname (home.<redacted>.net) via API... ****
**** Creating new CNAME for hostname (home.<redacted>.net) via API... ****
{
"success": false,
"errors": [
{
"code": 7003,
"message": "Could not route to /zones/<redacted>.net/dns_records, perhaps your object identifier is invalid?"
},
{
"code": 7000,
"message": "No route for that URI"
}
],
"messages": [],
"result": null
}
**** Cleaning up cloudflared setup script dependencies if required... ****
**** Uninstalling /tmp/yq... ****
**** Cloudflared setup script done, exiting... ****
[cont-init.d] 98-cloudflared-config: exited 0.
[cont-init.d] 98-dashboard-config: executing...
Applying the SWAG dashboard mod...
**** Installing/updating goaccess ****
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
OK: 257 MiB in 228 packages
Applied the SWAG dashboard mod
[cont-init.d] 98-dashboard-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
Server ready
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
aptalca commented 2 years ago

Lookign at my api token it SEEMS that the zone is mydomain.net and account ID is my email

They are not.

Log in to your cloudflare account, go to the Overview page of your domain and you'll see those listed at the bottom right

dephcon commented 2 years ago

getting closer, some sort of parsing error.

**** Cloudflare tunnel parameters found, starting cloudflare tunnel setup... ****
**** Creating cloudflare tunnel (swag) via API... ****
{
"success": false,
"errors": [
{
"code": 1030,
"message": "Could not parse input. Json deserialize error: control character (\\u0000-\\u001F) found while parsing a string at line 2 column 0"
}
],
"messages": [],
"result": null
}
**** Saving cloudflare tunnel (swag) credentials json... ****
null
**** Cloudflare tunnel (swag) credentials saved to /etc/cloudflared/null.json ****
**** Generating config.yml for cloudflare tunnel (swag)... ****
tunnel: null
credentials-file: /etc/cloudflared/null.json
no-autoupdate: true
ingress:
- hostname: home.<redacted>.net
service: http://localhost:80
- service: http_status:404
**** Config for cloudflare tunnel (swag) saved to /etc/cloudflared/config.yml ****
**** Validating cloudflared tunnel rules... ****
Validating rules from /etc/cloudflared/config.yml
OK
**** Updating cloudflare zone... ****
**** Searching zone for hostname (home.<redacted>.net) via API... ****
**** Updating existing CNAME for hostname (home.<redacted>.net) via API... ****
{
"result": {
"id": "bb25f66fc575abe2f53c6713a675881b",
"zone_id": "072b740b9dd72501814fb3538d2f72ca",
"zone_name": "<redacted>.net",
"name": "home.<redacted>.net",
"type": "CNAME",
"content": "null.cfargotunnel.com",
"proxiable": true,
"proxied": true,
"ttl": 1,
"locked": false,
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"created_on": "2021-08-02T17:20:59.573544Z",
"modified_on": "2022-02-04T18:33:56.070172Z"
},
"success": true,
"errors": [],
"messages": []
}
**** Cleaning up cloudflared setup script dependencies if required... ****
**** Uninstalling /tmp/yq... ****
**** Cloudflared setup script done, exiting... ****
[cont-init.d] 98-cloudflared-config: exited 0.
[cont-init.d] 98-dashboard-config: executing...
Applying the SWAG dashboard mod...
**** Installing/updating goaccess ****
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
OK: 257 MiB in 228 packages
Applied the SWAG dashboard mod
[cont-init.d] 98-dashboard-config: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
"cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
See 'cloudflared tunnel run --help'.
{
"result": {
"id": "bb25f66fc575abe2f53c6713a675881b",
"zone_id": "072b740b9dd72501814fb3538d2f72ca",
"zone_name": "<redacted>.net",
"name": "home.<redacted>.net",
"type": "CNAME",
"content": "null.cfargotunnel.com",
"proxiable": true,
"proxied": true,
"ttl": 1,
"locked": false,
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"created_on": "2021-08-02T17:20:59.573544Z",
"modified_on": "2022-02-04T18:33:56.070172Z"
},
"success": true,
"errors": [],
"messages": []
}
**** Cleaning up cloudflared setup script dependencies if required... ****
**** Uninstalling /tmp/yq... ****
**** Cloudflared setup script done, exiting... ****
aptalca commented 2 years ago

that one's explained in the readme

dephcon commented 2 years ago

ffs unraid must be adding them in. I've recreated all of the vars without pasting and i'm still getting it =\

ugh sorry for wasting your time.

dephcon commented 2 years ago

actually, poking around in the container i see that the base64 conversion used to make CF_TUNNEL_SECRET from CF_TUNNEL_PASSWORD gives a result with a space in it, coudl that be the problem?

root@10462a3d48ef:/# echo $CF_TUNNEL_PASSWORD
dDNNbVZTMHQ4R2phRnlCbXY5c0xFa1o3REMwK0xLanRXY3VGaytRd24xWT0K

root@10462a3d48ef:/# CF_TUNNEL_SECRET="$(command echo ${CF_TUNNEL_PASSWORD} | base64)"

root@10462a3d48ef:/# echo $CF_TUNNEL_SECRET
ZEROTmJWWlRNSFE0UjJwaFJubENiWFk1YzB4RmExbzNSRU13SzB4TGFuUlhZM1ZHYXl0UmQyNHhX VDBLCg==
dephcon commented 2 years ago

i shortened the password to 33 chars (if you use 32 it'll dump you out of the script because you're using -le 32, instead of -lt 32) and it works now.

I guess at a certain character length between 32 and 60, the base64 conversion borks it

tuxpeople commented 2 years ago

Still missing some vars?

These are all needed:

      CF_ZONE_ID:
      CF_ACCOUNT_ID:
      CF_API_TOKEN:
      CF_TUNNEL_NAME:
      CF_TUNNEL_PASSWORD:
      CF_TUNNEL_CONFIG:

Well, the documentation says otherwise:

Bildschirmfoto 2022-02-08 um 09 38 42

But I have all of them:

---
version: "2.1"
services:
  overseerr:
    image: lscr.io/linuxserver/overseerr
    container_name: overseerr
    environment:
      PUID: 1000
      PGID: 1000
      TZ: Europe/Zurich
      DOCKER_MODS: linuxserver/mods:universal-cloudflared
      CF_ZONE_ID: d1bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx41a
      CF_ACCOUNT_ID: 02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxb5a
      CF_API_TOKEN: vzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxS1Ob
      CF_TUNNEL_NAME: test-tunnel
      CF_TUNNEL_PASSWORD: kei4Lahxaichi6ea1Aer
      CF_TUNNEL_CONFIG: | 
        ingress:
          - hostname: cloudflared-tunnel-test.HEREISMYDOMAIN.com
            service: http://localhost:5055
          - service: http_status:404
    volumes:
      - /tmp/overseerr:/config
    ports:
      - 8055:5055
    restart: unless-stopped

as CF_ZONE_ID and CF_ACCOUNT_ID I have what Clouflare displays in the overview of my domain in the right column under API. As CF_API_TOKEN I have a newly created token with this permissions: image

And here is what I get:

$ docker compose up
[+] Running 1/1
 ⠿ Container overseerr  Recreated                                                                                                                                                                                    0.4s
Attaching to overseerr
overseerr  | [mod-init] Curl/JQ was not found on this system for Docker mods installing
overseerr  | fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
overseerr  | fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
overseerr  | (1/4) Installing libcurl (7.79.1-r0)
overseerr  | (2/4) Installing curl (7.79.1-r0)
overseerr  | (3/4) Installing oniguruma (6.9.7.1-r0)
overseerr  | (4/4) Installing jq (1.6-r1)
overseerr  | Executing busybox-1.33.1-r6.trigger
overseerr  | OK: 62 MiB in 44 packages
overseerr  | [mod-init] Attempting to run Docker Modification Logic
overseerr  | [mod-init] Applying linuxserver/mods:universal-cloudflared files to container
overseerr  | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
overseerr  | [s6-init] ensuring user provided files have correct perms...exited 0.
overseerr  | [fix-attrs.d] applying ownership & permissions fixes...
overseerr  | [fix-attrs.d] done.
overseerr  | [cont-init.d] executing container initialization scripts...
overseerr  | [cont-init.d] 01-envfile: executing... 
overseerr  | [cont-init.d] 01-envfile: exited 0.
overseerr  | [cont-init.d] 02-tamper-check: executing... 
overseerr  | [cont-init.d] 02-tamper-check: exited 0.
overseerr  | [cont-init.d] 10-adduser: executing... 
overseerr  | 
overseerr  | -------------------------------------
overseerr  |           _         ()
overseerr  |          | |  ___   _    __
overseerr  |          | | / __| | |  /  \
overseerr  |          | | \__ \ | | | () |
overseerr  |          |_| |___/ |_|  \__/
overseerr  | 
overseerr  | 
overseerr  | Brought to you by linuxserver.io
overseerr  | -------------------------------------
overseerr  | 
overseerr  | To support the app dev(s) visit:
overseerr  | Overseerr Github Sponsors: https://github.com/sponsors/sct
overseerr  | Overseerr Patreon: https://patreon.com/overseerr
overseerr  | 
overseerr  | To support LSIO projects visit:
overseerr  | https://www.linuxserver.io/donate/
overseerr  | -------------------------------------
overseerr  | GID/UID
overseerr  | -------------------------------------
overseerr  | 
overseerr  | User uid:    1000
overseerr  | User gid:    1000
overseerr  | -------------------------------------
overseerr  | 
overseerr  | [cont-init.d] 10-adduser: exited 0.
overseerr  | [cont-init.d] 30-config: executing... 
overseerr  | [cont-init.d] 30-config: exited 0.
overseerr  | [cont-init.d] 90-custom-folders: executing... 
overseerr  | [cont-init.d] 90-custom-folders: exited 0.
overseerr  | [cont-init.d] 95-apt-get: executing... 
overseerr  | [cont-init.d] 95-apt-get: exited 0.
overseerr  | [cont-init.d] 98-cloudflared-config: executing... 
overseerr  | **** Cloudflared setup script init... ****
overseerr  | **** Checking cloudflared setup script requirements... ****
overseerr  | **** Linux architecture found: amd64 ****
overseerr  | **** Linux distro found: alpine ****
overseerr  | **** Checking for cloudflared setup script dependencies... ****
overseerr  | **** Temporarily installing /tmp/yq... ****
overseerr  | **** jq already installed, skipping... ****
overseerr  | **** curl already installed, skipping... ****
overseerr  | **** Installing cloudflared...****
overseerr  | **** Moving /cloudflared/cloudflared-amd64 to /usr/local/bin/cloudflared... ****
overseerr  | **** Deleting tmp /cloudflared dir... ****
overseerr  | **** Cloudflared installed ****
overseerr  | cloudflared version 2022.2.0 (built 2022-02-07-1420 UTC)
overseerr  | **** Checking for optional cloudflare tunnel parameters... ****
overseerr  | **** Cloudflare tunnel password must be at least 32 characters long, exiting... ****
overseerr  | [cont-init.d] 98-cloudflared-config: exited 1.
overseerr  | [cont-init.d] 99-custom-files: executing... 
overseerr  | [custom-init] no custom files found exiting...
overseerr  | [cont-init.d] 99-custom-files: exited 0.
overseerr  | [cont-init.d] done.
overseerr  | [services.d] starting services
overseerr  | [services.d] done.
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | yarn run v1.22.10
overseerr  | $ NODE_ENV=production node dist/index.js
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | 2022-02-08T09:15:26.071Z [info]: Commit Tag: v1.28.0 
overseerr  | 2022-02-08T09:15:26.105Z [info]: Starting Overseerr version 1.28.0 
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | 2022-02-08T09:15:26.984Z [info][Notifications]: Registered notification agents 
overseerr  | 2022-02-08T09:15:27.009Z [info][Jobs]: Scheduled jobs loaded 
overseerr  | 2022-02-08T09:15:27.227Z [info][Server]: Server ready on port 5055 
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
overseerr  | "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file.
overseerr  | See 'cloudflared tunnel run --help'.
^CGracefully stopping... (press Ctrl+C again to force)
[+] Running 1/1
 ⠿ Container overseerr  Stopped                                                                                                                                                                                      3.6s
canceled

Edit I just saw the complain in the logs about the password lenght, so I generated a new one:

      CF_TUNNEL_NAME: test-tunnel
      CF_TUNNEL_PASSWORD: sheeLohv8raex9ohBegaisahfoa9ahsh

I generated this one using pwgen 32. But it still complains about the lenght:

overseerr  | **** Cloudflared installed ****
overseerr  | cloudflared version 2022.2.0 (built 2022-02-07-1420 UTC)
overseerr  | **** Checking for optional cloudflare tunnel parameters... ****
overseerr  | **** Cloudflare tunnel password must be at least 32 characters long, exiting... ****
overseerr  | [cont-init.d] 98-cloudflared-config: exited 1.
tuxpeople commented 2 years ago

i shortened the password to 33 chars (if you use 32 it'll dump you out of the script because you're using -le 32, instead of -lt 32) and it works now.

I guess at a certain character length between 32 and 60, the base64 conversion borks it

Exactly what happens. Now, with 33 characters it works. Thanks!