diff --git a/apache/build/Dockerfile b/apache/build/Dockerfile index 8792c74c..610c59a5 100644 --- a/apache/build/Dockerfile +++ b/apache/build/Dockerfile @@ -1,7 +1,7 @@ ## copy of 'php:7.3-apache' image ## XXXvlab: will need to move towards separate apache and php, so that nginx can ## replace apache in all conf. -FROM docker.0k.io/php:7.3-apache-1 +FROM docker.0k.io/php:7.4.13-apache ## Limesurvey # RUN apt-get update && \ @@ -20,7 +20,7 @@ FROM docker.0k.io/php:7.3-apache-1 ## Framadate RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y libicu-dev libpq-dev libxml2-dev && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y libonig-dev libicu-dev libpq-dev libxml2-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ docker-php-ext-install mbstring intl xml pdo_pgsql @@ -30,7 +30,7 @@ RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y libexif-dev libexif12 libfreetype6-dev libjpeg62-turbo-dev libpng-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \ docker-php-ext-install exif gd pdo_mysql mysqli ## gogocarto @@ -39,13 +39,13 @@ RUN apt-get update && \ libbz2-dev libc-client-dev libcurl4-openssl-dev libfreetype6-dev \ libgd-dev libicu-dev libkrb5-dev libmagickcore-dev libmagickwand-dev \ libmcrypt-dev libmemcached-dev libtidy-dev libxml2-dev libxslt-dev \ - libz-dev libzip-dev" && \ + libz-dev libzip-dev libonig-dev" && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ bzip2 cron g++ gettext git gnupg imagemagick libfreetype6 libgd3 \ libmcrypt4 libmemcached11 libmemcachedutil2 libsodium23 libtidy5deb1 \ libxml2 libxslt1.1 libzip4 nano openssl unzip ${BUILD_PACKAGES} && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ \ - --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-configure gd --with-freetype=/usr/include/ \ + --with-jpeg=/usr/include/ && \ docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ docker-php-ext-configure hash --with-mhash && \ docker-php-ext-install bcmath bz2 calendar dba curl exif gd gettext \ @@ -63,8 +63,6 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* - - ## XXXvlab: could load these in 'entrypoint.sh' to be more dynamic RUN a2enmod headers proxy_http rewrite ssl proxy_wstunnel http2 proxy_connect diff --git a/gogocarto/README.org b/gogocarto/README.org index b633bc7e..11355b1a 100644 --- a/gogocarto/README.org +++ b/gogocarto/README.org @@ -15,34 +15,31 @@ far from being mature, we try here to get only the released part. We are talking of: [[https://gitlab.adullact.net/pixelhumain/GoGoCarto/-/blob/f3c10f16fc08b533ef44f1325fdb50f87fa73224/docs/installation_docker.md][gogocarto docker install documentation]] -** Intermediate docker image is cached on docker.0k.io if needed +** Updating -To rebuild a new version, I pushed the huge docker image of -=gogocarto= container that is required in the process (that contains -apache and all build/install tools). Note that this should not require -to be rebuild if anything important changes in the directory =docker/=. -Using: +This process will ensure to avoid rebuilding the gigantic intermediate image +needed (with apache and build/install tools). -#+begin_src sh -docker_tree_hash=$(git rev-parse HEAD:docker) -docker tag docker_gogocarto docker.0k.io/gogocarto-builder:${docker_tree_hash} -docker push docker.0k.io/gogocarto-builder:${docker_tree_hash} -#+end_src - -So, if needed, it can be pulled back to avoid the hassle of making it: +You need to run this from the root of a code checkout of: +https://gitlab.adullact.net/pixelhumain/GoGoCarto #+begin_src sh + docker_tree_hash=$(git rev-parse HEAD:docker) -docker pull docker.0k.io/gogocarto-builder:${docker_tree_hash} && -docker tag docker.0k.io/gogocarto-builder:${docker_tree_hash} docker_gogocarto -#+end_src +## Intermediate docker image is cached on docker.0k.io if needed +if ! docker pull docker.0k.io/gogocarto-builder:${docker_tree_hash}; then + make build && + docker tag docker_gogocarto docker.0k.io/gogocarto-builder:${docker_tree_hash} && + docker push docker.0k.io/gogocarto-builder:${docker_tree_hash} +else + docker tag docker.0k.io/gogocarto-builder:${docker_tree_hash} docker_gogocarto +fi + +make up && +docker-compose -f docker/docker-compose.yml exec gogocarto make init -You still need to do (as of <2020-10-20 Tue>): -- get the latest source code -- =make up= to launch de containers with the images -- =make shell= from the latest git repos -- =make init= in the container +#+end_src ** Full release is cached on =docker.0k.io/downloads= @@ -71,7 +68,7 @@ load-fixtures: ## Create the DB schema, generate DB classes and load fixtures This will be done in the =hooks/mongo_database-relation-joined= accordingly. -*** create the full data release bundle this is what was made: +*** create the full data release bundle this is what was made #+begin_src sh ## correct bundles links (no idea if it is needed) @@ -94,6 +91,7 @@ commit_sha=$(git describe HEAD --tags) tar cjv \ bin web vendor config src templates translations \ --exclude=.git --exclude=.gitignore \ + --owner=root --group=root \ > gogocarto-${commit_sha}.tar.bz2 #+end_src diff --git a/gogocarto/hooks/init b/gogocarto/hooks/init index 0fdc87ac..8124bd93 100755 --- a/gogocarto/hooks/init +++ b/gogocarto/hooks/init @@ -16,8 +16,6 @@ set -e -if ! [ -e "$GOGOCARTO_CODE" ]; then - gogocarto:init || exit 1 -fi +gogocarto:init || exit 1 gogocarto:config || exit 1 \ No newline at end of file diff --git a/gogocarto/hooks/mongo_database-relation-joined b/gogocarto/hooks/mongo_database-relation-joined index b7b90e72..899c8422 100755 --- a/gogocarto/hooks/mongo_database-relation-joined +++ b/gogocarto/hooks/mongo_database-relation-joined @@ -24,6 +24,8 @@ MONGODB_URL=$MONGO_URL MONGODB_DATABASE=$DBNAME ###< doctrine/mongodb-odm-bundle ### +DATABASE_NAME=$DBNAME + EOF if [ -e "$inited" ]; then diff --git a/gogocarto/hooks/publish_dir-relation-joined b/gogocarto/hooks/publish_dir-relation-joined index 4c9af2b6..c17873eb 100755 --- a/gogocarto/hooks/publish_dir-relation-joined +++ b/gogocarto/hooks/publish_dir-relation-joined @@ -49,6 +49,7 @@ cat < "${GOGOCARTO_CODE}"/web/.htaccess Options -MultiViews RewriteEngine On +RewriteRule ^js/.* - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/\$1 [QSA,L] @@ -63,4 +64,6 @@ services: - $SERVICE_DATASTORE/var/cache/gogocarto:/opt/apps/gogocarto/var/cache:rw - $SERVICE_DATASTORE/var/lib/gogocarto/sessions:/opt/apps/gogocarto/var/sessions:rw - $SERVICE_DATASTORE/var/log/gogocarto:/opt/apps/gogocarto/var/log:rw + ## Required to give PHP access to this dir + - $upload_dir:/opt/apps/gogocarto/web/uploads:rw " diff --git a/gogocarto/lib/common b/gogocarto/lib/common index 975b49d6..12cd27ac 100644 --- a/gogocarto/lib/common +++ b/gogocarto/lib/common @@ -2,14 +2,44 @@ GOGOCARTO_CODE="$SERVICE_CONFIGSTORE/opt/apps/gogocarto" -GOGOCARTO_RELEASE=3.1.3-2-gf3c10f1 +GOGOCARTO_RELEASE=3.1.3-56-g6b8ba361 GOGOCARTO_URL=https://docker.0k.io/downloads/gogocarto-"${GOGOCARTO_RELEASE}".tar.bz2 gogocarto:init() { - mkdir -p "${GOGOCARTO_CODE}" && - cd "${GOGOCARTO_CODE}" && - curl "$GOGOCARTO_URL" | tar xjv + current_version="" + if [ -d "${GOGOCARTO_CODE}" ]; then + current_version=$(cat "${GOGOCARTO_CODE}"/.version) || { + err "Couldn't find ${GOGOCARTO_CODE}/.version file." + echo " Your config dir is in a broken state." >&2 + return 1 + } + else + mkdir -p "${GOGOCARTO_CODE}" && + cd "${GOGOCARTO_CODE}" && + git init . && + git config user.email "root@localhost" && + git config user.name "Root" || { + err "Couldn't create directory ${GOGOCARTO_CODE}, or init it with git." + return 1 + } + fi + if [ "$current_version" != "$GOGOCARTO_RELEASE" ]; then + cd "${GOGOCARTO_CODE}" || return 1 + if [ -d "$PWD"/.git ]; then + rm -rf "$PWD"/* "$PWD"/{.version,.inited-*,.env} || return 1 + else + err "Can't find the '.git' directory in ${GOGOCARTO_CODE}." + return 1 + fi + curl "$GOGOCARTO_URL" | tar xjv || { + err "Couldn't download $GOGOCARTO_URL." + return 1 + } + echo "$GOGOCARTO_RELEASE" > .version + git add -A . && + git commit -m "Release $GOGOCARTO_RELEASE" + fi }