Home > Blockchain >  Restarting docker-compose after running rake assets:precompile resets the changes
Restarting docker-compose after running rake assets:precompile resets the changes

Time:04-20

I'm currently trying to use Zammad Open Source, a helpdesk ticketing system with Docker-compose. However I have used it on a non-docker setup before and I edited the html views and added some logos and extra features that are required by my team. However we are needed to move into a docker-based instance soon due to reasons.

I succeeded in installing it normally, and the default compose file does mount an image when bringing the container up. After that I go and apply the changes as how I did on my existing setup. The changes require me to run

rake assets:precompile

and restart only the rails container. After restarting it, it works and the changes are reflected.

However, once I run

docker-compose restart

All the containers restart (as expected) but the rails server seems to discard every single change I made, and everything looks as if I just brought up a fresh container.

What I've tried:

  • Apply the changes, restart rails container, and commit the container into a custom image and pulled from it. Didn't work.
  • Edited dockerfile, entrypoint scripts to apply the changes and also run precompile during installation. Didn't work.

docker-compose.yml

version: '3'

services:

  zammad-backup:
    command: ["zammad-backup"]
    depends_on:
      - zammad-railsserver
      - zammad-postgresql
    entrypoint: /usr/local/bin/backup.sh
    environment:
      - BACKUP_SLEEP=86400
      - HOLD_DAYS=10
      - POSTGRESQL_USER=${POSTGRES_USER}
      - POSTGRESQL_PASSWORD=${POSTGRES_PASS}
    image: ${IMAGE_REPO}:zammad-postgresql${VERSION}
    restart: ${RESTART}
    volumes:
      - zammad-backup:/var/tmp/zammad
      - zammad-data:/opt/zammad

  zammad-elasticsearch:
    environment:
      - discovery.type=single-node
    image: ${IMAGE_REPO}:zammad-elasticsearch${VERSION}
    restart: ${RESTART}
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data

  zammad-init:
    command: ["zammad-init"]
    depends_on:
      - zammad-postgresql
    environment:
      - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
      - POSTGRESQL_USER=${POSTGRES_USER}
      - POSTGRESQL_PASS=${POSTGRES_PASS}
      - REDIS_URL=${REDIS_URL}
    image: ${IMAGE_REPO}:zammad${VERSION}
    restart: on-failure
    volumes:
      - zammad-data:/opt/zammad

  zammad-memcached:
    command: memcached -m 256M
    image: memcached:1.6.10-alpine
    restart: ${RESTART}

  zammad-nginx:
    command: ["zammad-nginx"]
    expose:
      - "8080"
    depends_on:
      - zammad-railsserver
    image: ${IMAGE_REPO}:zammad${VERSION}
    restart: ${RESTART}
    volumes:
      - zammad-data:/opt/zammad

  zammad-postgresql:
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASS}
    image: ${IMAGE_REPO}:zammad-postgresql${VERSION}
    restart: ${RESTART}
    volumes:
      - postgresql-data:/var/lib/postgresql/data

  zammad-railsserver:
    command: ["zammad-railsserver"]
    depends_on:
      - zammad-memcached
      - zammad-postgresql
      - zammad-redis
    environment:
      - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
      - REDIS_URL=${REDIS_URL}
    image: ${IMAGE_REPO}:zammad${VERSION}
    restart: ${RESTART}
    volumes:
      - zammad-data:/opt/zammad

  zammad-redis:
    image: redis:6.2.5-alpine
    restart: ${RESTART}

  zammad-scheduler:
    command: ["zammad-scheduler"]
    depends_on:
      - zammad-memcached
      - zammad-railsserver
      - zammad-redis
    environment:
      - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
      - REDIS_URL=${REDIS_URL}
    image: ${IMAGE_REPO}:zammad${VERSION}
    restart: ${RESTART}
    volumes:
      - zammad-data:/opt/zammad

  zammad-websocket:
    command: ["zammad-websocket"]
    depends_on:
      - zammad-memcached
      - zammad-railsserver
      - zammad-redis
    environment:
      - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
      - REDIS_URL=${REDIS_URL}
    image: ${IMAGE_REPO}:zammad${VERSION}
    restart: ${RESTART}
    volumes:
      - zammad-data:/opt/zammad

volumes:
  elasticsearch-data:
    driver: local
  postgresql-data:
    driver: local
  zammad-backup:
    driver: local
  zammad-data:
    driver: local

CodePudding user response:

I found a solution after a few headaches here and there:

What I did:

Dove in the files and found out that it pulls an image from github, downloaded the image. After extracting the tar.gz file, I applied all the changes that i needed, repacked the tar.gz, and edited the dockerfile to point to the new image.

After that, i need to force docker-compose to rebuild the image. Then the changes are persistent even after restarts.

  • Related