Code Monkey home page Code Monkey logo

Comments (4)

christoffer-eide avatar christoffer-eide commented on June 2, 2024 2

If a container crashes, the init container is not executed, so that won't work unfortunately.
Not sure if it makes sense to support this in the helm charts. Running athens using a socket requires some kind of proxy in front of it to be usable. And the helm charts doesn't support multiple containers in the deployment.

I have found a way to work around this issue by using abstract sockets. These sockets does not use the file system.
We build our custom athens docker image to install some required tooling, including curl which makes it easier to implement the live and readiness probes:

FROM gomods/athens:v0.13.0
RUN wget -c "https://github.com/Avinode/git-credential-github-apps/releases/download/v1.2.0/git-credential-github-apps_1.2.0_${TARGETOS}_${TARGETARCH}.tar.gz" -O - \
      | tar -xz -C /usr/local/bin/

RUN apk --no-cache add curl
USER athens

Then we run a deployment with two containers, where one of them is a reverse proxy.

containers:
  - name: proxy
    image: proxy-image
    ports:
      - name: http
        containerPort: 8080
    env:
      - name: PORT
        value: "8080"
      - name: PROXY_URL
        value: "unix://athens/@/var/run/athens/athens.sock"        
  - name: athens
    image: custom-athens-docker-image
    env:
      - name: ATHENS_UNIX_SOCKET
        value: "@/var/run/athens/athens.sock"
    readinessProbe:
      exec:
        command:
          - sh
          - -c
          - curl --fail --abstract-unix-socket $(echo "$ATHENS_UNIX_SOCKET" | cut -d @ -f 2) http://athens/healthz
      initialDelaySeconds: 10
      periodSeconds: 3
      failureThreshold: 3
    livenessProbe:
      exec:
        command:
          - sh
          - -c
          - curl --fail --abstract-unix-socket $(echo "$ATHENS_UNIX_SOCKET" | cut -d @ -f 2) http://athens/healthz
      initialDelaySeconds: 10
      periodSeconds: 3
      failureThreshold: 3

Thanks for the feedback @DrPsychick , appreciate it 👍

from athens.

DrPsychick avatar DrPsychick commented on June 2, 2024

Would this not better be suited to be solved in the k8s deployment (helm chart or so), because silently overwriting/deleting an existing socket - I don't know if that is the right approach. I would favour "fail early" and expose that the socket is already there, as it is.

from athens.

christoffer-eide avatar christoffer-eide commented on June 2, 2024

It's possible to implement some kind of workaround in k8s, but it's not straight forward.
We ran into this issue when athens was OOMKilled, and was unable to restart as the socket file was left behind.

I see your point of not silently deleting an existing socket file, my use case is probably a bit k8s specific.
Would it be an option to make it configurable (ATHENS_UNIX_SOCKET_DELETE_IF_EXISTS=true|false)?

from athens.

DrPsychick avatar DrPsychick commented on June 2, 2024

Would an init container, "preparing the volume" not be sufficient for a k8s deployment? If you're using the official helm chart, I'd rather support custom init containers for that to solve this k8s specific issue.

https://github.com/gomods/athens-charts

from athens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.