Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack update, other fixes #62

Closed
wants to merge 12 commits into from
31 changes: 0 additions & 31 deletions .github/workflows/TEST-simplerisk-minimal-php72.yml.disabled

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/TEST-simplerisk-minimal-php74.yml.disabled

This file was deleted.

95 changes: 95 additions & 0 deletions .github/workflows/simplerisk-jammy-push_to_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "master" ]
# Publish semver tags as releases.
#tags: [ '[2022]0701-001' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: "${{ github.repository_owner }}/simplerisk"
VERSION: "20230106-001"


jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
with:
cosign-release: 'v1.13.1'


# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: "simplerisk"
file: "simplerisk/jammy/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-jammy
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
95 changes: 95 additions & 0 deletions .github/workflows/simplerisk-minimal-php81-push_to_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "master" ]
# Publish semver tags as releases.
#tags: [ '[2022]0701-001' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: "${{ github.repository_owner }}/simplerisk-minimal"
VERSION: "20230106-001"


jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
with:
cosign-release: 'v1.13.1'


# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: "simplerisk-minimal"
file: "simplerisk-minimal/php81/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-php81
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ These images are available on [DockerHub](https://hub.docker.com/u/simplerisk).

A `stack.yml` file is provided for a stack deployment of the application through Docker Compose or Docker Swarm. It will deploy the application with the following components:
- [SimpleRisk Application](https://hub.docker.com/r/simplerisk/simplerisk-minimal) (`simplerisk-minimal`)
- [MariaDB Database](https://hub.docker.com/_/mariadb) (version 10.6)
- [MySQL Database](https://hub.docker.com/_/mysql) (version 8.0.X, as it uses the 8.0 tag)
- [SMTP Server](https://hub.docker.com/r/namshi/smtp)

Change its settings according to your needs.
Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Docker repository";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:nixos/nixpkgs/release-22.11";
utils.url = "github:numtide/flake-utils";
};

Expand Down
10 changes: 5 additions & 5 deletions generate_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ version: '3.6'
services:
simplerisk:
environment:
- FIRST_TIME_SETUP=1
- FIRST_TIME_SETUP_PASS=$pass
- SIMPLERISK_DB_HOSTNAME=mariadb
- DB_SETUP=automatic
- DB_SETUP_PASS=$pass
- SIMPLERISK_DB_HOSTNAME=mysql
image: simplerisk/simplerisk-minimal:$release
ports:
- "80:80"
- "443:443"

mariadb:
mysql:
command: mysqld --sql_mode="NO_ENGINE_SUBSTITUTION"
environment:
- MYSQL_ROOT_PASSWORD=$pass
image: mariadb:10.7
image: mysql:8.0

smtp:
image: namshi/smtp
Expand Down
4 changes: 2 additions & 2 deletions simplerisk/common/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ run_sql_command() {
}

set_db_password(){
echo "$(generate_random_password)" >> /passwords/pass_mysql_root.txt
echo "$(generate_random_password)" >> /passwords/pass_simplerisk.txt
echo "$(generate_random_password)" > /passwords/pass_mysql_root.txt
echo "$(generate_random_password)" > /passwords/pass_simplerisk.txt
sed -i "s/\('DB_PASSWORD', '\).*\(');\)/\1$(cat /passwords/pass_simplerisk.txt)\2/g" "$CONFIG_PATH"
}

Expand Down
12 changes: 6 additions & 6 deletions stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ version: '3.6'
services:
simplerisk:
environment:
- FIRST_TIME_SETUP=1
- FIRST_TIME_SETUP_PASS=FewY7hr3LHp4CRL9v2jg6
- SIMPLERISK_DB_HOSTNAME=mariadb
- DB_SETUP=automatic
- DB_SETUP_PASS=GlUl--W_oMTzfkeEV20be
- SIMPLERISK_DB_HOSTNAME=mysql
image: simplerisk/simplerisk-minimal:20230331-001
ports:
- "80:80"
- "443:443"

mariadb:
mysql:
command: mysqld --sql_mode="NO_ENGINE_SUBSTITUTION"
environment:
- MYSQL_ROOT_PASSWORD=FewY7hr3LHp4CRL9v2jg6
image: mariadb:10.7
- MYSQL_ROOT_PASSWORD=GlUl--W_oMTzfkeEV20be
image: mysql:8.0

smtp:
image: namshi/smtp