<p>I'm trying to get automatic backups to work for my arangodb cluster deployment.
I'm trying to follow the <a href="https://www.arangodb.com/docs/stable/deployment-kubernetes-backup-resource.html" rel="nofollow noreferrer">documentation</a> but I think I have messed it up somehow.</p>
<p>Here is my database-config.yaml:</p>
<pre><code>apiVersion: &quot;database.arangodb.com/v1alpha&quot;
kind: &quot;ArangoDeployment&quot;
metadata:
  name: &quot;arangodb-cluster&quot;
spec:
  mode: Cluster 
  agents: 
    count: 3
    args:
      - --log.level=debug
  dbservers: 
    count: 3
  coordinators:
    count: 3

---
apiVersion: &quot;backup.arangodb.com/v1alpha&quot;
kind: &quot;ArangoBackup&quot;
metadata:
  name: &quot;arangodb-backup&quot;
  namespace: default
spec:
  policyName: &quot;arangodb-backup-policy&quot;
  deployment:
    name: &quot;arangodb-backup-deployment&quot;
  upload:
    repositoryURL: &quot;https://s3.filebase.com/buffer&quot;
    credentialsSecretName: &quot;backup-secret&quot;
---
apiVersion: &quot;backup.arangodb.com/v1alpha&quot;
kind: &quot;ArangoBackupPolicy&quot;
metadata:
  name: &quot;arangodb-backup-policy&quot;
spec:
  schedule: &quot;*/2 * * * *&quot;
template:
  upload:
      repositoryURL: &quot;https://s3.filebase.com/myBucket&quot;
      credentialsSecretName: &quot;backup-secret&quot;
---
apiVersion: v1
kind: Secret
metadata:
  name: backup-secret
data:
   token: mybase64EnodedJSONToken
type: Opaque
</code></pre>
<p>Ideally I would find some data in my bucket, but it's empty. I think it might be either:</p>
<ol>
<li>The bucket size is to small (But that seems rather unrealistic, because that is a test deployment with only one document and 4 collections, so it shouldn't be that big)</li>
<li>The service I'm using simply is not supported
2.1 The service I'm using is wrongly configured</li>
<li>I missunderstood something in the documentation</li>
</ol>
<p>My decoded json token looks like this (I generated it with rclones cli):</p>
<pre><code>{
&quot;Filebase&quot;: {
    &quot;access_key_id&quot;: &quot;myID&quot;,
    &quot;acl&quot;: &quot;private&quot;,
    &quot;endpoint&quot;: &quot;https://s3.filebase.com&quot;,
    &quot;env_auth&quot;: &quot;false&quot;,
    &quot;provider&quot;: &quot;Other&quot;,
    &quot;secret_access_key&quot;: &quot;myAccessKey&quot;,
    &quot;type&quot;: &quot;s3&quot;
}
</code></pre>
<p>}
My encoded one looks (somewhat) like this (Just placed it here in case I encoded the json token the wrong way):</p>
<p>ewogICAgIkZpbGViYXNlIXXXXXXX...X==</p>
<p>And it's: 301 bytes long</p>
<p>What I tried:
I tried to get some more insides on what is happening, but I lack the experience to do it propperly, also I tried to add some stuff from the documentation but to no avail.</p>
<p>And as a final notice, the bucket is set to private on the <a href="https://filebase.com" rel="nofollow noreferrer">filebase.com</a> dashboard, I'm using the free tier there and the 2min on the cronjob timer are just for testing.</p>
<p>EDIT: It seems like that custom the backup pod is a pro feature of the db and one needs to build his own pod for this if one wants to have a backup.</p>

Tj hannover
<p>This is how I solved it (credits to the offical arangodb github for the first part of the script). <br>
<strong>What is the script doing?</strong><br>
We are creating a cronjob which will run every 14 days. Then we spin up a pod which will use the <code>arangodump</code> tool to dump (in this case) the whole database. <br> By passing it data like the database url,password, user name and save it on a volume under <code>temp/dump</code>.<br>
Afterwards we create another pod which uses the <a href="https://hub.docker.com/r/minio/mc" rel="nofollow noreferrer">minio</a> cli tool, which allows to interact with any of the major object storage providers. <br>
We first set an mc alias for gcloud with the access key and secret, you can replace this with any other s3 compatible provider url. Aftwerwards we will mirror the <code>/temp/dump</code> to the cloud bucket (in this case <em>qute</em>, replace this with your own bucket name!) in a folder with the most date of the backup. <code>$()</code> can be used to execute shell commands and use the return value, just for anybody not knowing that.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name:  backup-job
spec:
  schedule: &quot;0 0 */14 * *&quot; #Runs the job at every 14 days
  jobTemplate:
    spec:
      template:
        metadata:
          name:  backup-job
        spec:
          initContainers:
            - name: dump-create
              image: &quot;arangodb:3.7.3&quot;
              args:
                - &quot;arangodump&quot;
                - &quot;--server.endpoint=$(ENDPOINT)&quot;
                - &quot;--server.username=$(USERNAME)&quot;
                - &quot;--server.password=$(PASSWORD)&quot;
                - &quot;--server.database=MY-DATABASE&quot;
                - &quot;--output-directory=/tmp/dump&quot;
                - &quot;--overwrite&quot;
              volumeMounts:
                - name: dump
                  mountPath: /tmp/dump
              env:
              - name: &quot;PASSWORD&quot;
                valueFrom:
                  secretKeyRef:
                    name: signing-secret
                    key: root-password
              
              - name: &quot;USERNAME&quot;
                valueFrom:
                  configMapKeyRef:
                    name: signing-config
                    key: &quot;admin-user&quot;
              
              - name: &quot;ENDPOINT&quot;
                valueFrom:
                  configMapKeyRef:
                    name: signing-config
                    key: db-url

          restartPolicy: OnFailure


          containers:
            - name: db-dump-upload
              image: &quot;minio/mc&quot;
              imagePullPolicy: IfNotPresent
              command: [&quot;/bin/sh&quot;,&quot;-c&quot;]
              args: [&quot;mc alias set gcs https://storage.googleapis.com $ACCESSKEY $SECRETKEY; mc mirror /tmp/dump gcs/qute/$(date -I)&quot;] #no () for env variables!!!!
              volumeMounts:
                - name: dump
                  mountPath: /tmp/dump

              env:
              - name: SECRETKEY
                valueFrom:
                  secretKeyRef:
                    name: backup-secret
                    key: secret
                   
              - name: ACCESSKEY
                valueFrom:
                  secretKeyRef:
                    name: backup-secret
                    key: access-key
          volumes:
            - name: dump
              emptyDir: {}
</code></pre>
