I have a service (xiam-fpm-server
) that is dependent on two additional services (xiam-web-server
and xiam-frontend
). I have remote development working when configuring each of the three services as separate entries in the manifest, and bringing each one up with a separate okteto up
command in a separate terminal.
I’m now attempting to make use of the services
key in the manifest to bring all three services up with a single okteto up
invocation. However, while the primary dev container was coming up successfully, the xiam-web-server
dev container would fail to come up, with the following error:
can't create '/var/okteto/remote/authorized_keys': File exists
I suspected that this was due to the fact that all three containers are configured to use a non-root user, and each one was using a different userid. I updated all three containers to use the same uid (777) and gid (777), to see if that helped. It did change the error message. Now it’s the primary dev container (xiam-fpm-server
) that fails to come up, with the following error:
USER:777
2024-04-28T04:49:02 development container starting
2024-04-28T04:49:02 Copying secret authorized_keys to /var/okteto/remote/authorized_keys
cp: can't create '/var/okteto/remote/authorized_keys': Permission denied
Here are the contents of my manifest, in both configurations:
Separate services, working correctly:
build:
fpm-server:
target: fpm_server_dev
web-server:
target: web_server
frontend:
target: frontend
cron:
target: cron
cli:
target: cli_dev
deploy:
remote: true
commands:
- helm dependency update "helm"
- >-
helm upgrade --install "xiam" "helm"
--set okteto.enabled=true
--set okteto.private=true
--set environment="development"
--set instance="${OKTETO_NAMESPACE}"
--set productionMode=false
--set configSecret.enabled=true
--set configSecret.create=true
--set cronjobResource.enabled=false
--set cronjobDeployment.enabled=true
--set ingress.enabled=true
--set ingressRoute.internal.enabled=false
--set ingressRoute.external.enabled=false
--set imageRegistry="${OKTETO_BUILD_WEB_SERVER_REGISTRY}"
--set images.webServer.repository="${OKTETO_BUILD_WEB_SERVER_REPOSITORY}"
--set images.webServer.tag="${OKTETO_BUILD_WEB_SERVER_TAG}"
--set images.fpmServer.repository="${OKTETO_BUILD_FPM_SERVER_REPOSITORY}"
--set images.fpmServer.tag="${OKTETO_BUILD_FPM_SERVER_TAG}"
--set images.frontend.repository="${OKTETO_BUILD_FRONTEND_REPOSITORY}"
--set images.frontend.tag="${OKTETO_BUILD_FRONTEND_TAG}"
--set images.cron.repository="${OKTETO_BUILD_CRON_REPOSITORY}"
--set images.cron.tag="${OKTETO_BUILD_CRON_TAG}"
--set images.cli.repository="${OKTETO_BUILD_CLI_REPOSITORY}"
--set images.cli.tag="${OKTETO_BUILD_CLI_TAG}"
--set frontend.enabled=true
--set hostname="xiam-${OKTETO_NAMESPACE}.dev.xapiens.net"
--set config.app.url="https://xiam-${OKTETO_NAMESPACE}.dev.xapiens.net"
--set config.app.timezone="America/New_York"
--set config.app.forceHttps=true
--set database.create=true
--set database.enabled=true
--set config.db.hostname="${XIAM_DB_HOSTNAME:-xiam-database}"
--set config.db.username="${XIAM_DB_USERNAME:-$OKTETO_NAMESPACE}"
--set config.db.password="${XIAM_DB_PASSWORD}"
--set config.db.name="${XIAM_DB_NAME:-$OKTETO_NAMESPACE}"
--set redis.enabled=true
--set redis.create=true
--set config.redis.host=xiam-redis
dev:
xiam-fpm-server:
command: [ "php-fpm" ]
reverse:
- 9003:9003
sync:
- ".:/app"
securityContext:
runAsUser: 777
runAsGroup: 777
fsGroup: 777
xiam-frontend:
command: [ "npm", "run", "dev" ]
forward:
- 5173:5173
sync:
- ".:/app"
securityContext:
runAsUser: 777
runAsGroup: 777
fsGroup: 777
xiam-web-server:
command: [ "/docker-entrypoint.sh", "nginx", "-g", "daemon off;" ]
sync:
- "public:/app/public"
securityContext:
runAsUser: 777
runAsGroup: 777
fsGroup: 777
Here’s the dev
section, reworked to use the services
key (not working) :
dev:
xiam-fpm-server:
command: [ "php-fpm" ]
forward:
- 5173:xiam-frontend:5173
reverse:
- 9003:9003
sync:
- ".:/app"
securityContext:
runAsUser: 777
runAsGroup: 777
fsGroup: 777
services:
- name: xiam-web-server
sync:
- "public:/app/public"
- name: xiam-frontend
sync:
- ".:/app"
Any input is appreciated. Thanks!