From f722a5a99d9a88729d3bfb87fdee9247ea5084ec Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Thu, 7 Jul 2022 19:55:34 +0530 Subject: [PATCH] [ci/docs] Publish images to Docker Hub and README update #244 Closes #244 --- .github/workflows/branch.yml | 34 ++++++++++++++++++++++++---------- Makefile | 11 ++++++++++- README.md | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 5dbc918b..b14db922 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -14,14 +14,6 @@ jobs: - name: Git Checkout uses: actions/checkout@v2 - # echo "$DOCKER_TOKEN" | docker login registry.gitlab.com --username "$DOCKER_USER" --password-stdin - - name: Login to GitLab - uses: docker/login-action@v1 - with: - registry: registry.gitlab.com - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Install Testing Requirements run: sudo pip install -r requirements-test.txt @@ -32,7 +24,29 @@ jobs: run: | echo "127.0.0.1 dashboard.openwisp.org api.openwisp.org" | sudo tee -a /etc/hosts - - name: Build & Publish - run: make publish TAG=edge || (docker-compose logs && exit 1) + # the following action is equivalent to + # echo "$DOCKER_HUB_TOKEN" | docker login --username "$DOCKER_HUB_USER" --password-stdin + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Build & Publish to Docker Hub + run: | + make publish TAG=edge USER=registry.docker.com/openwisp || (docker-compose logs && exit 1) env: SELENIUM_HEADLESS: 1 + + - name: Login to GitLab Container Registry + uses: docker/login-action@v1 + with: + registry: registry.gitlab.com + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + + # Skip image builds and tests since they were done when + # publishing to Docker Hub + - name: Build & Publish to GitLab Container Registry + run: | + make publish TAG=edge SKIP_BUILD=true SKIP_TESTS=true diff --git a/Makefile b/Makefile index 241e61d2..92ca2449 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,16 @@ stop: # Publish USER = registry.gitlab.com/openwisp/docker-openwisp TAG = latest -publish: compose-build runtests nfs-build +SKIP_BUILD = false +SKIP_TESTS = false + +publish: + if [[ "$(SKIP_BUILD)" == "false" ]]; then \ + make compose-build nfs-build; \ + fi + if [[ "$(SKIP_TESTS)" == "false" ]]; then \ + make runtests; \ + fi for image in 'openwisp-base' 'openwisp-nfs' 'openwisp-api' 'openwisp-dashboard' \ 'openwisp-freeradius' 'openwisp-nginx' 'openwisp-openvpn' 'openwisp-postfix' \ 'openwisp-websocket' ; do \ diff --git a/README.md b/README.md index fab1c0a1..e79e8373 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ The sample files for deployment on kubernetes are available in the `deploy/examp - [Docker-OpenWISP](#docker-openwisp) - [Table of contents](#table-of-contents) - [Images Available](#images-available) + - [Image Tags](#image-tags) - [Architecture](#architecture) - [Deployment](#deployment) - [Quick Setup](#quick-setup) @@ -30,6 +31,7 @@ The sample files for deployment on kubernetes are available in the `deploy/examp - [Development](#development) - [Workbench setup](#workbench-setup) - [Runtests](#runtests) + - [Run Quality Assurance Checks](#run-quality-assurance-checks) - [Usage](#usage) - [Makefile Options](#makefile-options) @@ -45,8 +47,31 @@ The sample files for deployment on kubernetes are available in the `deploy/examp \* Roughly the same features would be available but it's not an exact one-to-one mapping. +The images are hosted on [Docker Hub](https://hub.docker.com/u/openwisp) +and [GitLab Container Registry](https://gitlab.com/openwisp/docker-openwisp/container_registry). + +### Image Tags + +All images are tagged using the following convention: + +| Tag | Software Version | +| ------ |---------------------------------------------- | +| latest | Images built on the **latest git tag** | +| edge | Images built on the **current master branch** | + ## Architecture +A typical OpenWISP installation is made of multiple components +(e.g. application servers, background workers, web servers, +database, messaging queue, VPN server, etc. ) that have different +scaling requirements. + +The aim of Docker OpenWISP is to allow deploying +OpenWISP in cloud based environments which +allow potentially infinite horizontal scaling. +That is the reason for which there are different +docker images shipped in this repository. + ![Architecture](docs/images/architecture.jpg) - **openwisp-dashboard**: Your OpenWISP device administration dashboard. @@ -257,15 +282,15 @@ You can run tests either with `geckodriver` (firefox) or `chromedriver` (chromiu - Setup chromedriver - 1. Install chromium: - + 1. Install chromium: + ```bash - # On debian + # On debian sudo apt --yes install chromium - # On ubuntu + # On ubuntu sudo apt --yes install chromium-browser ``` - + 3. Check version: `chromium --version` 4. Install Driver for your version: [`https://chromedriver.chromium.org/downloads`](https://chromedriver.chromium.org/downloads) 5. Extract chromedriver to one of directories from your `$PATH`. (example: `/usr/bin/`)