tilt
tilt copied to clipboard
live_update: i would like to `run` without `sync`
Describe the Feature You Want
i would like to be able to run a command on a live update, without having to have a preceding sync that matches.
Current Behavior
a LiveUpdate line is logged out, then every container using this image is restarted
UpdateStopped: Found file(s) not matching any sync (files: [.....])
Why Do You Want This?
We have a simple container based on PHP, we use the same container for many different applications. The php files are mounted into the containers with a volume, removing the need for sync. However, we also utilise workerman, a long running process which speeds up php by caching the parsed source files. This requires a command to be run when a file changes.
To be clear, sync is unnecessary because the file system is mounted.
I would like to simply execute this command in a live_update on our docker_build:
docker_build('base-runner',src_path,dockerfile_contents='''
FROM php:8.2-alpine
RUN docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-install pcntl;
ENV APP_NAME="unknown"
RUN echo "php /SHARED_CODE/\\${APP_NAME}/cubex start" > /run.sh
RUN chmod +x /run.sh
RUN echo "php /SHARED_CODE/\\${APP_NAME}/cubex reload" > /reload.sh
RUN chmod +x /reload.sh
CMD [ "/run.sh" ]
''', live_update=[run('/reload.sh')])
app-1
apiVersion: apps/v1
kind: Deployment
spec:
spec:
restartPolicy: Always
containers:
- name: php-app-1
env:
- name: APP_NAME
value: app-1
image: base-runner
imagePullPolicy: IfNotPresent
volumeMounts:
- name: code
mountPath: /SHARED_CODE
volumes:
- name: code
hostPath:
path: /development/codebase
app-2
apiVersion: apps/v1
kind: Deployment
spec:
spec:
restartPolicy: Always
containers:
- name: php-app-2
env:
- name: APP_NAME
value: app-2
image: base-runner
imagePullPolicy: IfNotPresent
volumeMounts:
- name: code
mountPath: /SHARED_CODE
volumes:
- name: code
hostPath:
path: /development/codebase