Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/axoflow/axosyslog-4-docs in…
Browse files Browse the repository at this point in the history
…to main
  • Loading branch information
eldarnash committed Oct 27, 2023
2 parents e38afd4 + e75fa7a commit 18a61fd
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
extended: true

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16

Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/prod-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Prod image build

on:
push:
tags: ["*"]

# secrets:
# - WIF_SERVICE_ACCOUNT
# - WIF_PROVIDER
#
# vars:
# - GCP_PROJECT
# - REGISTRY_DOMAIN

env:
IMAGE_PREFIX: ${{ vars.REGISTRY_DOMAIN }}/${{ vars.GCP_PROJECT }}/axosyslog-core-docs
IMAGE_NAME: axosyslog-core-docs

jobs:
image-build:
name: build&push
runs-on: ubuntu-latest
# Add 'id-token' with the intended permissions for workload identity federation
permissions:
contents: "read"
id-token: "write"
steps:
- name: Checkout
uses: "actions/checkout@v4"

### Preparation: Auth, setup ###

- name: Google auth
id: auth
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: "${{ secrets.WIF_PROVIDER }}"
service_account: "${{ secrets.WIF_SERVICE_ACCOUNT }}"
token_format: "access_token"

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

- name: Login to registry
uses: docker/login-action@v3
with:
registry: "${{ vars.REGISTRY_DOMAIN }}"
username: oauth2accesstoken
password: "${{ steps.auth.outputs.access_token }}"

# https://docs.docker.com/build/ci/github-actions/multi-platform/
# - name: Set up QEMU for multi-arch build
# uses: docker/setup-qemu-action@v2

### Image building ###

- name: Collect metadata for image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_PREFIX }}/${{ env.IMAGE_NAME }}
# https://github.com/docker/metadata-action#typesemver
tags: |
type=ref,event=branch,enable=${{ startsWith(github.ref, 'refs/heads/') }}
type=semver,pattern={{raw}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
labels: |
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.vendor: Axoflow
org.opencontainers.image.authors: Axoflow
maintainer: "Axoflow <info@axoflow.com>"
org.opencontainers.image.url: https://axoflow.com
org.opencontainers.image.source: https://axoflow.com
- name: Build image
uses: docker/build-push-action@v5
with:
# platforms: linux/amd64
context: "."
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
extended: true

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
extended: true

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16

Expand Down
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build stage
FROM ubuntu:22.04 as hugo

ARG TARGETARCH
ARG HUGO_VERSION="0.119.0"

RUN apt update && apt install -y wget git ca-certificates curl gnupg

# Install nodejs
# https://github.com/nodesource/distributions#installation-instructions
ARG NODE_MAJOR=20

RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN NODE_MAJOR=${NODE_MAJOR} echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get install -y nodejs

# Install hugo
RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.deb
RUN dpkg -i hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.deb

# WORKDIR /app
ADD . /app/

WORKDIR /app/themes/docsy

RUN npm install

WORKDIR /app/

RUN npm install autoprefixer postcss-cli

RUN hugo \
--baseURL="https://docs.axoflow.com/axosyslog-core" \
-e production \
--enableGitInfo \
--ignoreCache

# Run stage
FROM nginx:1.25-alpine

WORKDIR /usr/share/nginx/html

RUN sed -i 's/server {/server {\n absolute_redirect off;/' /etc/nginx/conf.d/default.conf
RUN sed -i 's/http {/http {\n server_tokens off;/' /etc/nginx/nginx.conf
COPY --from=hugo /app/public ./axosyslog-core
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
---
<!-- DISCLAIMER: This file is based on the syslog-ng Open Source Edition documentation https://github.com/balabit/syslog-ng-ose-guides/commit/2f4a52ee61d1ea9ad27cb4f3168b95408fddfdf2 and is used under the terms of The syslog-ng Open Source Edition Documentation License. The file has been modified by Axoflow. -->
If you store the Python code in a separate Python file and only include it in the {{% param "product.abbrev" %}} configuration file, make sure that the PYTHON_PATH environment variable includes the path to the Python file, and export the PYTHON_PATH environment variable. For example, if you start {{% param "product.abbrev" %}} manually from a terminal and you store your Python files in the `/opt/syslog-ng/etc` directory, use the following command: `export PYTHONPATH=/opt/syslog-ng/etc`.
If you store the Python code in a separate Python file and only include it in the {{% param "product.abbrev" %}} configuration file, make sure that the PYTHONPATH environment variable includes the path to the Python file, and export the PYTHON_PATH environment variable. For example, if you start {{% param "product.abbrev" %}} manually from a terminal and you store your Python files in the `/opt/syslog-ng/etc` directory, use the following command: `export PYTHONPATH=/opt/syslog-ng/etc`.

In production, when {{% param "product.abbrev" %}} starts on boot, you must configure your startup script to include the Python path. The exact method depends on your operating system. For recent Red Hat Enterprise Linux, Fedora, and CentOS distributions that use systemd, the `systemctl` command sources the `/etc/sysconfig/syslog-ng` file before starting {{% param "product.abbrev" %}}. (On openSUSE and SLES, `/etc/sysconfig/syslog` file.) Append the following line to the end of this file: `PYTHONPATH="<path-to-your-python-file>"`, for example, `PYTHONPATH="/opt/syslog-ng/etc"`.
2 changes: 1 addition & 1 deletion content/headless/chunk/syslog-ng-otlp-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ destination d_syslog_ng_otlp {

```shell
source s_syslog_ng_otlp {
syslog-ng-otlp();
syslog-ng-otlp(port(12346));
};
```

0 comments on commit 18a61fd

Please sign in to comment.