Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

➕ Dockerfile.arm to support arm 32bit #988

Closed

Conversation

jeankhawand
Copy link

  • had to build it on my AllWinner H2 SoC which is running arm 32bit
  • it is working with no issues
  • it took some time to build dependencies – would be nice to have it accessible from docker registry cause it will require some effort when new version of cloudflared is out to rebuild....

@jeankhawand
Copy link
Author

2023-06-10T15:47:41Z INF Starting tunnel tunnelID=REDACTED 
2023-06-10T15:47:41Z INF Version 31d3670d
2023-06-10T15:47:41Z INF GOOS: linux, GOVersion: go1.19.10, GoArch: arm
2023-06-10T15:47:41Z INF Settings: map[no-autoupdate:true token:*****]
2023-06-10T15:47:41Z INF Generated Connector ID: REDACTED 
2023-06-10T15:47:41Z INF Initial protocol quic
2023-06-10T15:47:42Z INF ICMP proxy will use 172.18.0.2 as source for IPv4
2023-06-10T15:47:42Z INF ICMP proxy will use :: as source for IPv6
2023-06-10T15:47:42Z INF Starting metrics server on 127.0.0.1:35601/metrics
2023-06-10T15:47:42Z INF Registered tunnel connection connIndex=0 connection=REDACTED event=0 ip=198.41.192.7 location=CDG protocol=quic

@sudarshan-reddy
Copy link
Contributor

Thanks for this work @jeankhawand . I'm going to have to test this against our internal CI (since that's what builds the docker images) and get back to you.

@sudarshan-reddy sudarshan-reddy self-assigned this Aug 21, 2023
@jeankhawand
Copy link
Author

closes #987

@ahlixinjie
Copy link

waiting for this to be merged, so my mikrotik device can use it😢

@TylerMitton
Copy link

@sudarshan-reddy , do you expect this will be merged? thankful to you and @jeankhawand for your work on this.

@maijs
Copy link

maijs commented Oct 17, 2023

You can build an arm image on a Mac Silicon and transfer the image to an arm-based Mikrotik router with the following stpeps:

  1. Run docker buildx ls and check if your computer can build linux/arm/v7 platform images.
  2. Checkout the branch of the PR: git clone -b feature/support-armhf https://github.com/jeankhawand/cloudflared.git
  3. Change the directory: cd cloudflared
  4. Build an image: docker buildx build --platform linux/arm/v7 . -t MYNAME/cloudflared (change MYNAME to your username)
  5. Make sure the that image has been built: docker image ls
  6. Save the image on the disk: docker image save -o docker_cloudflared_arm IMAGE_ID
  7. Copy the image file to the Mikrotik device.

@maijs
Copy link

maijs commented Oct 17, 2023

I tested the PR and can confirm that it works. Looking forward to see it merged.

@maijs
Copy link

maijs commented Oct 17, 2023

@jeankhawand Could you please make two changes to the PR?

  1. Rebase the feature branch against the current cloudflare:master branch.
  2. Update the golang version in the Dockerfile.arm file to FROM golang:1.20.6 as builder to match the current Dockerfile.* in upstream repo?

jcsf and others added 17 commits October 22, 2023 15:09
… UDP session

This code was leaking streams because it wasn't closing the quic stream
after unregistering from the edge.
New gauge metrics are exposed in the prometheus endpoint to
capture the current and total TCP and UDP sessions that
cloudflared has proxied.
I deliberately kept this as an unregistertimeout because that was the
intent. In the future we could change this to a UDPConnConfig if we want
to pass multiple values here.

The idea of this PR is simply to add a configurable unregister UDP
timeout.
Allows for debugging the payloads that are sent in client mode to
the ssh server. Required to be run with --log-directory to capture
logging output. Additionally has maximum limit that is provided with
the flag that will only capture the first N number of reads plus
writes through the WebSocket stream. These reads/writes are not directly
captured at the packet boundary so some reconstruction from the
log messages will be required.

Added User-Agent for all out-going cloudflared access
tcp requests in client mode.
Added check to not run terminal logging in cloudflared access tcp
client mode to not obstruct the stdin and stdout.
Removes the final usage of raven-go and removes the dependency.
In the streambased origin proxy flow (example ssh over access), there is
a chance when we do not flush on http.ResponseWriter writes. This PR
guarantees that the response writer passed to proxy stream has a flusher
embedded after writes. This means we write much more often back to the
ResponseWriter and are not waiting. Note, this is only something we do
when proxyHTTP-ing to a StreamBasedOriginProxy because we do not want to
have situations where we are not sending information that is needed by
the other side (eyeball).
With the new flag --management-diagnostics (an opt-in flag)
cloudflared's will be able to report additional diagnostic information
over the management.argotunnel.com request path.
Additions include the /metrics prometheus endpoint; which is already
bound to a local port via --metrics.
/debug/pprof/(goroutine|heap) are also provided to allow for remotely
retrieving heap information from a running cloudflared connector.
DevinCarr and others added 21 commits October 22, 2023 15:09
Will no longer provide full hostname with path from provided
`--hostname` flag for cloudflared access to the Host header field.
This addresses certain issues caught from a security fix in go
1.19.11 and 1.20.6 in the net/http URL parsing.
Pins all docker and cfsetup builds to a specific go patch version.
Also ran go fix on repo.
This is simply because we no longer use the legacy R2 secret that needed
this encoding.
…ute IDs

This commits makes sure that cloudflared starts using the new API
endpoints for managing routes.

Additionally, the delete route operation still allows deleting by CIDR
and VNet but it is being marked as deprecated in favor of specifying the
route ID.

The goal of this change is to make it simpler for the user to delete
routes without specifying Vnet.
## Summary
Previously the force flag in the tunnel delete command was only explicitly deleting the
connections of a tunnel. Therefore, we are changing it to use the cascade query parameter
supported by the API. That parameter will delegate to the server the deletion of the tunnel
dependencies implicitly instead of the client doing it explicitly. This means that not only
the connections will get deleted, but also the tunnel routes, ensuring that no dependencies
are left without a non-deleted tunnel.
…installed

## Summary
To determine which services were installed, cloudflared, was using the command
`systemctl status` this command gives an error if the service is installed
but isn't running, which makes the `uninstall services` command report wrongly
the services not installed. Therefore, this commit adapts it to use the
`systemctl list-units` command combined with a grep to find which services are
installed and need to be removed.
This changes guarantees that the coommand to report rule matches when
testing local config reports the rule number using the 0-based indexing.
This is to be consistent with the 0-based indexing on the log lines when
proxying requests.
@farnos85
Copy link

farnos85 commented Nov 8, 2023

You can build an arm image on a Mac Silicon and transfer the image to an arm-based Mikrotik router with the following stpeps:

  1. Run docker buildx ls and check if your computer can build linux/arm/v7 platform images.
  2. Checkout the branch of the PR: git clone -b feature/support-armhf https://github.com/jeankhawand/cloudflared.git
  3. Change the directory: cd cloudflared
  4. Build an image: docker buildx build --platform linux/arm/v7 . -t MYNAME/cloudflared (change MYNAME to your username)
  5. Make sure the that image has been built: docker image ls
  6. Save the image on the disk: docker image save -o docker_cloudflared_arm IMAGE_ID
  7. Copy the image file to the Mikrotik device.

I tried this procedure on my mikrotik router with arm architecture, but I had this error "execve: Exec format error"

@maijs
Copy link

maijs commented Nov 8, 2023

@farnos85 On which Mikrotik router are you trying to create a container?

@farnos85
Copy link

farnos85 commented Nov 8, 2023

@farnos85 On which Mikrotik router are you trying to create a container?

https://mikrotik.com/product/hap_ac3

@cldparisi
Copy link

follow it

@maijs
Copy link

maijs commented Nov 14, 2023

@farnos85 On which Mikrotik router are you trying to create a container?

https://mikrotik.com/product/hap_ac3

@farnos85 The result of the steps I described was tested on a HAP AC2, which also has an arm 32bit processor. Need more testing from other people I suppose.

@farnos85
Copy link

@farnos85 On which Mikrotik router are you trying to create a container?

https://mikrotik.com/product/hap_ac3

@farnos85 The result of the steps I described was tested on a HAP AC2, which also has an arm 32bit processor. Need more testing from other people I suppose.

UPDATE:
image built on Raspberry PI 4 with Linux raspberrypi 6.1.21-v8+ --> execve: Exec format error
image built on GCP VM with Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1042-gcp x86_64) --> works correctly

@joliveirinha
Copy link
Contributor

We are not looking to support this platform at this time.
We may re-evaluate this in the future, and in that case, this would need to be done with proper context of our internal pipelines.

We appreciate your contribution and interest. thanks

@maijs maijs mentioned this pull request Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.