From 5256b231cb6738867fffa737d7dce020e5fece31 Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Tue, 3 Aug 2021 12:33:53 -0400 Subject: [PATCH] git restore --source dev . --- .../{httpd-php.yml => httpd-php-amd64.yml} | 8 +- .github/workflows/httpd-php-arm64v8.yml | 59 ++++++++++++++ .../{update-template.yml => update.yml} | 4 +- BUILDING.md | 4 +- README.md | 5 +- UPDATING.md | 21 +---- .../httpd-php-amd64.yml | 2 +- docker-compose/httpd-php-arm64v8.yml | 46 +++++++++++ guides/README.md | 6 ++ guides/console/BUILDING.md | 21 +++++ guides/console/README.md | 7 ++ guides/console/SETUP.md | 11 +++ guides/console/UPDATING.md | 20 +++++ guides/console/docker-compose.md | 81 +++++++++++++++++++ guides/portainer/README.md | 73 +++++++---------- httpd-php.Dockerfile | 11 +-- 16 files changed, 297 insertions(+), 82 deletions(-) rename .github/workflows/{httpd-php.yml => httpd-php-amd64.yml} (89%) create mode 100644 .github/workflows/httpd-php-arm64v8.yml rename .github/workflows/{update-template.yml => update.yml} (90%) rename guides/portainer/httpd-php.dist.yml => docker-compose/httpd-php-amd64.yml (95%) create mode 100644 docker-compose/httpd-php-arm64v8.yml create mode 100644 guides/README.md create mode 100644 guides/console/BUILDING.md create mode 100644 guides/console/README.md create mode 100644 guides/console/SETUP.md create mode 100644 guides/console/UPDATING.md create mode 100644 guides/console/docker-compose.md diff --git a/.github/workflows/httpd-php.yml b/.github/workflows/httpd-php-amd64.yml similarity index 89% rename from .github/workflows/httpd-php.yml rename to .github/workflows/httpd-php-amd64.yml index 34fdc98..d5ce913 100644 --- a/.github/workflows/httpd-php.yml +++ b/.github/workflows/httpd-php-amd64.yml @@ -1,4 +1,4 @@ -name: Build httpd-php +name: Build httpd-php (amd64) on: workflow_dispatch: @@ -6,6 +6,8 @@ jobs: build: name: Build and push image runs-on: ubuntu-20.04 + env: + arch: amd64 steps: - uses: actions/checkout@v2 @@ -25,10 +27,12 @@ jobs: uses: redhat-actions/buildah-build@v2 with: image: ${{ secrets.REGISTRY_IMAGE }} - tags: latest-httpd-php + tags: latest-httpd-php-${{ env.arch }} + arch: ${{ env.arch }} dockerfiles: | ./httpd-php.Dockerfile build-args: | + ARCH=${{ env.arch }} CHEVERETO_LICENSE=${{ secrets.CHEVERETO_LICENSE }} - name: Log in to container registry diff --git a/.github/workflows/httpd-php-arm64v8.yml b/.github/workflows/httpd-php-arm64v8.yml new file mode 100644 index 0000000..060d995 --- /dev/null +++ b/.github/workflows/httpd-php-arm64v8.yml @@ -0,0 +1,59 @@ +name: Build httpd-php (arm64v8) +on: + workflow_dispatch: + +jobs: + build: + name: Build and push image + runs-on: ubuntu-20.04 + env: + arch: arm64v8 + + steps: + - uses: actions/checkout@v2 + + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Checkout custom application + env: + REPO_CUSTOM_APP: ${{ secrets.REPO_APP }} + if: env.REPO_CUSTOM_APP != null + uses: actions/checkout@v2 + with: + repository: ${{ secrets.REPO_APP }} + token: ${{ secrets.REPO_APP_ACCESS_TOKEN }} + path: chevereto + + - name: Build Image + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ secrets.REGISTRY_IMAGE }} + tags: latest-httpd-php-${{ env.arch }} + arch: ${{ env.arch }} + dockerfiles: | + ./httpd-php.Dockerfile + build-args: | + ARCH=${{ env.arch }} + CHEVERETO_LICENSE=${{ secrets.CHEVERETO_LICENSE }} + + - name: Log in to container registry + uses: redhat-actions/podman-login@v1 + with: + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + registry: ${{ secrets.REGISTRY_LABEL }} + + - name: Push to container registry + id: push-to-registry + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ${{ secrets.REGISTRY_LABEL }} + + - name: Print image url + run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" diff --git a/.github/workflows/update-template.yml b/.github/workflows/update.yml similarity index 90% rename from .github/workflows/update-template.yml rename to .github/workflows/update.yml index 673691d..a3a1eee 100644 --- a/.github/workflows/update-template.yml +++ b/.github/workflows/update.yml @@ -1,8 +1,8 @@ -name: Update template +name: Update on: workflow_dispatch: jobs: - update-template: + update: runs-on: ubuntu-20.04 steps: - name: Checkout diff --git a/BUILDING.md b/BUILDING.md index c5dc82f..a8c596f 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -14,6 +14,4 @@ The build process consist in build the container image that you will use to depl ## Manual building -```sh -docker build -t tag . -f httpd-php.Dockerfile --build-arg CHEVERETO_LICENSE= -``` +Refer to the [MANUAL GUIDE](guides/console/BUILDING.md). diff --git a/README.md b/README.md index b2f4e69..02f1487 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,4 @@ Dockerfile template project for building and distributing container images for C * [SETUP](SETUP.md) * [BUILDING](BUILDING.md) * [UPDATING](UPDATING.md) - -## Guides - -* [Portainer](guides/portainer/README.md) +* [GUIDES](guides/README.md) diff --git a/UPDATING.md b/UPDATING.md index d5b3a43..f7d472b 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -5,7 +5,7 @@ The update process consist in that you pull our `chevereto/container-builder` re ## One-click updating 1. Go to **Actions** -2. Select **Update template** under **Workflows** +2. Select **Update** under **Workflows** 3. Click on **Run Workflow** and confirm ![Update template](src/update.png) @@ -16,21 +16,4 @@ The update process consist in that you pull our `chevereto/container-builder` re ## Manual updating -* Add the main template repository as remote `template`. This is required just once. - -```sh -git remote add template https://github.com/chevereto/container-builder -``` - -* Fetch `template` and merge it with `main`. This will pull all updates. - -```sh -git fetch template main -git merge template/main --allow-unrelated-histories -``` - -* When done push the changes to your remote repository. - -```sh -git push -``` +Refer to the [MANUAL GUIDE](guides/console/UPDATING.md). diff --git a/guides/portainer/httpd-php.dist.yml b/docker-compose/httpd-php-amd64.yml similarity index 95% rename from guides/portainer/httpd-php.dist.yml rename to docker-compose/httpd-php-amd64.yml index 26518bb..d8b5ad3 100644 --- a/guides/portainer/httpd-php.dist.yml +++ b/docker-compose/httpd-php-amd64.yml @@ -17,7 +17,7 @@ services: MYSQL_PASSWORD: user_database_password chv-build: - image: rodber/docker-build:latest-httpd-php + image: chevereto-build:latest-httpd-php-amd64 networks: - chv-network volumes: diff --git a/docker-compose/httpd-php-arm64v8.yml b/docker-compose/httpd-php-arm64v8.yml new file mode 100644 index 0000000..7ad8ada --- /dev/null +++ b/docker-compose/httpd-php-arm64v8.yml @@ -0,0 +1,46 @@ +version: "3" + +services: + chv-database: + image: mariadb:focal + networks: + - chv-network + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping --silent"] + volumes: + - chv-data:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: chevereto + MYSQL_USER: chevereto + MYSQL_PASSWORD: user_database_password + + chv-build: + image: chevereto-build:latest-httpd-php-arm64v8 + networks: + - chv-network + volumes: + - chv-storage:/var/www/html/images/ + - chv-assets:/var/www/html/_assets/ + ports: + - 8016:80 + restart: always + environment: + CHEVERETO_DB_HOST: chv-database + CHEVERETO_DB_USER: chevereto + CHEVERETO_DB_PASS: user_database_password + CHEVERETO_DB_PORT: 3306 + CHEVERETO_DB_NAME: chevereto + CHEVERETO_HTTPS: 0 + CHEVERETO_ASSET_STORAGE_TYPE: local + CHEVERETO_ASSET_STORAGE_URL: http://localhost:8016/_assets/ + CHEVERETO_ASSET_STORAGE_BUCKET: /var/www/html/_assets/ + +volumes: + chv-data: + chv-assets: + chv-storage: + +networks: + chv-network: diff --git a/guides/README.md b/guides/README.md new file mode 100644 index 0000000..430311a --- /dev/null +++ b/guides/README.md @@ -0,0 +1,6 @@ +# Guides + +For all purposes, the [docker-compose](../docker-compose/) folder contains examples on running using `docker-compose.yml` files. + +* [Portainer](portainer/README.md) +* [Console](console/README.md) diff --git a/guides/console/BUILDING.md b/guides/console/BUILDING.md new file mode 100644 index 0000000..d08e186 --- /dev/null +++ b/guides/console/BUILDING.md @@ -0,0 +1,21 @@ +# Building (console) + +> Note: Running the command from the top folder of this repository. + +* **amd64** + +```sh +docker build -t chevereto-build:latest-httpd-php-amd64 . \ + -f httpd-php.Dockerfile \ + --build-arg CHEVERETO_LICENSE= \ + --build-arg ARCH=amd64 +``` + +* **arm64v8** + +```sh +docker build -t chevereto-build:latest-httpd-php-arm64v8 . \ + -f httpd-php.Dockerfile \ + --build-arg CHEVERETO_LICENSE= \ + --build-arg ARCH=arm64v8 +``` diff --git a/guides/console/README.md b/guides/console/README.md new file mode 100644 index 0000000..92c3db9 --- /dev/null +++ b/guides/console/README.md @@ -0,0 +1,7 @@ +# Console + +This section outlines command-line instructions to build and deploy images made by ths repository project. + +* [SETUP](SETUP.md) +* [BUILDING](BUILDING.md) +* [UPDATING](UPDATING.md) diff --git a/guides/console/SETUP.md b/guides/console/SETUP.md new file mode 100644 index 0000000..b211902 --- /dev/null +++ b/guides/console/SETUP.md @@ -0,0 +1,11 @@ +# Setup (console) + +* Clone the repository + +```sh +git clone https://github.com/chevereto/container-builder.git +``` + +## Custom application + +Put the contents of your custom Chevereto based application in the `/chevereto` folder before building the image. diff --git a/guides/console/UPDATING.md b/guides/console/UPDATING.md new file mode 100644 index 0000000..4474608 --- /dev/null +++ b/guides/console/UPDATING.md @@ -0,0 +1,20 @@ +# Updating (console) + +* Add the main template repository as remote `template`. *This is required just once*. + +```sh +git remote add template https://github.com/chevereto/container-builder +``` + +* Fetch `template` and merge it with `main`. This will pull all updates. + +```sh +git fetch template main +git merge template/main --allow-unrelated-histories +``` + +* When done push the changes to your remote repository. + +```sh +git push +``` diff --git a/guides/console/docker-compose.md b/guides/console/docker-compose.md new file mode 100644 index 0000000..070266f --- /dev/null +++ b/guides/console/docker-compose.md @@ -0,0 +1,81 @@ +# Docker compose + +> Run all the following commands from the top folder of this repository. + +Refer to [docker-compose/](../../docker-compose/) directory for all the compose files examples you can use. + +## Up + +Run Chevereto, it will be available at [https://localhost:8096](https://localhost:8096) by default: + +* **arm64v8** + +```sh +docker compose \ + -f docker-compose/httpd-php-arm64v8.yml \ + up -d +``` + +* **amd64** + +```sh +docker compose \ + -f docker-compose/httpd-php-amd64.yml \ + up -d +``` + +## Stop + +* **arm64v8** + +```sh +docker compose \ + -f docker-compose/httpd-php-arm64v8.yml \ + stop +``` + +* **amd64** + +```sh +docker compose \ + -f docker-compose/httpd-php-amd64.yml \ + stop +``` + +## Start + +* **arm64v8** + +```sh +docker compose \ + -f docker-compose/httpd-php-arm64v8.yml \ + start +``` + +* **amd64** + +```sh +docker compose \ + -f docker-compose/httpd-php-amd64.yml \ + start +``` + +## Down + +* **arm64v8** + +```sh +docker compose \ + -f docker-compose/httpd-php-arm64v8.yml \ + down +``` + +* **amd64** + +```sh +docker compose \ + -f docker-compose/httpd-php-amd64.yml \ + down +``` + +**Note**: This won't remove the volumes for persistent data storage. diff --git a/guides/portainer/README.md b/guides/portainer/README.md index cf71aee..17ecbb4 100644 --- a/guides/portainer/README.md +++ b/guides/portainer/README.md @@ -4,38 +4,19 @@ To use Chevereto with [Portainer](https://www.portainer.io/) you need the **Chevereto image build** already made and available in the private container registry of your choice. -## Compatibility remark - -**NOTE:** [Portainer CE 2.1.1](https://www.portainer.io/blog/portainer-release-2.1.1) supports docker-compose > 3 for standalone hosts ONLY for AMD64. This guide won't work when using ARM/ARM64: - -> The team (Portainer) are still working on creating a standalone binary for Compose that works on ARM/ARM64 - ## Installation -1. Install **Portainer** -2. Once installed, go to **Registries** -3. Add the user credentials for your **container registry** +1. Install **Portainer** following the instructions for your system. -## docker-compose +If you are using a remote container registry such as Docker hub and others: -Build your own `docker-compose` file by grabbing [httpd-php.dist.yml](./httpd-php.dist.yml) and change: - -```yml - chv-build: - image: rodber/docker-build:latest-httpd-php -``` - -To this, where `your_image_here` references your private image tag. - -```yml - chv-build: - image: your_image_here -``` - -You may alter the default provisioning to change HTTPS behavior, set a external storage provider for assets, etc. By default this guide only uses local volumes. +1. Go to **Registries** +2. Add the user credentials for your **container registry** ## Adding Chevereto as a Portainer custom application +**NOTE:** [Portainer CE 2.1.1](https://www.portainer.io/blog/portainer-release-2.1.1) supports docker-compose > 3 for standalone hosts **ONLY for amd64** architecture. This guide won't work when using arm64, for which case you can manually run `docker compose` following our [MANUAL GUIDE](../manual/README.md). + 1. Open Portainer and go to endpoint **Dashboard** 2. Go to **App Templates** and then click on **Custom Templates** 3. Click on **Add Custom Template** @@ -50,6 +31,27 @@ You may alter the default provisioning to change HTTPS behavior, set a external When done, Chevereto will be available in the custom applications list. +### docker-compose + +* [httpd-php-amd64.dist.yml](../docker-compose/httpd-php-amd64.dist.yml) +* [httpd-php-arm64v8.dist.yml](../docker-compose/httpd-php-arm64v8.dist.yml) + +If you want to use a custom image tag or registry change: + +```yml + chv-build: + image: chevereto-build:latest-httpd-php-amd64 +``` + +To this, where `your_image_here` references your private image tag. + +```yml + chv-build: + image: your_image_here +``` + +You may alter the default provisioning to change HTTPS behavior, set a external storage provider for assets, etc. By default this guide only uses local volumes. + ## Deploying 1. Go to **Custom Templates**, click **Chevereto** @@ -94,27 +96,6 @@ drwxr-xr-x 6 www-data www-data 4096 Jun 23 16:47 importing drwxr-xr-x 4 www-data www-data 4096 Jun 23 15:13 lib drwxr-xr-x 2 www-data www-data 4096 Jun 23 15:13 sdk ``` - -### Multiple instances - -To deploy multiple instances using Portainer: - -1. Go to **Custom Templates**, click **Chevereto** -2. Choose your deploy options -3. Click **Customize stack** and **change port `8016` references** to another port in your host machine -4. Finish by clicking on **Deploy the stack** - -`docker-compose` port `8016` references: - -```yaml -ports: - - 8016:80 -``` - -```yaml -CHEVERETO_ASSET_STORAGE_URL: http://localhost:8016/_assets/ -``` - ## Updating You will need to [update your template](../../UPDATING.md) then [re-create the build](../../BUILDING.md). diff --git a/httpd-php.Dockerfile b/httpd-php.Dockerfile index e60914f..46fbf25 100644 --- a/httpd-php.Dockerfile +++ b/httpd-php.Dockerfile @@ -1,4 +1,7 @@ -FROM php:7.4-apache +ARG ARCH +FROM docker.io/$ARCH/composer:latest as base +FROM docker.io/$ARCH/php:7.4-apache +COPY --from=base /usr/bin/composer /usr/local/bin/composer RUN apt-get update && apt-get install -y \ libfreetype6-dev \ @@ -20,8 +23,6 @@ RUN apt-get update && apt-get install -y \ && php -m \ && a2enmod rewrite -COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer - ARG CHEVERETO_SOFTWARE=chevereto ARG CHEVERETO_TAG=3.20.10 ARG CHEVERETO_INSTALLER_TAG=2.3.0 @@ -53,8 +54,8 @@ ENV CHEVERETO_SOFTWARE=$CHEVERETO_SOFTWARE \ CHEVERETO_HOSTNAME_PATH=/ \ CHEVERETO_SESSION_SAVE_HANDLER=files \ CHEVERETO_SESSION_SAVE_PATH=/tmp \ - CHEVERETO_UPLOAD_MAX_FILESIZE=25M \ - CHEVERETO_POST_MAX_SIZE=25M \ + CHEVERETO_UPLOAD_MAX_FILESIZE=64M \ + CHEVERETO_POST_MAX_SIZE=64M \ CHEVERETO_MAX_EXECUTION_TIME=30 \ CHEVERETO_MEMORY_LIMIT=512M \ CHEVERETO_ASSET_STORAGE_NAME=assets \