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

feat: Arm64 images #52

Closed
aleksasiriski opened this issue Oct 2, 2024 · 19 comments
Closed

feat: Arm64 images #52

aleksasiriski opened this issue Oct 2, 2024 · 19 comments

Comments

@aleksasiriski
Copy link
Contributor

aleksasiriski commented Oct 2, 2024

Description

Hello there, I'm the author of Autoscan continuation after the original author stopped working on it. I also stopped improving it after adding Postgres and would definitely prefer not to have to maintain it if this ends up working good :) I see you also support Postgres (which is great).

As for this issue, I see on Dockerhub that there are no arm64 build of the image. It would be great if you added these (as this is written in Rust, there shouldn't be any problems building cross platform binaries). If you decide to add arm64 images, I will be able to test this on my k8s cluster and see how it works.

Additional question: Have you thought about having multiple replicas of this project running at the same time, is there any kind of queue for the tasks? This would bring load balancing and high-availability to those of us that try to have it with Jellyfin

Additional Information

No response

@dan-online
Copy link
Owner

Hey @aleksasiriski, great to hear from you! Yep diesel is great to allow multiple database backends in Rust, makes development a lot easier. As for arm64, I do have to check out how to do that correctly as I had some issues with building binaries before.

As for multiple replicas- the only state that remains in-memory is the timers which I'll be refactoring to the database in #47. The only other issue I see is with the job loops which, in a rare case, could try to process simultaneously. Possibly a solution would be to add a "processing" state to prevent other replicas from touching those ScanEvents, however I'm open to any suggestions!

@aleksasiriski
Copy link
Contributor Author

Great to hear!

Yeah, probably some lock mechanism as you described with "processing" state, just have to think about how to release it if it doesn't get processed (pod crashed or something). So maybe something with TTL that gets it's TTL reset every few seconds by the worker that is processing it. Not sure if you should introduce more complexity with some queueing system component or DIY it using the database. Either way, if you leave it as is currently it's also very good :D

@dan-online
Copy link
Owner

Hey @aleksasiriski sorry for the long reply! I had some.. difficulty.. with arm64 however I seem to have figured it out with #56 and danonline/autopulse:pr-56-arm64 should work but do let me know as I can't test it

@aleksasiriski
Copy link
Contributor Author

Thanks for your hard work, I will test it next week and get back to you :)

@dan-online
Copy link
Owner

Thanks for your hard work, I will test it next week and get back to you :)

No problem, I will say using qemu on github actions takes like over an hour to build an arm image, lemme know if you have any ideas on how to make that better

@aleksasiriski
Copy link
Contributor Author

Couldn't you crossbuild on normal Github CI? That's what I do for Go projects, just set the output to be for arm. Although, then you must build outside of Dockerfile and copy it over inside.

@dan-online
Copy link
Owner

Cross-building diesel is a bit of a pain sadly, libpq and libsqlite are both temperamental about being statically linked let-alone cross-built. I'll see if doing it outside docker gives me a bit more leeway though

@aleksasiriski
Copy link
Contributor Author

I've successfully started the container in my K8s cluster, will let you know if it works as expected with sonarr+radarr+jellyfin.

@dan-online
Copy link
Owner

Hey @aleksasiriski I changed it today to use cross which finally seems to be the solution, let me know if the image works on your end!

@aleksasiriski
Copy link
Contributor Author

Is there a new tag, or is it already on latest?

@dan-online
Copy link
Owner

Is there a new tag, or is it already on latest?

Should be on pr-56-arm64

@myhme
Copy link
Contributor

myhme commented Nov 3, 2024

good work on autopulse 👍 , btw will there be arm64 version of autopulse-ui ?

@aleksasiriski
Copy link
Contributor Author

I tested this and it works good, so you can merge and close this whenever you feel it's good

@dan-online
Copy link
Owner

good work on autopulse 👍 , btw will there be arm64 version of autopulse-ui ?

Shouldn't be too hard, I'll merge #56 first and then check that out

@dan-online
Copy link
Owner

@myhme could you check danonline/autopulse:ui-pr-90 works?

@myhme
Copy link
Contributor

myhme commented Nov 4, 2024

@myhme could you check danonline/autopulse:ui-pr-90 works?

I can run the container but not able to login

ubu@linux:~$ docker logs autopulse-ui
Listening on 0.0.0.0:2880
ubu@linux:~$ docker logs autopulse
2024-11-04T02:56:13.446538351Z  INFO autopulse: 💫 autopulse starting up...
2024-11-04T02:56:13.485927389Z  INFO autopulse: 🚀 Listening on 0.0.0.0:2875
ubu@linux:~$ docker logs autopulse-db

PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-11-04 02:55:57.667 UTC [1] LOG:  starting PostgreSQL 17.0 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
2024-11-04 02:55:57.667 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5441
2024-11-04 02:55:57.667 UTC [1] LOG:  listening on IPv6 address "::", port 5441
2024-11-04 02:55:57.671 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5441"
2024-11-04 02:55:57.677 UTC [29] LOG:  database system was shut down at 2024-11-04 02:55:54 UTC
2024-11-04 02:55:57.684 UTC [1] LOG:  database system is ready to accept connections

but i can connect with the autopulse container with the ip so this issue would be similar to #85. btw autopulse:2875 woul not work in my case since i am defining network in compose

ubu@linux:~$ curl http://xx.xx.xx.xx:2875
{"autopulse":"v1.1.0"}ubu@linux:

below is my compose file

  autopulse-db:
    image: postgres:alpine
    container_name: autopulse-db
    profiles: ["mediaserver"]    
    env_file:
      - /docker/docker-scripts/.env
    restart: unless-stopped
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_USER: ${AUTOPULSE_POSTGRES_USER}
      POSTGRES_PASSWORD: ${AUTOPULSE_POSTGRES_PASSWORD}
      POSTGRES_DB: ${AUTOPULSE_POSTGRES_DB}
      PGPORT: ${AUTOPULSE_PGPORT}
    volumes:
      - /docker/docker-config/autopulse-db:/var/lib/postgresql/data/pgdata
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
      interval: 15s
      retries: 5
      start_period: 5s
      timeout: 5s
#    dns:
#      - $PIHOLE_ARR_NETWORK_DOCKER_IP
    ports:
      - $AUTOPULSE_PGPORT:$AUTOPULSE_PGPORT
      - $AUTOPULSE_DOCKER_PORT:$AUTOPULSE_DOCKER_PORT
      - $AUTOPULSE_UI_PORT:$AUTOPULSE_UI_PORT      
    networks:
      network-containers:
        ipv4_address: ${AUTOPULSE_POSTGRES_IP}


  autopulse:
    image: danonline/autopulse:pr-90-postgres-arm64
    container_name: autopulse
    profiles: ["mediaserver"]     
    env_file:
      - /docker/docker-scripts/.env
    environment:
      - PUID=${DOCKER_PUID}
      - PGID=${DOCKER_PGID}
      - TZ=${DOCKER_TZ}
      # - AUTOPULSE__APP__DATABASE_URL=${AUTOPULSE_DATABASE_URL}
    restart: always
    depends_on:
      autopulse-db:
         condition: service_healthy
    volumes:
      - /docker/docker-config/autopulse/app:/app
      - /etc/localtime:/etc/localtime:ro # for correct timezone in timestamps
      - /mnt/remote/realdebrid:/mnt/remote/realdebrid:rshared
      - /mnt/local/media/symlinks:/mnt/local/media/symlinks
      - /mnt/local/media/library:/mnt/local/media/library
      - /mnt/local/downloads:/mnt/local/downloads
      - /docker/docker-config/autopulse:/config
    network_mode: service:autopulse-db
    # ports:
      # - $AUTOPULSE_DOCKER_PORT:$AUTOPULSE_DOCKER_PORT
      # - $AUTOPULSE_UI_PORT:$AUTOPULSE_UI_PORT
    # networks:
      # network-containers:
        # ipv4_address: ${AUTOPULSE_DOCKER_IP}


  autopulse-ui:
    image: danonline/autopulse:ui-pr-90
    container_name: autopulse-ui
    profiles: ["mediaserver"]     
    env_file:
      - /docker/docker-scripts/.env
    depends_on:
      autopulse-db:
         condition: service_healthy
      autopulse:
         condition: service_started
    environment:
      - PUID=${DOCKER_PUID}
      - PGID=${DOCKER_PGID}
      - TZ=${DOCKER_TZ}
      - SECRET=${AUTOPULSE_JWT_SECRET}
    restart: always
    network_mode: service:autopulse-db
    # ports:
      # - $AUTOPULSE_UI_PORT:$AUTOPULSE_UI_PORT      
    # networks:
      # network-containers:
        # ipv4_address: ${AUTOPULSE_UI_IP}
		
networks:
  network-containers:
    ipam:
      config:
        - subnet: ${DOCKER_NETWORK_SUBNET}

below is my config file

app:
  hostname: 0.0.0.0
  port: 2875
  database_url: xxx


opts:
  check_path: true # Check if the path exists, assuming the path is available to the container
  max_retries: 5 # Exponential backoff when a target fails

auth:
  username: xxxx
  password: xxxx

triggers:
  my_sonarr:
    type: "sonarr"
  my_radarr:
    type: "radarr"

targets:
  my_jellyfin:
    type: "jellyfin"
    url: "http://xxxx:xxxx"
    token: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
  # refresh_metadata: false # To disable metadata refresh

@dan-online
Copy link
Owner

Hey @myhme seems you'll need to specify the origin in the env as mentioned here

@myhme
Copy link
Contributor

myhme commented Nov 5, 2024

Hey @myhme seems you'll need to specify the origin in the env as mentioned here

thanks i can login now 👍 and arm64 images (both autopulse and autopulse-ui) is working as expected

@dan-online
Copy link
Owner

Awesome, I'll go ahead and close this

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

No branches or pull requests

3 participants