-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cron container, with it enabled for Akeneo (#210)
* Add cron container for Akeneo * Add cron container for Akeneo * Add cron container for Akeneo * Add cron container for Akeneo * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness * Move cron container to base harness - fix test build issues * Revert "Move cron container to base harness - fix test build issues" This reverts commit 9f3da30e1a911688b9a58ee21947ce731b376485. * Move cron container to base harness - fix test build issues * trigger build * Improve the quoting of env vars * Improve the quoting of env vars * Improve env vars and logging * remove unneeded sleep Co-authored-by: g-foster <[email protected]>
- Loading branch information
1 parent
5bb1b5c
commit 0137591
Showing
15 changed files
with
179 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cron: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: | ||
context: ./ | ||
dockerfile: .my127ws/docker/image/cron/Dockerfile | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : './:/app:delegated' }} | ||
- ./.my127ws/application:/home/build/application | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-cron' }} | ||
{% endif %} | ||
environment: | ||
{{ deep_merge_to_yaml([@('services.php-base.environment'),@('services.cron.environment')], 2, 6) | raw }} | ||
{% include blocks ~ 'environment.yml.twig' %} | ||
networks: | ||
- private | ||
labels: | ||
- traefik.enable=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% if @('app.build') == 'static' %} | ||
FROM {{ @('docker.repository') ~ ':' ~ @('app.version') }}-php-fpm | ||
{% else %} | ||
FROM {{ @('workspace.name') ~ '-php-fpm:dev' }} | ||
{% endif %} | ||
|
||
# install cron | ||
RUN apt update | ||
RUN apt install -y cron sudo | ||
|
||
WORKDIR /app | ||
COPY .my127ws/docker/image/cron/root / | ||
RUN chmod +x /cron-run-with-env.sh | ||
|
||
{% if @('app.build') == 'static' %} | ||
RUN bash /fix_app_permissions.sh | ||
{% else %} | ||
VOLUME /app | ||
{% endif %} | ||
ENV APP_MODE {{ @('app.mode') }} | ||
|
||
{% if @('app.build') == 'static' %} | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["sleep", "infinity"] | ||
{% else %} | ||
ENTRYPOINT ["/entrypoint.dynamic.sh"] | ||
CMD ["sleep", "infinity"] | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
IFS=$'\n' | ||
env_vars="$(cat /app/env.sh)" | ||
/usr/bin/env - "$env_vars" sudo --preserve-env -u www-data "$@" > /proc/1/fd/1 2> /proc/1/fd/2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for cronjob in @('backend.cron.jobs') -%} | ||
{{ cronjob|raw }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# this is used to load env vars in crontab commands | ||
env > /app/env.sh | ||
|
||
# run | ||
crontab /crontab | ||
exec cron -f -L 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,8 @@ attributes.default: | |
steps: [] | ||
migrate: | ||
steps: [] | ||
cron: | ||
jobs: [] | ||
|
||
frontend: | ||
path: /app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Values.resourcePrefix }}cron | ||
labels: | ||
app.service: {{ .Values.resourcePrefix }}cron | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.service: {{ .Values.resourcePrefix }}cron | ||
template: | ||
metadata: | ||
labels: | ||
app.service: {{ .Values.resourcePrefix }}cron | ||
spec: | ||
{{- if not (eq "" (include "application.volumes.wwwDataPaths" .)) }} | ||
initContainers: | ||
- name: cron-volume-permissions | ||
image: busybox | ||
command: | ||
- "/bin/chown" | ||
- "-R" | ||
- "www-data" | ||
{{- include "application.volumes.wwwDataPaths" . | indent 8 }} | ||
volumeMounts: | ||
{{- if not (and (eq "" (include "application.volumeMounts.backend" .)) (eq "" (include "application.volumeMounts.all" .)) ) }} | ||
{{- include "application.volumeMounts.backend" . | indent 8 }} | ||
{{- include "application.volumeMounts.all" . | indent 8 }} | ||
{{- else }} [] | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: cron | ||
env: | ||
{{- range $key, $value := index .Values.docker.services "php-base" "environment" }} | ||
{{- $tp := typeOf $value }} | ||
- name: {{ $key | quote }} | ||
{{- if eq $tp "string" }} | ||
value: {{ tpl $value $ | quote }} | ||
{{- else}} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{- range $key, $value := index .Values.docker.services "cron" "environment" }} | ||
{{- $tp := typeOf $value }} | ||
- name: {{ $key | quote }} | ||
{{- if eq $tp "string" }} | ||
value: {{ tpl $value $ | quote }} | ||
{{- else}} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{- range $key, $value := .Values.environment }} | ||
- name: {{ $key | quote }} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
image: {{ .Values.docker.image.cron }} | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 9000 | ||
resources: | ||
limits: | ||
memory: {{ .Values.resources.limits.memory.cron }} | ||
requests: | ||
memory: {{ .Values.resources.requests.memory.cron }} | ||
readinessProbe: | ||
tcpSocket: | ||
port: 9000 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
volumeMounts: | ||
{{- if not (and (eq "" (include "application.volumeMounts.backend" .)) (eq "" (include "application.volumeMounts.all" .)) ) }} | ||
{{- include "application.volumeMounts.backend" . | indent 8 }} | ||
{{- include "application.volumeMounts.all" . | indent 8 }} | ||
{{- else }} [] | ||
{{- end }} | ||
|
||
imagePullSecrets: | ||
- name: {{ .Values.resourcePrefix }}docker-config | ||
restartPolicy: Always | ||
volumes: | ||
{{- if not (and (eq "" (include "application.volumes.backend" .)) (eq "" (include "application.volumes.all" .)) ) }} | ||
{{- include "application.volumes.backend" . | indent 6 }} | ||
{{- include "application.volumes.all" . | indent 6 }} | ||
{{- else }} [] | ||
{{- end }} | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters