[英]Restarting docker-compose after running rake assets:precompile resets the changes
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.我目前正在尝试使用 Zammad Open Source,这是一个带有 Docker-compose 的帮助台票务系统。但是我之前在非 docker 设置中使用过它,我编辑了 html 视图并添加了我的团队所需的一些徽标和额外功能。 However we are needed to move into a docker-based instance soon due to reasons.
但是由于一些原因,我们需要尽快迁移到基于 docker 的实例。
I succeeded in installing it normally, and the default compose file does mount an image when bringing the container up.我成功地正常安装了它,默认的 compose 文件在启动容器时确实挂载了一个图像。 After that I go and apply the changes as how I did on my existing setup.
之后,我输入 go 并像我对现有设置所做的那样应用更改。 The changes require me to run
这些更改需要我运行
rake assets:precompile
and restart only the rails container.并仅重新启动 rails 容器。 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.所有容器都重新启动(如预期的那样),但 Rails 服务器似乎丢弃了我所做的每一个更改,一切看起来都好像我刚刚启动了一个新容器。
What I've tried:我试过的:
docker-compose.yml 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
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.深入文件,发现它从 github 中拉取了一个图像,下载了图像。 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.
提取 tar.gz 文件后,我应用了我需要的所有更改,重新打包了 tar.gz,并编辑了 dockerfile 以指向新图像。
After that, i need to force docker-compose to rebuild the image.之后,我需要强制 docker-compose 重建图像。 Then the changes are persistent even after restarts.
然后即使在重新启动后更改仍然存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.