davechallis / ocypod

Ocypod is a Redis-backed service for orchestrating background jobs. Clients/workers can be written in any language, using HTTP/JSON to queue/fetch jobs, store results, etc.
Apache License 2.0
194 stars 14 forks source link

Feature: ARM64 ARMv7 and ARMv6 docker support #32

Open erwineverts opened 1 year ago

erwineverts commented 1 year ago

I would love running this service on a raspberry pi.

I found this blog post that enables GitHub Actions docker multi-arch support. https://sosedoff.com/2023/01/11/multiarch-docker-images-with-github-actions.html

davechallis commented 1 year ago

Should be doable! I'm planning to add more build automation/integration with Docker hub at some point soon, have just been massively behind on free time lately.

erwineverts commented 1 year ago

Let me know if and how I can help in any way. I have quite some experience with CICD using GitLab and Jenkins, so diving into Github Actions could be fun.

davechallis commented 1 year ago

I've made a quick start in the actions-updates branch which does a multiarch build/push.

It's only implemented for that branch and uses a temporary dev tag for now, as it needs some more work to integrate with the normal testing/push workflow.

For now if you wanted to test the multiarch images, you can use davechallis/ocypod:dev, which was build for amd64, arm64, arm/v6, and arm/v7.

erwineverts commented 1 year ago

Awesome, I'll will test them this weekend

erwineverts commented 1 year ago

On my RP2 (ARMv7) is still has issues using the example docker-compose with the dev tag.

This is the output:

docker-compose up
Pulling ocypod (davechallis/ocypod:dev)...
dev: Pulling from davechallis/ocypod
6fb81ff47bd6: Pull complete
13db6b952c5c: Pull complete
Digest: sha256:24924b72a302cc4e875e9b4996ea18abfad3405fedc0fdbd3c0720583118689e
Status: Downloaded newer image for davechallis/ocypod:dev
Starting ocypod-redis-docker_ocypod-redis_1 ... done
Recreating ocypod-redis-docker_ocypod_1     ... done
Attaching to ocypod-redis-docker_ocypod-redis_1, ocypod-redis-docker_ocypod_1
ocypod-redis_1  | 1:C 17 Mar 2023 19:18:17.855 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
ocypod-redis_1  | 1:C 17 Mar 2023 19:18:17.855 # Redis version=6.2.11, bits=32, commit=00000000, modified=0, pid=1, just started
ocypod-redis_1  | 1:C 17 Mar 2023 19:18:17.855 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
ocypod_1        | standard_init_linux.go:228: exec user process caused: exec format error
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.867 * monotonic clock: POSIX clock_gettime
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.869 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.870 * Running mode=standalone, port=6379.
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.871 # Server initialized
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.872 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.876 * Loading RDB produced by version 6.2.11
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.877 * RDB age 36 seconds
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.877 * RDB memory usage when created 0.63 Mb
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.877 # Done loading RDB, keys loaded: 0, keys expired: 0.
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.877 * DB loaded from disk: 0.002 seconds
ocypod-redis_1  | 1:M 17 Mar 2023 19:18:17.877 * Ready to accept connections
ocypod-redis-docker_ocypod_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Stopping ocypod-redis-docker_ocypod-redis_1 ... done

When I inspect the container it give the correct architecture: arm v7. But the digest is different than the one on that particular version on docker hub.

docker inspect davechallis/ocypod:dev 
[
    {
        "Id": "sha256:293acbdd4c6ee47003a1f97fdde4f3c971ad677cf11e6f472caabe8cffb3e045",
        "RepoTags": [
            "davechallis/ocypod:dev"
        ],
        "RepoDigests": [
            "davechallis/ocypod@sha256:24924b72a302cc4e875e9b4996ea18abfad3405fedc0fdbd3c0720583118689e"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2023-03-17T17:06:49.808132248Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "8023/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/local/bin/ocypod-server"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "arm",
        "Variant": "v7",
        "Os": "linux",
        "Size": 19454400,
        "VirtualSize": 19454400,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/b131d3f5c6103561bd4e9c472386eb2243081b40b7e116dd05436a68e0f7ed7f/diff",
                "MergedDir": "/var/lib/docker/overlay2/503ea28b747e1a2dd24bb98ae7077bcd536344037037fdc312c812eef2cf3daf/merged",
                "UpperDir": "/var/lib/docker/overlay2/503ea28b747e1a2dd24bb98ae7077bcd536344037037fdc312c812eef2cf3daf/diff",
                "WorkDir": "/var/lib/docker/overlay2/503ea28b747e1a2dd24bb98ae7077bcd536344037037fdc312c812eef2cf3daf/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:e5a10d101f18e82086c6b968e40cfb90a00be5061717c988291db79ad367bdcf",
                "sha256:8ad08e797e8d8854953834f3bdd04edbfaa35b3cde86c1fab05a0786bde0f531"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

This is the digest on docker hub: sha256:cfe58474dfd030d382e5f8a4dce22736a39447c35e6add0408c3b166e133a997 https://hub.docker.com/layers/davechallis/ocypod/dev/images/sha256-cfe58474dfd030d382e5f8a4dce22736a39447c35e6add0408c3b166e133a997?context=explore

I will still try this out on arm64 this weekend, I'm running nomad there so it takes a bit more converting time than simple docker-compose.

Thanks anyway for starting this for ARM

erwineverts commented 1 year ago

I guess the issue is the base image in the DockerFile in the builder base image clux/muslrust. It's amd64 only :cry:

davechallis commented 1 year ago

Thanks for testing, and good spot. I'll try and take another look sometime this week, hopefully there's an alternative build option (worst case would be using separate Dockerfiles for arm/non-arm builds).

erwineverts commented 1 year ago

I've been working on this a bit: https://github.com/davechallis/ocypod/compare/master...erwineverts:ocypod:master

Still getting a weird error:

# docker-compose up
ocypod_1        | standard_init_linux.go:228: exec user process caused: no such file or directory
ocypod-redis-docker_ocypod_1 exited with code 1

Usually this means that the file has windows line endings, but I couldn't find any.