Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc.20'
Browse files Browse the repository at this point in the history
  • Loading branch information
aramallo committed May 29, 2024
2 parents 5cca9a8 + b07e56c commit 6681d12
Show file tree
Hide file tree
Showing 13 changed files with 381 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

name: Docker Build OTP 25
on:
workflow_dispatch:
push:
Expand Down Expand Up @@ -65,10 +64,10 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: ./deployment/Dockerfile
file: ./deployment/otp25/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leapsight/${{ steps.meta.outputs.tags }}
tags: leapsight/${{ steps.meta.outputs.tags }}-otp25
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache
cache-to: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache,mode=max
Expand All @@ -78,25 +77,25 @@ jobs:
name: Copy Image to multiple registries
uses: akhilerm/[email protected]
with:
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-otp25
dst: |
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-otp25
-
name: Build and push alpine image
uses: docker/build-push-action@v3
with:
context: .
file: ./deployment/alpine.Dockerfile
file: ./deployment/otp25/alpine.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine-otp25
labels: ${{ steps.meta.outputs.labels }}
-
# Copy multiplatform image from dockerhub to multiple registries
# without changing the image SHA
name: Copy Image to multiple registries
uses: akhilerm/[email protected]
with:
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine-otp25
dst: |
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine-otp25
109 changes: 109 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Docker Build OTP 26:
workflow_dispatch:
push:
branches : [develop, master]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'

jobs:
docker:
runs-on: ubuntu-latest
name: Build an publish docker images to multiple registries
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# without registry name, we will add it in the build-push-action as
# each registry has diff namespace at the moment
images: |
bondy
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
flavor: |
latest=false
prefix=
suffix=
labels: |
maintainer=Leapsight
org.opencontainers.image.title=Bondy
org.opencontainers.image.description=Bondy is an open source, always-on and scalable application networking platform connecting all elements of a distributed application—offering event and service mesh capabilities combined. From web and mobile apps to IoT devices and backend microservices, Bondy allows everything to talk using one simple communication protocol.
org.opencontainers.image.vendor=Leapsight
-
name: Build, cache and push standard image
uses: docker/build-push-action@v3
with:
context: .
file: ./deployment/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leapsight/${{ steps.meta.outputs.tags }},leapsight/${{ steps.meta.outputs.tags }}-otp26
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache
cache-to: type=registry,ref=leapsight/${{ steps.meta.outputs.tags }}-buildcache,mode=max
-
# Copy multiplatform image from dockerhub to multiple registries
# without changing the image SHA
name: Copy Image to multiple registries
uses: akhilerm/[email protected]
with:
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}
dst: |
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}
-
name: Build and push alpine image
uses: docker/build-push-action@v3
with:
context: .
file: ./deployment/alpine.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leapsight/${{ steps.meta.outputs.tags }}-alpine,leapsight/${{ steps.meta.outputs.tags }}-alpine-otp26
labels: ${{ steps.meta.outputs.labels }}
-
# Copy multiplatform image from dockerhub to multiple registries
# without changing the image SHA
name: Copy Image to multiple registries
uses: akhilerm/[email protected]
with:
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine
dst: |
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine
-
# Copy multiplatform image from dockerhub to multiple registries
# without changing the image SHA
name: Copy Image to multiple registries
uses: akhilerm/[email protected]
with:
src: docker.io/leapsight/${{ steps.meta.outputs.tags }}-alpine-otp26
dst: |
ghcr.io/bondy-io/${{ steps.meta.outputs.tags }}-alpine-otp26
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# CHANGELOG
## 1.0.0-rc.20
* Drop Min OTP version to OTP25 and CI workflow to publish Bondy build with OTP25 and OTP26

## 1.0.0-rc.19
* Upgrade Dockerfile to OTP 26.2.5 to avoid memory-related bugs in BEAM

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![Docker Pulls](https://img.shields.io/docker/pulls/leapsight/bondy?style=for-the-badge)
![Docker Build (master)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&branch=master&label=docker-master&style=for-the-badge)
![Docker Build (develop)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&branch=develop&label=docker-develop&style=for-the-badge)
![Docker Build (latest-tag)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&tag=version-1.0.0-rc.19&label=docker-1.0.0-rc.19&style=for-the-badge)
![Docker Build (latest-tag)](https://img.shields.io/github/actions/workflow/status/bondy-io/bondy/docker_image_build.yaml?&tag=version-1.0.0-rc.20&label=docker-1.0.0-rc.20&style=for-the-badge)
<br>![Architectures](https://img.shields.io/badge/architecture-linux%2Famd64%20%7C%20linux%2Farm64%20%7C%20macOS%2Fintel%20%7C%20macOS%2FM1-lightgrey?style=for-the-badge)


Expand Down Expand Up @@ -158,7 +158,7 @@ make release
Untar and copy the resulting tarball to the location where you want to install Bondy e.g. `~/tmp/bondy`.

```shell
tar -zxvf _build/prod/rel/bondy-1.0.0-rc.19.tar.qz -C ~/tmp/bondy
tar -zxvf _build/prod/rel/bondy-1.0.0-rc.20.tar.qz -C ~/tmp/bondy
```

#### Running
Expand Down
4 changes: 2 additions & 2 deletions apps/bondy/src/bondy.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"Bondy implements the open Web Application Messaging Protocol (WAMP) "
"and is written in Erlang."
},
{vsn, "1.0.0-rc.19"},
{vsn, "1.0.0-rc.20"},
{registered, []},
%% We pass the version number in the bondy_app:start/2 arguments
{mod, {bondy_app, [{vsn, "1.0.0-rc.19"}]}},
{mod, {bondy_app, [{vsn, "1.0.0-rc.20"}]}},
{applications,[
%% Erlang/OTP
stdlib,
Expand Down
2 changes: 1 addition & 1 deletion apps/bondy_broker_bridge/rebar.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{minimum_otp_vsn, "R26.0.2"}.
{minimum_otp_vsn, "R25.3.2.12"}.
{erl_opts, [debug_info]}.
{deps, [
%% Core deps
Expand Down
2 changes: 1 addition & 1 deletion apps/bondy_broker_bridge/src/bondy_broker_bridge.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{description,
"Bondy Broker Bridge is an application that is part of Bondy and provides a way to integrate Events with external brokers and systems."
},
{vsn, "1.0.0-rc.19"},
{vsn, "1.0.0-rc.20"},
{registered, []},
{mod, {bondy_broker_bridge_app, []}},
{applications, [
Expand Down
2 changes: 1 addition & 1 deletion apps/bondy_stdlib/rebar.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{minimum_otp_vsn, "R26.0.2"}.
{minimum_otp_vsn, "R25.3.2.12"}.
{erl_opts, [debug_info]}.

%% =============================================================================
Expand Down
17 changes: 15 additions & 2 deletions deployment/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ FROM erlang:26.2.5-alpine AS builder
# Install build dependencies
RUN --mount=type=cache,id=apk,sharing=locked,target=/var/cache/apk \
ln -s /var/cache/apk /etc/apk/cache && \
apk add --no-cache build-base libstdc++ git tar patch ncurses openssl snappy-dev libsodium-dev jq curl bash nano
apk add --no-cache \
build-base \
libstdc++ \
git \
tar \
patch \
ncurses \
openssl \
snappy-dev \
libsodium-dev \
jq \
curl \
bash \
nano

WORKDIR /bondy/src

Expand Down Expand Up @@ -71,7 +84,7 @@ RUN --mount=type=cache,id=apk,sharing=locked,target=/var/cache/apk \
&& apk add --no-cache \
libstdc++ \
bash procps iproute2 net-tools curl jq nano \
ncurses openssl libsodium-dev snappy-dev \
ncurses openssl libsodium-dev \
&& addgroup --gid 1000 bondy \
&& adduser \
--uid 1000 \
Expand Down
107 changes: 107 additions & 0 deletions deployment/otp25/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# syntax=docker/dockerfile:1.3

# ===========================================================================
# Build stage 1
# ===========================================================================

FROM erlang:25.3.2.12 AS builder

# Install build dependencies
RUN --mount=type=cache,id=apt,sharing=locked,target=/var/cache/apt apt-get update && \
apt-get -y install --no-install-recommends build-essential git libssl-dev libsodium-dev libsnappy-dev curl && \
rm -rf /var/lib/apt/lists/*

WORKDIR /bondy/src

# Copy Bondy project source to working dir
COPY ../ /bondy/src

# Create dir we will unpack release tar into
RUN mkdir -p /bondy/rel

# Generates tar in /bondy/src/_build and untars in /bondy/rel
RUN rebar3 as docker tar && \
tar -zxvf /bondy/src/_build/docker/rel/*/*.tar.gz -C /bondy/rel/


# ===========================================================================
# Build stage 2
# ===========================================================================

FROM debian:bullseye-slim as runner

# We define defaults
# We assume you have DNS. Erlang will take the FQDN and generate
# a node name == ${BONDY_ERL_NODENAME}@${FQDN}
ENV [email protected]
ENV BONDY_ERL_DISTRIBUTED_COOKIE=bondy
ENV BONDY_LOG_CONSOLE=console
ENV BONDY_LOG_LEVEL=info
ENV ERL_CRASH_DUMP=/dev/null
ENV ERL_DIST_PORT=27780

# We add Bondy executables to PATH
ENV PATH="/bondy/bin:$PATH"
# This is required so that relx replaces the vm.args
# BONDY_ERL_NODENAME and BONDY_ERL_DISTRIBUTED_COOKIE variables
ENV RELX_REPLACE_OS_VARS=true

ENV HOME "/bondy"

# We install the following utils:
# - bash
# - procps: which includes the commands free, kill, pkill, pgrep, pmap, ps,
# pwdx, skill, slabtop, snice, sysctl, tload, top, uptime, vmstat, w, and
# watch
# - iproute2: a collection of utilities for networking and traffic control.
# - net-tools: which includes the commands arp, ifconfig, netstat, rarp, nameif
# and route
# - curl, jq: for devops to use the REST Admin API
# - nano: for devops
#
# We install the following required packages:
# - openssl: required by Erlang crypto application
# - libsodium: required by enacl application
# We setup the bondy group and user and the /bondy dir
# We also create the /bondy/etc dir to avoid an issue when deploying in K8s
# where the permissions are not assigned to the directory and Bondy will not
# have permission to write.
RUN apt-get update \
&& apt-get -y install \
sudo bash procps iproute2 net-tools dnsutils curl jq nano \
openssl libsodium-dev libsnappy-dev\
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -g 1000 -r bondy \
&& useradd -u 1000 -r -g bondy -d /bondy -s /bin/bash -c "bondy" bondy \
&& mkdir -p /bondy/etc \
&& chown bondy:bondy /bondy/etc

WORKDIR /bondy
USER bondy:bondy

# Copy the release to workdir
COPY --chown=bondy:bondy --from=builder /bondy/rel .

# Define which ports are intended to be published
# We are hardcoding the ports here, the bondy.conf definitions need to match
# these!
# API GATEWAY HTTP and WS (Default: 18080)
EXPOSE 18080/tcp
# ADMIN API HTTP (Default: 18081)
EXPOSE 18081/tcp
# WAMP TCP (Default: 18082)
EXPOSE 18082/tcp
# API GATEWAY HTTPS and WSS (Default: 18083)
EXPOSE 18083/tcp
# ADMIN API HTTPS (Default: 18084)
EXPOSE 18084/tcp
# WAMP TLS (Default: 18085)
EXPOSE 18085/tcp
# CLUSTER PEER SERVICE (Default: 18086)
EXPOSE 18086/tcp

# The pre_start script will hardcode the following paths i.e. ignoring the
# user-defined environment variables (BONDY_*_DIR)
VOLUME ["/bondy/etc", "/bondy/data", "/bondy/log", "/bondy/tmp"]

ENTRYPOINT ["bondy", "foreground"]
Loading

0 comments on commit 6681d12

Please sign in to comment.