Bonjour,
Je voulais tester nextcloud en cloud run sur gcp. Pour cela, j’ai créé une instance sql utilisant postgresql, un répertoire dnas artifact registry pour stocker l’image nextcloud que je fais passer par un Dockerfile. J’ai également créé un bucket pour le stockage persistant.
Mon Dockerfile contient
FROM nextcloud/all-in-one:latest
RUN apk update
RUN apk add --no-cache socat
COPY ./startup.sh ./startup.sh
RUN chmod +x ./startup.sh
# Expose port 8080 for Cloud Run
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "/startup.sh"]
Dans mon startup.sh, j’ai principalement des instructions pour utiliser unix socket pour ne pas utiliser une connexion tcp.
mon fichier startup.sh termine par /entrypoint.sh
Je contruit puis je pousse mon image avec
gcloud builds submit --tag region-docker.pkg.dev/project-id/repository/image-name .
Je déploie ma cloud run avec
gcloud beta run services update nextcloud `
--image region-docker.pkg.dev/project-id/repository/image-name `
--platform managed `
--region region `
--timeout 600 `
--memory 2G `
--cpu 1 `
--min-instances=1 `
--max-instances=10 `
--concurrency=40 `
--no-cpu-throttling `
--add-cloudsql-instances project-id:region:instance-sql-name `
--set-env-vars "NEXTCLOUD_DB_TYPE=postgresql"`
--set-env-vars "NEXTCLOUD_DB_NAME=database-name"`
--set-env-vars "NEXTCLOUD_DB_USER=user-name"`
--set-env-vars "NEXTCLOUD_DB_PASSWORD=password"`
--set-env-vars "NEXTCLOUD_DB_HOST=localhost"`
--set-env-vars "NEXTCLOUD_DATA_DIR=/mnt/-mybucket-name"`
--add-volume "name=data,type=cloud-storage,bucket=my-bucket-name" `
--add-volume-mount "volume=data,mount-path=/mnt/my-bucket-name"
J’ai l’erreur ci-dessous lors du déploiement
Revision ‘nextcloud-00024-bw8’ is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The health check timeout can be extended. Logs for this revision might contain more information.