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

job-assets-precompile fails for Mastodon v4.3.0 #158

Open
hapeho opened this issue Oct 14, 2024 · 4 comments
Open

job-assets-precompile fails for Mastodon v4.3.0 #158

hapeho opened this issue Oct 14, 2024 · 4 comments

Comments

@hapeho
Copy link

hapeho commented Oct 14, 2024

Apparently, Node.js is missing in the new images:

bundle exec rake assets:precompile && yarn cache clean
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
Exiting!

Is this hook/job still needed or can it safely be disabled via https://github.com/mastodon/chart/blob/main/values.yaml#L30?

@jessebot
Copy link
Contributor

jessebot commented Oct 22, 2024

I am also dealing with it failing (using ghcr.io/mastodon/mastodon:v4.3.1), however, I have s3.enabled=true, so the error I'm getting is even more confusing:

rake aborted!
Errno::EACCES: Permission denied @ rb_sysopen - /opt/mastodon/public/assets/.manifest.json (Errno::EACCES)
/usr/local/bundle/gems/propshaft-1.1.0/lib/propshaft/processor.rb:34:in `initialize'
/usr/local/bundle/gems/propshaft-1.1.0/lib/propshaft/processor.rb:34:in `open'
/usr/local/bundle/gems/propshaft-1.1.0/lib/propshaft/processor.rb:34:in `write_manifest'
/usr/local/bundle/gems/propshaft-1.1.0/lib/propshaft/processor.rb:14:in `process'
/usr/local/bundle/gems/propshaft-1.1.0/lib/propshaft/railties/assets.rake:4:in `block (2 levels) in <main>'
/usr/local/bundle/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli.rb:455:in `exec'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli.rb:35:in `dispatch'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/cli.rb:29:in `start'
/usr/local/bundle/gems/bundler-2.5.18/exe/bundle:28:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.5.18/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.5.18/exe/bundle:20:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

I use a fork of this chart, but it's mostly just to keep it actually released until this chart moves to the new repo. Here's the job yaml that's loaded in right now:

click em for full assets-precompile yaml
# kubectl get job mastodon-web-app-assets-precompile -o yaml
apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    helm.sh/hook: post-install
    helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
    helm.sh/hook-weight: "-2"
  creationTimestamp: "2024-10-22T10:33:03Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: mastodon-web-app
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: mastodon
    app.kubernetes.io/version: v4.3.1
    argocd.argoproj.io/instance: mastodon-web-app
    helm.sh/chart: mastodon-9.5.0
  name: mastodon-web-app-assets-precompile
  namespace: mastodon
  resourceVersion: "70931996"
  uid: 9382b09e-d9d1-4a00-970b-48732ff99315
spec:
  backoffLimit: 6
  completionMode: NonIndexed
  completions: 1
  manualSelector: false
  parallelism: 1
  podReplacementPolicy: TerminatingOrFailed
  selector:
    matchLabels:
      batch.kubernetes.io/controller-uid: 9382b09e-d9d1-4a00-970b-48732ff99315
  suspend: false
  template:
    metadata:
      creationTimestamp: null
      labels:
        batch.kubernetes.io/controller-uid: 9382b09e-d9d1-4a00-970b-48732ff99315
        batch.kubernetes.io/job-name: mastodon-web-app-assets-precompile
        controller-uid: 9382b09e-d9d1-4a00-970b-48732ff99315
        job-name: mastodon-web-app-assets-precompile
      name: mastodon-web-app-assets-precompile
    spec:
      containers:
      - command:
        - bash
        - -c
        - |
          bundle exec rake assets:precompile && yarn cache clean
        env:
        - name: DB_PASS
          valueFrom:
            secretKeyRef:
              key: password
              name: mastodon-pgsql-credentials
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              key: valkey-password
              name: mastodon-valkey-credentials
        - name: PORT
          value: "3000"
        envFrom:
        - configMapRef:
            name: mastodon-web-app-env
        - secretRef:
            name: mastodon-server-secrets
        image: ghcr.io/mastodon/mastodon:v4.3.1
        imagePullPolicy: IfNotPresent
        name: mastodon-web-app-assets-precompile
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/secrets/ca
          name: postgres-ca
        - mountPath: /etc/secrets/mastodon
          name: postgres-client-certs
      dnsPolicy: ClusterFirst
      restartPolicy: Never
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: postgres-ca
        secret:
          defaultMode: 288
          secretName: mastodon-postgres-server-ca-key-pair
      - name: postgres-client-certs
        secret:
          defaultMode: 288
          secretName: mastodon-postgres-mastodon-cert
status:
  failed: 4
  ready: 0
  startTime: "2024-10-22T10:33:03Z"
  terminating: 0
  uncountedTerminatedPods: {}

I don't actually see precompile assets in the default setup here though, so maybe we don't need it?:
https://github.com/mastodon/mastodon/blob/main/bin/setup

@jessebot
Copy link
Contributor

jessebot commented Oct 22, 2024

@hapeho for the node issue, you could also be running into the issue listed here (the default image doesn't have node, but the streaming image, ghcr.io/mastodon/mastodon-streaming does have node):
#157

@renchap
Copy link
Member

renchap commented Oct 22, 2024

job-assets-precompile is not supported for Mastodon 4.3.0 and forward (and I am unsure why it is there in the first place).

You should never precompile assets on deploy. Either you use our official container image, which already contains the assets, or you should build your own.

@jessebot
Copy link
Contributor

jessebot commented Oct 22, 2024

Awesome, thanks for the fast response! we should disable it by default on this chart then, to reduce confusion. We could also delete it entirely from the chart in #157, if it doesn't serve a purpose anymore (or never did).

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