Merge "Containers: Bind mount directories with the key/certs for heat"
[apex-tripleo-heat-templates.git] / docker / services / glance-api.yaml
index 77e4aa0..9fa9008 100644 (file)
@@ -1,4 +1,4 @@
-heat_template_version: ocata
+heat_template_version: pike
 
 description: >
   OpenStack Glance service configured with Puppet
@@ -29,6 +29,9 @@ parameters:
 
 resources:
 
+  ContainersCommon:
+    type: ./containers-common.yaml
+
   GlanceApiPuppetBase:
     type: ../../puppet/services/glance-api.yaml
     properties:
@@ -58,37 +61,38 @@ outputs:
             - '/'
             - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiImage} ]
       kolla_config:
-         /var/lib/kolla/config_files/glance-api.json:
-           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
-           config_files:
-           - dest: /etc/glance/glance-api.conf
-             owner: glance
-             perm: '0600'
-             source: /var/lib/kolla/config_files/src/etc/glance/glance-api.conf
-           - dest: /etc/glance/glance-swift.conf
-             owner: glance
-             perm: '0600'
-             source: /var/lib/kolla/config_files/src/etc/glance/glance-swift.conf
+        /var/lib/kolla/config_files/glance-api.json:
+          command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
       docker_config:
+        # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
         step_3:
+          glance_init_logs:
+            start_order: 0
+            image: *glance_image
+            privileged: false
+            user: root
+            volumes:
+              - /var/log/containers/glance:/var/log/glance
+            command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
           glance_api_db_sync:
+            start_order: 1
             image: *glance_image
             net: host
             privileged: false
             detach: false
             volumes: &glance_volumes
-              - /var/lib/kolla/config_files/glance-api.json:/var/lib/kolla/config_files/config.json
-              - /etc/localtime:/etc/localtime:ro
-              - /lib/modules:/lib/modules:ro
-              - /var/lib/config-data/glance_api/:/var/lib/kolla/config_files/src:ro
-              - /run:/run
-              - /dev:/dev
-              - /etc/hosts:/etc/hosts:ro
+              list_concat:
+                - {get_attr: [ContainersCommon, volumes]}
+                -
+                  - /var/lib/kolla/config_files/glance-api.json:/var/lib/kolla/config_files/config.json
+                  - /var/lib/config-data/glance_api/etc/glance/:/etc/glance/:ro
+                  - /var/log/containers/glance:/var/log/glance
             environment:
               - KOLLA_BOOTSTRAP=True
               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
         step_4:
           glance_api:
+            start_order: 2
             image: *glance_image
             net: host
             privileged: false
@@ -96,6 +100,11 @@ outputs:
             volumes: *glance_volumes
             environment:
               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
+      host_prep_tasks:
+        - name: create persistent logs directory
+          file:
+            path: /var/log/containers/glance
+            state: directory
       upgrade_tasks:
         - name: Stop and disable glance_api service
           tags: step2