Skip to content

Commit

Permalink
Merge pull request #11 from jacobdotcosta/fix-volume-folders
Browse files Browse the repository at this point in the history
fix: required volume folders
  • Loading branch information
jacobdotcosta authored Sep 5, 2023
2 parents 311b269 + d3f000e commit 8f901f5
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 58 deletions.
11 changes: 10 additions & 1 deletion src/docs/dev/release.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ Login into the link:https://quay.io/[Quay.io] container registry.
buildah login quay.io
----

Set the disered tag number.
=== Using Ansible

[source,bash]
----
ansible-playbook src/scripts/build/tag-images.yaml -e tag_number="0.0.5"
----

=== Using the command line

Set the desired tag number.

[source,bash]
----
Expand Down
2 changes: 2 additions & 0 deletions src/main/core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG GLPI_FILES_DIR=/var/lib/glpi
ARG GLPI_LOG_DIR=/var/log/glpi
ARG HTTP_WWW=/var/www/html
ARG GLPI_WWW=${HTTP_WWW}/glpi
ARG GLPI_MARKETPLACE_DIR=${GLPI_WWW}/marketplace
ARG LOCAL_INSTALLATION_FOLDER=src/main/core

RUN mkdir ${GLPI_CONFIG_DIR} ${GLPI_OPT_DIR} ${GLPI_FILES_DIR} ${GLPI_LOG_DIR}
Expand Down Expand Up @@ -65,6 +66,7 @@ RUN mkdir ${GLPI_FILES_DIR}/_templates \
# && chmod -R 755 ${GLPI_WWW}/*.php

VOLUME $GLPI_FILES_DIR
VOLUME $GLPI_MARKETPLACE_DIR
VOLUME $GLPI_CONFIG_DIR
VOLUME $GLPI_LOG_DIR

Expand Down
16 changes: 0 additions & 16 deletions src/main/core/etc/glpi/local_define.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG GLPI_FILES_DIR=/var/lib/glpi
ARG GLPI_LOG_DIR=/var/log/glpi
ARG GLPI_OPT_DIR=/opt/glpi

COPY src/main/init/script/glpi-install.sh ${GLPI_OPT_DIR}/
COPY src/main/init/opt/glpi/* ${GLPI_OPT_DIR}/

RUN chown -R www-data:www-data ${GLPI_OPT_DIR} \
&& chmod 755 ${GLPI_OPT_DIR}/glpi-install.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,30 @@ EOF
cat /etc/glpi/local_define.php

note_start_task 0 "generate_local_define()"
cat <<EOF > /etc/glpi/local_define.php
<?php
define('GLPI_FILES_DIR', '/var/lib/glpi');
define('GLPI_DOC_DIR', GLPI_FILES_DIR);
define('GLPI_CRON_DIR', GLPI_FILES_DIR . '/_cron');
define('GLPI_DUMP_DIR', GLPI_FILES_DIR . '/_dumps');
define('GLPI_GRAPH_DIR', GLPI_FILES_DIR . '/_graphs');
define('GLPI_LOCK_DIR', GLPI_FILES_DIR . '/_lock');
define('GLPI_PICTURE_DIR', GLPI_FILES_DIR . '/_pictures');
define('GLPI_PLUGIN_DOC_DIR', GLPI_FILES_DIR . '/_plugins');
define('GLPI_RSS_DIR', GLPI_FILES_DIR . '/_rss');
define('GLPI_SESSION_DIR', GLPI_FILES_DIR . '/_sessions');
define('GLPI_TMP_DIR', GLPI_FILES_DIR . '/_tmp');
define('GLPI_UPLOAD_DIR', GLPI_FILES_DIR . '/_uploads');
define('GLPI_CACHE_DIR', GLPI_FILES_DIR . '/_cache');
define('GLPI_LOG_DIR', '/var/log/glpi');
EOF
cp /opt/glpi/local_define.php /etc/glpi/local_define.php
# cat <<EOF > /etc/glpi/local_define.php
# <?php
# define('GLPI_FILES_DIR', '/var/lib/glpi');
# define('GLPI_VAR_DIR', GLPI_FILES_DIR);
# define('GLPI_DOC_DIR', GLPI_FILES_DIR);
# define('GLPI_CACHE_DIR', GLPI_FILES_DIR . '/_cache');
# define('GLPI_CRON_DIR', GLPI_FILES_DIR . '/_cron');
# define('GLPI_DUMP_DIR', GLPI_FILES_DIR . '/_dumps');
# define('GLPI_GRAPH_DIR', GLPI_FILES_DIR . '/_graphs');
# define('GLPI_LOCAL_I18N_DIR', GLPI_FILES_DIR . '/_locales');
# define('GLPI_LOCK_DIR', GLPI_FILES_DIR . '/_lock');
# define('GLPI_PICTURE_DIR', GLPI_FILES_DIR . '/_pictures');
# define('GLPI_PLUGIN_DOC_DIR', GLPI_FILES_DIR . '/_plugins');
# define('GLPI_RSS_DIR', GLPI_FILES_DIR . '/_rss');
# define('GLPI_SESSION_DIR', GLPI_FILES_DIR . '/_sessions');
# define('GLPI_TMP_DIR', GLPI_FILES_DIR . '/_tmp');
# define('GLPI_UPLOAD_DIR', GLPI_FILES_DIR . '/_uploads');
# define('GLPI_UPLOAD_DIR', GLPI_FILES_DIR . '/_uploads');
# define('GLPI_INVENTORY_DIR', GLPI_FILES_DIR . '/_inventories');
# define('GLPI_MARKETPLACE_DIR', GLPI_FILES_DIR . '/marketplace');

# define('GLPI_LOG_DIR', '/var/log/glpi');
# EOF
succeeded 0 "generate_local_define()"
note 0 "print local_define()"
cat /etc/glpi/local_define.php
Expand Down
71 changes: 71 additions & 0 deletions src/main/init/opt/glpi/local_define.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
// NOTE:
// This file is to be copied into /etc/glpi/local_define.php
define('GLPI_FILES_DIR', '/var/lib/glpi');
define('GLPI_VAR_DIR', GLPI_FILES_DIR);
define('GLPI_DOC_DIR', GLPI_FILES_DIR);
define('GLPI_CACHE_DIR', GLPI_FILES_DIR . '/_cache');
define('GLPI_CRON_DIR', GLPI_FILES_DIR . '/_cron');
define('GLPI_DUMP_DIR', GLPI_FILES_DIR . '/_dumps');
define('GLPI_GRAPH_DIR', GLPI_FILES_DIR . '/_graphs');
define('GLPI_LOCAL_I18N_DIR', GLPI_FILES_DIR . '/_locales');
define('GLPI_LOCK_DIR', GLPI_FILES_DIR . '/_lock');
define('GLPI_PICTURE_DIR', GLPI_FILES_DIR . '/_pictures');
define('GLPI_PLUGIN_DOC_DIR', GLPI_FILES_DIR . '/_plugins');
define('GLPI_RSS_DIR', GLPI_FILES_DIR . '/_rss');
define('GLPI_SESSION_DIR', GLPI_FILES_DIR . '/_sessions');
define('GLPI_TMP_DIR', GLPI_FILES_DIR . '/_tmp');
define('GLPI_UPLOAD_DIR', GLPI_FILES_DIR . '/_uploads');
define('GLPI_INVENTORY_DIR', GLPI_FILES_DIR . '/_inventories');
// define('GLPI_MARKETPLACE_DIR', GLPI_FILES_DIR . '/marketplace');

define('GLPI_LOG_DIR', '/var/log/glpi');

// GLPI_ROOT: "/var/www/glpi"
// GLPI_CONFIG_DIR: "/var/www/glpi/config"
// GLPI_VAR_DIR: "/var/www/glpi/files"
// GLPI_MARKETPLACE_DIR: "/var/www/glpi/marketplace"
// GLPI_USE_CSRF_CHECK: "1"
// GLPI_CSRF_EXPIRES: "7200"
// GLPI_CSRF_MAX_TOKENS: "100"
// GLPI_USE_IDOR_CHECK: "1"
// GLPI_IDOR_EXPIRES: "7200"
// GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
// GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
// GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
// GLPI_INSTALL_MODE: "TARBALL"
// GLPI_NETWORK_MAIL: "[email protected]"
// GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
// GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
// GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
// GLPI_USER_AGENT_EXTRA_COMMENTS: ""
// GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
// GLPI_AJAX_DASHBOARD: "1"
// GLPI_CALDAV_IMPORT_STATE: 0
// GLPI_DEMO_MODE: "0"
// GLPI_CENTRAL_WARNINGS: "1"
// GLPI_DOC_DIR: "/var/www/glpi/files"
// GLPI_CACHE_DIR: "/var/www/glpi/files/_cache"
// GLPI_CRON_DIR: "/var/www/glpi/files/_cron"
// GLPI_DUMP_DIR: "/var/www/glpi/files/_dumps"
// GLPI_GRAPH_DIR: "/var/www/glpi/files/_graphs"
// GLPI_LOCAL_I18N_DIR: "/var/www/glpi/files/_locales"
// GLPI_LOCK_DIR: "/var/www/glpi/files/_lock"
// GLPI_LOG_DIR: "/var/www/glpi/files/_log"
// GLPI_PICTURE_DIR: "/var/www/glpi/files/_pictures"
// GLPI_PLUGIN_DOC_DIR: "/var/www/glpi/files/_plugins"
// GLPI_RSS_DIR: "/var/www/glpi/files/_rss"
// GLPI_SESSION_DIR: "/var/www/glpi/files/_sessions"
// GLPI_TMP_DIR: "/var/www/glpi/files/_tmp"
// GLPI_UPLOAD_DIR: "/var/www/glpi/files/_uploads"
// GLPI_INVENTORY_DIR: "/var/www/glpi/files/_inventories"
// GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
// GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/glpi-plugins/"
// GLPI_I18N_DIR: "/var/www/glpi/locales"
// GLPI_VERSION: "10.0.6"
// GLPI_SCHEMA_VERSION: "10.0.6"
// GLPI_MARKETPLACE_PRERELEASES: false
// GLPI_MIN_PHP: "7.4.0"
// GLPI_MAX_PHP: "8.3.0"
// GLPI_YEAR: "2023"

5 changes: 2 additions & 3 deletions src/scripts/build/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
gather_facts: true

pre_tasks:
- name: "Include project default vars"
- name: "Include project vars"
ansible.builtin.include_vars: "{{ file_to_include }}"
loop:
- ../defaults/main.yaml
- defaults/main.yaml
- vars/main.yaml
loop_control:
loop_var: file_to_include

Expand Down
38 changes: 19 additions & 19 deletions src/scripts/build/tag-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
gather_facts: true

pre_tasks:
- name: "Include project default vars"
- name: "Include project vars"
ansible.builtin.include_vars: "{{ file_to_include }}"
loop:
- ../defaults/main.yaml
- defaults/main.yaml
- vars/main.yaml
loop_control:
loop_var: file_to_include

- name: Check the required variables are set
assert:
that:
- "tag_number is defined and (tag_number | length > 0)"
msg:
- "Please specify the tag (tag_number) to apply to the image"

tasks:
- name: "Build init image"
- name: "Tag images"
ansible.builtin.shell: |
buildah bud -t {{ image_prefix }}_init -f src/main/init/Dockerfile
args:
chdir: "{{ chdir_ref }}"

- name: "Build web image"
ansible.builtin.shell: |
buildah bud -t {{ image_prefix }}_web -f src/main/web/Dockerfile
args:
chdir: "{{ chdir_ref }}"
buildah push localhost/trikorasolns_glpi_{{ image_to_tag }}:latest docker://quay.io/trikorasolns/glpi-container/glpi-container-{{ image_to_tag }}:{{ tag_number }}
buildah push localhost/trikorasolns_glpi_{{ image_to_tag }}:latest docker://quay.io/trikorasolns/glpi-container/glpi-container-{{ image_to_tag }}:latest
loop:
- core
- init
- web
- cron
loop_control:
loop_var: image_to_tag

# - name: "Build cron image"
# ansible.builtin.shell: |
# buildah bud -t {{ image_prefix }}_init -f src/main/init/Dockerfile
# buildah bud -t {{ image_prefix }}_web -f src/main/web/Dockerfile
# args:
# chdir: "{{ chdir_ref }}"
...
File renamed without changes.

0 comments on commit 8f901f5

Please sign in to comment.