使用 Argo CD 同步 git 与 bitnami/wordpress
Sync git with bitnami/wordpress using Argo CD
我刚刚使用带有 Helm 选项的 Argo CD 安装了 bitnami/wordpress 图像。现在我的部署与 helm 同步了。例如,我现在可以将它与我的 git 存储库同步吗?我的意思是将当前的 Wordpress 文件推送到 git 并与之同步?因为这样我就可以修改我需要的插件文件。 Bitnami/wordpress 是非根容器,所以我无法创建 sftp 帐户。
怎么做?
您可以通过将 sidecar 容器添加到执行 git 同步的 WordPress 容器来实现。
为此,您必须将以下值添加到 ArgoCD 中的 WordPress 应用程序:
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
这将在您的 Wordpress pod 中配置一个辅助容器,共享 wordpress-data 卷。变化
注意:在 ArgoCD 中执行应用程序同步时,您还需要提供值 mariadb.auth.password
、mariadb.auth.rootPassword
和 wordpressPassword
。
我刚刚使用带有 Helm 选项的 Argo CD 安装了 bitnami/wordpress 图像。现在我的部署与 helm 同步了。例如,我现在可以将它与我的 git 存储库同步吗?我的意思是将当前的 Wordpress 文件推送到 git 并与之同步?因为这样我就可以修改我需要的插件文件。 Bitnami/wordpress 是非根容器,所以我无法创建 sftp 帐户。
怎么做?
您可以通过将 sidecar 容器添加到执行 git 同步的 WordPress 容器来实现。
为此,您必须将以下值添加到 ArgoCD 中的 WordPress 应用程序:
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
这将在您的 Wordpress pod 中配置一个辅助容器,共享 wordpress-data 卷。变化
注意:在 ArgoCD 中执行应用程序同步时,您还需要提供值 mariadb.auth.password
、mariadb.auth.rootPassword
和 wordpressPassword
。