Skip to content

Commit

Permalink
Merge branch 'isso-comments:master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mgc8 authored Apr 29, 2024
2 parents c88e30d + ac9fb0d commit 5e95fdb
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=release,enable=${{ github.ref_type == 'tag' }}
- name: Login to Github Container Registry
if: github.event_name != 'pull_request'
Expand All @@ -52,7 +53,6 @@ jobs:
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.build_platforms }}

- name: Image digest
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/docker-testbed-periodic-rebuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Rebuild js testbed image

on:
workflow_dispatch:
schedule:
# Run weekly, at 2:15pm on Monday (chosen at random)
# https://cron.help/#15_14_*_*_1
- cron: '15 14 * * 1'

env:
build_platforms: ${{ vars.BUILD_PLATFORMS || 'linux/amd64' }}
build_image: ${{ vars.BUILD_IMAGE || 'ghcr.io/isso-comments/isso-js-testbed' }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: ${{ env.build_image }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Login to Github Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build docker-js-testbed
run: make docker-testbed

- name: Push docker-js-testbed image as ${{ env.build_image }}
run: make docker-testbed-push
8 changes: 5 additions & 3 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ jobs:
run: docker compose build isso-server

- name: Bring up containers
# Don't wait for healthcheck via --wait. This would fail with a
# negative exit code since the isso-client container is expected to
# exit
run: docker compose up -d

- name: Client unit tests
run: make docker-js-unit

- name: Check if containers are up, sleep if not
shell: bash
run: '[ "$(docker inspect --format={{.State.Health.Status}} isso-server)" = "healthy" ] || sleep 5'
- name: Wait for isso-server container to be ready
run: 'for i in $(seq 1 30); do [ "`docker inspect -f {{.State.Health.Status}} isso-server`" == "healthy" ] && s=0 && break || s=$? && sleep 0.3; done; (exit $s)'

- name: Client integration tests
run: make docker-js-integration
Expand Down
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ New Features
Breaking Changes
^^^^^^^^^^^^^^^^

- TBD
- Rework the Docker image tagging scheme: ``isso:latest`` is now rebuilt on
every push to ``master``, while ``isso:release`` points to the latest stable
release (`#970`_, janw). Previously, ``:latest`` pointed to the latest stable
(tagged) version

.. _#970: https://github.com/isso-comments/isso/pull/970

Bugfixes & Improvements
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ FROM python:3.10-alpine AS isso
WORKDIR /isso/
COPY --from=isso-builder /isso/ .

LABEL org.opencontainers.image.source=https://github.com/isso-comments/isso
LABEL org.opencontainers.image.description="Isso – a commenting server similar to Disqus"
LABEL org.opencontainers.image.licenses=MIT

# Clean up
RUN rm -rf /var/apk/cache/* /tmp/* /var/tmp/*

Expand Down
33 changes: 25 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ APIDOC = npx --no-install apidoc

SASS = sassc

ISSO_IMAGE ?= isso:latest
ISSO_RELEASE_IMAGE ?= isso:release
ISSO_DOCKER_REGISTRY ?= ghcr.io/isso-comments
TESTBED_IMAGE ?= isso-js-testbed:latest

all: js site
Expand Down Expand Up @@ -93,21 +96,35 @@ test: $($ISSO_PY_SRC)
PYTHONPATH=. pytest --doctest-modules isso/

docker:
DOCKER_BUILDKIT=1 docker build -t isso:latest .
DOCKER_BUILDKIT=1 docker build -t $(ISSO_IMAGE) .

# For maintainers making releases only:
docker-release:
DOCKER_BUILDKIT=1 docker build -t $(ISSO_IMAGE) .

docker-run:
docker run -d --rm --name isso -p 127.0.0.1:8080:8080 --mount type=bind,source=$(PWD)/contrib/isso-dev.cfg,target=/config/isso.cfg,readonly isso:latest isso.run
docker run -d --rm --name isso -p 127.0.0.1:8080:8080 \
--mount type=bind,source=$(PWD)/contrib/isso-dev.cfg,target=/config/isso.cfg,readonly \
$(ISSO_IMAGE) isso.run

# For maintainers only, discouraged in favor of the GitHub action running on
# every git push
docker-push:
docker tag isso:latest ghcr.io/isso-comments/isso:dev
docker push ghcr.io/isso-comments/isso:dev
docker tag $(ISSO_IMAGE) $(ISSO_DOCKER_REGISTRY)/$(ISSO_IMAGE)
docker push $(ISSO_DOCKER_REGISTRY)/$(ISSO_IMAGE)

# For maintainers making releases only:
docker-release-push:
docker tag $(ISSO_RELEASE_IMAGE) $(ISSO_DOCKER_REGISTRY)/$(ISSO_RELEASE_IMAGE)
docker push $(ISSO_DOCKER_REGISTRY)/$(ISSO_RELEASE_IMAGE)

docker-testbed:
docker build -f docker/Dockerfile-js-testbed -t isso-js-testbed .
docker build -f docker/Dockerfile-js-testbed -t $(TESTBED_IMAGE) .

# For maintainers only:
docker-testbed-push:
docker tag isso-js-testbed:latest ghcr.io/isso-comments/isso-js-testbed:latest
docker push ghcr.io/isso-comments/isso-js-testbed:latest
docker tag $(TESTBED_IMAGE) $(ISSO_DOCKER_REGISTRY)/$(TESTBED_IMAGE)
docker push $(ISSO_DOCKER_REGISTRY)/$(TESTBED_IMAGE)

docker-js-unit:
docker run \
Expand Down Expand Up @@ -150,4 +167,4 @@ clean:
rm -rf .pytest_cache/
rm -rf .coverage

.PHONY: apidoc apidoc-init clean coverage docker docker-compare-screenshots docker-generate-screenshots docker-update-screenshots docker-js-unit docker-js-integration docker-push docker-testbed docker-testbed-push init test
.PHONY: apidoc apidoc-init clean coverage docker docker-compare-screenshots docker-generate-screenshots docker-js-integration docker-js-unit docker-push docker-release docker-release-push docker-run docker-testbed docker-testbed-push docker-update-screenshots init test
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ the [the full documentation](https://isso-comments.de/docs/).

## Docker

A Docker image with the latest stable release is provided at
`ghcr.io/isso-comments/isso:latest`. See
> [!NOTE]
> The Docker image tagging scheme for stable releases was changed from `:latest`
> to `:release` as of March 2024
> ([#970](https://github.com/isso-comments/isso/pull/970), [#1012](https://github.com/isso-comments/isso/issues/1012))
A [Docker image](https://github.com/isso-comments/isso/pkgs/container/isso) with
the latest stable release is provided at `ghcr.io/isso-comments/isso:release`,
while `isso:latest` is rebuilt on every push to the `master` branch. See
[Using Docker](https://isso-comments.de/docs/reference/installation/#using-docker).

The maintainers recommend pinning the image to a
[release tag](https://github.com/isso-comments/isso/pkgs/container/isso), e.g.
`isso:0.13.0`.

## Contributing

- Pull requests are very much welcome! These might be
Expand Down
17 changes: 11 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ services:
#command: /isso/bin/isso -c /config/isso.cfg run
environment:
ISSO_SETTINGS: "/config/isso-dev.cfg"
ISSO_ENDPOINT: "http://isso-dev.local:8080"
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8080/info || exit 1
interval: 5s # short timeout needed during start phase
retries: 3
start_period: 5s
timeout: 3s
# Double $$ for parsing vars inside CMD: https://stackoverflow.com/a/54989793
# Debug with 'docker inspect --format "{{json .State.Health }}" isso-server | jq'
test: wget --no-verbose --tries=1 --spider $$ISSO_ENDPOINT/info || exit 1
interval: 1s # time before first check and between subsequent checks
retries: 10
start_period: 10s
timeout: 10s
# If needed, production docker image can also be exposed to host for
# non-docker unit/integration testing
ports:
- 127.0.0.1:8080:8080
# Expose port 80080 to other containerized services, not to host machine:
# Expose port 8080 to other containerized services, not to host machine:
expose:
- 8080
networks:
Expand All @@ -49,6 +52,8 @@ services:
dockerfile: docker/Dockerfile-js-testbed
environment:
ISSO_ENDPOINT: "http://isso-dev.local:8080"
healthcheck:
disable: true
# Command may also run from outside docker compose, e.g.:
# $ docker run isso-js-testbed [mount, networks, ...] npm run test-integration
#command: npm run test-integration
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile-js-testbed
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# Note: Do not use alpine images as they do not contain needed GObject, X11
# etc. packages and complicate things
# :current resolves to NodeJS 17 on Debian Buster as of 03/2022
# :22-bookworm resolves to NodeJS 22 on Debian Bookworm as of 04/2024
# https://hub.docker.com/_/node
FROM docker.io/node:current AS isso-js-testbed
FROM docker.io/node:22-bookworm AS isso-js-testbed
WORKDIR /src/

# Install everything necessary to run headless
Expand Down
22 changes: 20 additions & 2 deletions docs/docs/reference/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,30 @@ two options for running a Docker container:
a) Official Docker image
^^^^^^^^^^^^^^^^^^^^^^^^

.. attention::

The Docker image tagging scheme for stable releases was changed from ``:latest``
to ``:release`` as of March 2024 (`#970`_, `#1012`_).

.. _#970: https://github.com/isso-comments/isso/pull/970
.. _#1012: https://github.com/isso-comments/isso/pull/1012

A `Docker image`_ with the latest stable release is provided at
``ghcr.io/isso-comments/isso:release``, while ``isso:latest`` is rebuilt on
every push to the ``master`` branch.

The maintainers recommend pinning the image to a `release tag`_, e.g.
``isso:0.13.0``.

.. code-block:: console
$ docker pull ghcr.io/isso-comments/isso:latest
$ docker pull ghcr.io/isso-comments/isso:release
$ docker run -d --rm --name isso -p 127.0.0.1:8080:8080 \
-v /var/lib/isso:/config -v /var/lib/isso:/db \
ghcr.io/isso-comments/isso:latest
ghcr.io/isso-comments/isso:release
.. _Docker image: https://github.com/isso-comments/isso/pkgs/container/isso
.. _release tag: https://github.com/isso-comments/isso/pkgs/container/isso

b) Build a Docker image yourself
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Binary file modified isso/js/tests/screenshots/reference/comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion isso/js/tests/screenshots/reference/comment.png.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
065f2dfac1c6bc174c8406e574f8890d3bb867b13407809eb9aec184f97c172d
56314990cb566160044f46033a7bd0c4d8be5bb41afa44fa54cf156aed21bbe3
Binary file modified isso/js/tests/screenshots/reference/postbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion isso/js/tests/screenshots/reference/postbox.png.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0eb72a0e3faaf65c373383e9cfe9359de37e31c7f0e6e38c2b2369eb85f0eba4
a218440951dbc7312118647c955d0d4480fc46bb6dddd72e0d9459744b471f32
Binary file modified isso/js/tests/screenshots/reference/thread.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion isso/js/tests/screenshots/reference/thread.png.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3185d06957e792d48d28b47c3e2c7e89353aa8d70757d4c92890d38850a66e54
78ea677962d3f80607995d9b88d81df2b7787832023cb7f1d64811829d0fc10a

0 comments on commit 5e95fdb

Please sign in to comment.