Skip to content

Commit

Permalink
Merge pull request #34 from fsr5-fhaachen/dev
Browse files Browse the repository at this point in the history
Release 2.0.0
  • Loading branch information
TitusKirch authored Oct 25, 2022
2 parents 6bbb84a + b1679c8 commit 7fa866b
Show file tree
Hide file tree
Showing 28 changed files with 60,771 additions and 7,266 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.github
.vscode
node_modules/
vendor
.env
.env.example
.gitignore
.gitattributes
.php-cs-fixer.cache
.prettierignore
.prettierrc.json
.rr.yaml
.styleci.yml
LICENSE
rr
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ APP_VPN_IP=127.0.0.1
TELEGRAM_BOT_TOKEN=
TELEGRAM_BOT_INFO_CHANNEL_ID=
TELEGRAM_BOT_WARNING_CHANNEL_ID=
CSV_EXPORT_PW=

LOG_CHANNEL=stack
LOG_LEVEL=debug
Expand Down Expand Up @@ -54,3 +55,7 @@ PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

OCTANE_HTTPS=false
OCTANE_WORKERS=4
OCTANE_MAX_REQUESTS=512
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: "dev"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
target-branch: "dev"
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
target-branch: "dev"
22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
categories:
- title: Breaking Changes
labels:
- breaking-change
- title: Added
labels:
- enhancement
- title: Fixed
labels:
- bug
- title: Removed
labels:
- deprecated
- title: Other Changes
labels:
- "*"
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches: ["main", "dev"]
pull_request:
branches: ["main", "dev"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ["8.0"]
node-version: [16.x]

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install PHP Dependencies
run: composer update --ignore-platform-req=php+ --no-interaction --no-progress
- name: Install Node.js Dependencies
run: |
npm ci --force --legacy-peer-deps
- name: Execute build
run: npm run build --if-present
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute migrations
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: |
php artisan migrate
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit
27 changes: 27 additions & 0 deletions .github/workflows/docker-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker CI (staging)

on:
push:
branches: [dev]

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker
run: |
docker build -f ./Dockerfile . --tag ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:dev
docker push ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:dev
28 changes: 28 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker CI (release)

on:
release:
types: [published]

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker
run: |
docker build -f ./Dockerfile . --tag ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:${{ env.RELEASE_VERSION }} --tag ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:latest
docker push ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:${{ env.RELEASE_VERSION }}
docker push ${{ env.REGISTRY }}/fsr5-fhaachen/strichlistensystem:latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ npm-debug.log
yarn-error.log
/.idea
/.vscode
rr
.rr.yaml
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM php:8.1-cli-alpine

WORKDIR /var/www/html

COPY . .

RUN chown www-data:www-data -R /var/www/html

# install packages for php
#RUN apk add --no-cache bzip2-dev curl-dev libxml2-dev enchant-2

# install php extensions
RUN docker-php-ext-install bcmath sockets pdo_mysql
# ctype \
# json \
# mbstring \
# openssl \
# pdo \
# tokenizer \
# xml

RUN apk add --no-cache pcre-dev $PHPIZE_DEPS && pecl install redis && docker-php-ext-enable redis.so

# install composer
RUN EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
RUN if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then >&2 echo 'ERROR: Invalid installer checksum' && rm composer-setup.php && exit 1; fi
RUN php composer-setup.php --quiet
RUN rm composer-setup.php

# install php dependencies
RUN php composer.phar install

# install nodejs
RUN apk add --no-cache nodejs npm

# install node dependencies
RUN npm install

# build application
# RUN npm run production

# install roadrunner
COPY --from=spiralscout/roadrunner:latest /usr/bin/rr /usr/bin/rr

# configure roadrunner
RUN php artisan octane:install --server=roadrunner

ENV ROADRUNNER_MAX_REQUESTS=512
ENV ROADRUNNER_WORKERS="auto"

EXPOSE 8000

CMD php artisan octane:start --server="roadrunner" --host="0.0.0.0" --workers=${ROADRUNNER_WORKERS} --max-requests=${ROADRUNNER_MAX_REQUESTS}

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD php artisan octane:status --server="roadrunner"
Loading

0 comments on commit 7fa866b

Please sign in to comment.