Search code examples
wordpresskubernetescloudbitnamiargocd

Sync git with bitnami/wordpress using Argo CD


I just installed bitnami/wordpress image using Argo CD with Helm option. Now my deployment is synced with helm. Can I now for example sync it with my git repository? I mean to push current Wordpress files to git and sync with it? Because then I can modify plugin files what I need. Bitnami/wordpress is non-root container so I can't create sftp account.

How to do it?


Solution

  • You could do it by adding a sidecar container to your WordPress container that performed the git synchronization.

    To do so, you have to add the following values to your WordPress application in ArgoCD:

    sidecars:
      - name: git-sync
        image: bitnami/git:2.32.0-debian-10-r24
        imagePullPolicy: IfNotPresent
        command:
          - /bin/bash
          - -ec
          - |
            [[ -f "/opt/bitnami/scripts/git/entrypoint.sh" ]] && source "/opt/bitnami/scripts/git/entrypoint.sh"
            while true; do
                #Add here your commands to synchronize the git repository with /bitnami/wordpress/wp-content
                sleep 60
            done
        volumeMounts:
          - mountPath: /bitnami/wordpress
            name: wordpress-data
            subPath: Wordpress
    

    This will configure a secondary container in your Wordpress pod sharing the wordpress-data volume. Changes

    Note: You will also need to provide the values mariadb.auth.password, mariadb.auth.rootPassword and wordpressPassword when performing the Application Sync in ArgoCD.