From 51d1b692f2300388694516f2753d668955af9743 Mon Sep 17 00:00:00 2001
From: Kacper Donat <kadet1090@gmail.com>
Date: Mon, 24 Oct 2022 22:54:48 +0200
Subject: [PATCH] wipe: Add persistent storage

---
 services/wipe/stack.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/services/wipe/stack.yml b/services/wipe/stack.yml
index 975cfc4..13b6610 100644
--- a/services/wipe/stack.yml
+++ b/services/wipe/stack.yml
@@ -26,10 +26,12 @@ services:
         image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
         volumes:
           - www-data:/var/www
+          - storage-data:/var/www/storage
       pod.component.nginx: |
         image: nginx:latest
         volumes:
           - www-data:/var/www
+          - storage-data:/var/www/storage
           - nginx-config:/etc/nginx/templates
       pod.copy.fpm: /var/conf/wipe/.env:/var/www/.env
       pod.init.components: |
@@ -38,6 +40,11 @@ services:
           command: ["cp -r /var/www/* /mnt/www"]
           volumes:
             - www-data:/mnt/www
+        - image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
+          entrypoint: ["/bin/sh", "-c"]
+          command: ["cp -rnp /var/www/storage/* /mnt/storage"]
+          volumes:
+            - storage-data:/mnt/storage
         - image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
           entrypoint: ["/bin/sh", "-c"]
           command: ["cp -r /var/www/nginx/* /mnt/config"]
@@ -50,6 +57,7 @@ services:
       - /var/run/docker.sock:/var/run/docker.sock:ro
       - nginx-config:/mnt/nginx-config
       - www-data:/mnt/www-data
+      - storage-data:/mnt/storage-data
 
 configs:
   dotenv_{{ dotenv_file.checksum }}:
@@ -64,3 +72,7 @@ volumes:
     name: {{'www-data.{{.Task.ID}}'}}
     labels:
       com.github.rycus86.podlike.volume-ref: www-data
+  storage-data:
+    name: {{'www-data.{{.Task.ID}}'}}
+    labels:
+      com.github.rycus86.podlike.volume-ref: storage-data