Skip to content

podlet compose --pod doesn't prepend requires with pod name #114

Closed
@sugoidogo

Description

@sugoidogo

I was using podlet to convert glitchtip's docker-compose file to a pod and found that the requires options weren't prepended with the pod name the same way that the container file names were. I had to make other changes to their compose file since they were taking advantage of the docker extension syntax to define their common options, so I've also included my edited version of the compose file to make it podlet-compatible.

[root@digitalocean ~]# cat glitchtip.yml
name: glitchtip
services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_HOST_AUTH_METHOD: "trust"  # Consider removing this and setting a password
    #restart: unless-stopped
    volumes:
      - /etc/glitchtip/pg-data:/var/lib/postgresql/data
  redis:
    image: redis
    #restart: unless-stopped
  web:
    image: glitchtip/glitchtip
    depends_on: &default-depends_on
      - postgres
      - redis
    ports:
      - "8000:8000"
    environment: &default-environment
      DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
      SECRET_KEY: change_me_to_something_random # best to run openssl rand -hex 32
      PORT: 8000
      EMAIL_URL: consolemail:// # Example smtp://email:password@smtp_url:port https://glitchtip.com/documentation/install#c>  EMAIL_BACKEND: anymail.backends.mailjet.EmailBackend
      DEFAULT_FROM_EMAIL: email@glitchtip.com # Change this to your email
      CELERY_WORKER_AUTOSCALE: "1,3"  # Scale between 1 and 3 to prevent excessive memory usage. Change it or remove to set>  CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000"
    #restart: unless-stopped
    volumes: &uploads
      - /etc/glitchtip/uploads:/code/uploads
  worker:
    image: glitchtip/glitchtip
    command: ./bin/run-celery-with-beat.sh
    depends_on: *default-depends_on
    environment: *default-environment
    #restart: unless-stopped
    volumes: *uploads
  migrate:
    image: glitchtip/glitchtip
    depends_on: *default-depends_on
    command: ./bin/run-migrate.sh
    environment: *default-environment
[root@digitalocean ~]# podlet compose glitchtip.yml --pod
# glitchtip-postgres.container
[Container]
Environment=POSTGRES_HOST_AUTH_METHOD=trust
Image=postgres:16
Pod=glitchtip.pod
Volume=/etc/glitchtip/pg-data:/var/lib/postgresql/data

---

# glitchtip-redis.container
[Container]
Image=redis
Pod=glitchtip.pod

---

# glitchtip-web.container
[Unit]
Requires=postgres.service redis.service
After=postgres.service redis.service

[Container]
Environment=DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres SECRET_KEY=change_me_to_something_random PORT=8000 EMAIL_URL=consolemail:// DEFAULT_FROM_EMAIL=email@glitchtip.com CELERY_WORKER_AUTOSCALE=1,3
Image=glitchtip/glitchtip
Pod=glitchtip.pod
Volume=/etc/glitchtip/uploads:/code/uploads

---

# glitchtip-worker.container
[Unit]
Requires=postgres.service redis.service
After=postgres.service redis.service

[Container]
Environment=DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres SECRET_KEY=change_me_to_something_random PORT=8000 EMAIL_URL=consolemail:// DEFAULT_FROM_EMAIL=email@glitchtip.com CELERY_WORKER_AUTOSCALE=1,3
Exec=./bin/run-celery-with-beat.sh
Image=glitchtip/glitchtip
Pod=glitchtip.pod
Volume=/etc/glitchtip/uploads:/code/uploads

---

# glitchtip-migrate.container
[Unit]
Requires=postgres.service redis.service
After=postgres.service redis.service

[Container]
Environment=DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres SECRET_KEY=change_me_to_something_random PORT=8000 EMAIL_URL=consolemail:// DEFAULT_FROM_EMAIL=email@glitchtip.com CELERY_WORKER_AUTOSCALE=1,3
Exec=./bin/run-migrate.sh
Image=glitchtip/glitchtip
Pod=glitchtip.pod

---

# glitchtip.pod
[Pod]
PublishPort=8000:8000

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions