Skip to content

Commit

Permalink
Merge pull request #722 from fsr5-fhaachen/dev
Browse files Browse the repository at this point in the history
release version 3.0.0
  • Loading branch information
simonostendorf authored Sep 16, 2024
2 parents 80de761 + 840fdcc commit 323175b
Show file tree
Hide file tree
Showing 163 changed files with 6,022 additions and 6,637 deletions.
17 changes: 15 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_TIMEZONE=UTC
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
APP_FORCE_HTTPS=false
APP_EVENT_TYPE=demo

Expand All @@ -12,6 +20,7 @@ TUTOR_PASSWORD=password
ADMIN_PASSWORD=admin

LOG_CHANNEL=stack
LOG_STACK=single
LOG_LEVEL=debug

DB_CONNECTION=mysql
Expand All @@ -21,12 +30,15 @@ DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
BROADCAST_CONNECTION=log
CACHE_STORE=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

MEMCACHED_HOST=127.0.0.1

Expand Down Expand Up @@ -60,5 +72,6 @@ VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
OCTANE_HTTPS=false
OCTANE_WORKERS=4
OCTANE_MAX_REQUESTS=512
OCTANE_SERVER=frankenphp

DIVISION_DEBUG_LOG=
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:

strategy:
matrix:
php-version: ["8.1"]
node-version: [16.x]
php-version: ["8.3"]
node-version: [20.x]

steps:
- name: Checkout
Expand All @@ -23,7 +23,7 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.8.1
uses: actions/setup-node@v4.0.3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
Expand All @@ -36,7 +36,7 @@ jobs:
npm ci
- name: Execute Node.js linting
run: |
npm run lint
npm run lint
- name: Execute PHP linting
run: |
./vendor/bin/pint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Delete untagged images
uses: actions/delete-package-versions@v4
uses: actions/delete-package-versions@v5
with:
package-name: "portals"
package-type: "container"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: false
load: true
Expand All @@ -34,8 +34,8 @@ jobs:
ADMIN_PASSWORD=admin
LOG_CHANNEL=stack
LOG_LEVEL=debug
BROADCAST_DRIVER=log
CACHE_DRIVER=file # TODO
BROADCAST_CONNECTION=log
CACHE_STORE=file # TODO
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file # TODO
Expand All @@ -49,7 +49,7 @@ jobs:
OCTANE_SERVER=roadrunner
EOF
- name: Run Image
uses: isbang/compose-action@v1.5.1
uses: isbang/compose-action@v2.0.1
with:
compose-file: "docker-compose.yaml"
down-flags: "--volumes"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ jobs:
repository: ${{ github.repository }}
excludes: prerelease, draft
- name: Docker Login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (latest release)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'release' && steps.latest_release.outputs.release == github.ref_name }} # run only on latest release
with:
push: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:${{ env.IMAGE_TAG }}, ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:latest
- name: Build and push (release)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'release' && steps.latest_release.outputs.release != github.ref_name }} # run only on release (not latest)
with:
push: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_PATH }}:${{ env.IMAGE_TAG }}
- name: Build and push (push)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
if: ${{ github.event_name == 'push' }} # run only on push (to dev)
with:
push: true
Expand Down
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# app files
tutors.csv
students.csv
telegram.csv

# deployment
deployOwn/

# build files
public/build/*

# dev files
laravel.sql
.php-cs-fixer.cache
Expand Down Expand Up @@ -393,4 +397,8 @@ $RECYCLE.BIN/

# End of https://www.toptal.com/developers/gitignore/api/node,phpunit,laravel,visualstudiocode,jetbrains+all,windows,macos,linux,gitrr
.rr.yaml
rr
rr

*/caddy
frankenphp
frankenphp-worker.php
83 changes: 83 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Contribution Guidelines

This file contains all relevant information about contributing to this repository.
Please read it carefully before contributing.

## Tooling

We are using the following tools.
These are only recommendations and not mandatory.

- [Visual Studio Code](https://code.visualstudio.com/) (for configuration see [`settings.json`](./.vscode/settings.json) and [`extensions.json`](./.vscode/extensions.json))
- PostgreSQL, MariaDB or other DB that works with Laravel
- PHP
- Webserver (Apache, Nginx, Roadrunner, ...)
- Composer
- Node.js
- TypeScript
- ...

> [!TIP]
> If you don't want to setup your own environment, you can use the provided [DevContainer](#devcontainer).
### DevContainer

If you want to use Visual Studio Code, all of our tooling, preinstalled extensions and configured settings you can use the provided [DevContainer](./.devcontainer).

To use the DevContainer you need to install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.

## Branches

This repository has two "relevant" branches: `main` and `dev`.

Every pull-request that implements a feature, fix or other changes must be created from the `dev` branch. The target branch of the pull request must also be the `dev` branch.

### Branch Naming

Every branch should follow the following pattern:

- `feat/*` for new features
- `fix/*` for bug fixes

and so on. You can find more information about the possible types in the [Commits](#commits) section.

Every branch should only target one issue or feature.

## Commits

We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for our commits.
Every commit must follow this pattern.

The commit message is split into different parts:

- **Commit type**. (e.g. `feat`, `fix`, `chore`, `ci`, `test`, ...)
- **Changed module/component** in brackets. If you want to target a sub module/component you can add it after the module/component and separate it with a slash `/`.
Example: `(devcontainer)` or `(tests/e2e)`. If no module/component fits, you can leave this part out completely.
Please don't use `*` as module/component or add empty brackets `()`.
- **A colon `:`** to separate the type and module/component from the commit message.
- **Commit message**. All messages must be in english and follow the conventions of the conventional commits standard.
They must be written in the imperative, present tense. Example: "change" not "changed" nor "changes". The first letter should not be capitalized.

The resulting commit message should look like this:

- `feat(devcontainer): add documentation`
- `fix: remove typo`

## Pull Requests

If you have completed your development on a branch, you have to create a pull request.
The pull request must be pointed against the `dev` branch (see [Branches](#branches)).

The pull request title should be in the same pattern as the commit messages (see [Commits](#commits)), because the pull request title is used as the merge commit message.

Please update the labels of the PR accordingly.

After submitting the pull request, it will be reviewed and if everything is fine, it will be merged into the `dev` branch.

Every change to the `dev` branch will be merged to the `main` branch later on.

## Releases

We are using [Semantic Versioning](https://semver.org/) for our releases.

Releases are created from the `main` branch.
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# STAGE 1.1: Build JS with node
# --------------------------------------------

FROM ghcr.io/roadrunner-server/roadrunner:2023.3.2 AS roadrunner
FROM node:16-alpine as node
FROM node:20-alpine AS node
WORKDIR /app

# install dependencies (only copy package lock here to use docker caching)
Expand All @@ -15,8 +14,8 @@ COPY ["vite.config.js", "./"]
COPY ["./resources/js/", "./resources/js/"]
COPY ["./resources/css/", "./resources/css/"]
COPY ["./resources/views/", "./resources/view/"]
COPY ["postcss.config.js", "./"]
COPY ["tailwind.config.js", "./"]
COPY ["postcss.config.cjs", "./"]
COPY ["tailwind.config.cjs", "./"]
COPY ["./database", "./database"]

# build project
Expand All @@ -26,12 +25,14 @@ RUN npm run build
# STAGE 1.2: Setup PHP and Dependencies
# --------------------------------------------

FROM php:8.1-cli-alpine as php
FROM dunglas/frankenphp:1-php8.3-alpine AS frankenphp
LABEL maintainer="FSR5 FH-Aachen"
WORKDIR /var/www/html

# use workfir from frankenphp container
WORKDIR /app

# install php extensions
RUN apk add libpq-dev
RUN apk add libpq-dev linux-headers
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
RUN docker-php-ext-install bcmath pdo_mysql pdo pdo_pgsql pgsql pcntl sockets
RUN apk add --no-cache pcre-dev $PHPIZE_DEPS && pecl install redis && docker-php-ext-enable redis.so
Expand Down Expand Up @@ -63,15 +64,14 @@ COPY --from=node ["/app/public/css/", "./public/css/"]
RUN mkdir -p /app/storage/logs
RUN chmod -R 777 ./storage

# install and configure roadrunner
COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr
RUN php artisan octane:install --server=roadrunner
# install and configure frankenphp
#COPY --from=frankenphp /usr/local/bin/frankenphp /usr/local/bin/frankenphp

ENV ROADRUNNER_MAX_REQUESTS=512
ENV ROADRUNNER_WORKERS="auto"
ENV FRANKENPHP_MAX_REQUESTS=512
ENV FRANKENPHP_WORKERS="auto"

EXPOSE 8000

CMD php artisan octane:start 2>&1 /dev/null || php artisan octane:start --server="roadrunner" --host="0.0.0.0" --workers=${ROADRUNNER_WORKERS} --max-requests=${ROADRUNNER_MAX_REQUESTS}
CMD php artisan octane:frankenphp --host="0.0.0.0" --workers=${FRANKENPHP_WORKERS} --max-requests=${FRANKENPHP_MAX_REQUESTS}

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD php artisan octane:status --server="roadrunner"
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD php artisan octane:status
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,25 @@ npm run dev

If you want to use the provided devcontainer via laravel sail you need vscode and the devcontainer extension.

#### intial devcontainer setup

if you want to setup the devcontainer without installing tools to your host system, you can use the following steps:

1. Install sail with `docker run --rm -it -v $PWD:/app bitnami/laravel -- composer install`
2. Start the devcontainer, if you get the error message `groupadd: invalid group ID 'sail'`, add `WWWGROUP=1000` and `WWWUSER=1000` to your `.env` file and restart the devcontainer
3. Start the devcontainer, delete the `/vendor` folder (because the step before downloaded the dependencies with the root user. this can cause permission errors later) and rerun `composer install` with the "sail" user in the devcontainer
4. Run the mandatory setup (set app key (see [install](#install)), add db host to `.env` (in this case use `DB_CONNECTION=pgsql, DB_HOST=pgsql, DB_PORT=5432` and insert your `DB_USERNAME` and `DB_PASSWORD`) and run `npm install`, `php artisan migrate:fresh --seed` and `npm run dev`).

### type generation

To generate the typescript types for the frontend, run:

> [!WARNING]
> The command output changed with update to Laravel 11.x.
> Please verify the output before using.
```sh
php artisan typescript:generate
php artisan types:generate --namespace="App.Models" --outputDir="./resources/js/types/"
```

### linting
Expand Down Expand Up @@ -113,9 +126,9 @@ npm run build

### production

This project uses laravel octane with roadrunner as production server. You can install the server with:
This project uses laravel octane with frankenphp (roadrunner in earlier releases) as production server. You can install the server with:

This step will also ask you to download the roadrunner binary.
This step will also ask you to download the frankenphp (roadrunner in earlier releases) binary.

```sh
php artisan octane:install
Expand Down Expand Up @@ -151,7 +164,7 @@ If you want information about creating the kubernetes cluster, see [deploy infor

👤 **Titus Kirch (main author)**

- Website: https://tkirch.dev/
- Website: https://kirch.dev/
- LinkedIn: [Titus Kirch](https://www.linkedin.com/in/tituskirch/)
- Twitter: [@TitusKirch](https://twitter.com/TitusKirch)
- GitHub: [@TitusKirch](https://github.com/TitusKirch)
Expand All @@ -161,8 +174,9 @@ If you want information about creating the kubernetes cluster, see [deploy infor
- LinkedIn: [Benedikt Haas](https://www.linkedin.com/in/benedikt-haas-ab698924a/)
- GitHub: [@BenediktHaas96](https://github.com/BenediktHaas96)

👤 **Simon Ostendorf**
👤 **Simon Ostendorf (main author)**

- Website: https://simon-ostendorf.de/
- LinkedIn: [Simon Ostendorf](https://www.linkedin.com/in/simonostendorf/)
- GitHub: [@simonostendorf](https://github.com/simonostendorf)

Expand Down
Loading

0 comments on commit 323175b

Please sign in to comment.