Compare commits
14 Commits
ad8200d6d5
...
826cc43b92
Author | SHA1 | Date |
---|---|---|
|
826cc43b92 | |
|
f8d6cf6a92 | |
|
62d6730071 | |
|
4672f96a5f | |
|
9e39842183 | |
|
ddebe7cc3c | |
|
b383a7a515 | |
|
36ea571464 | |
|
81b21f5d7f | |
|
437125b573 | |
|
c0431a6857 | |
|
3bd087f729 | |
|
1d808f0e10 | |
|
1b2df8a59a |
|
@ -1,7 +1,7 @@
|
||||||
APP_NAME="Adrema"
|
APP_NAME="Adrema"
|
||||||
APP_ENV=local
|
APP_ENV=production
|
||||||
APP_KEY=YOUR_APP_KEY
|
APP_KEY=YOUR_APP_KEY
|
||||||
APP_DEBUG=true
|
APP_DEBUG=false
|
||||||
APP_URL=http://localhost:8000
|
APP_URL=http://localhost:8000
|
||||||
APP_MODE=stamm
|
APP_MODE=stamm
|
||||||
|
|
||||||
|
@ -13,3 +13,6 @@ MAIL_PASSWORD=null
|
||||||
MAIL_ENCRYPTION=null
|
MAIL_ENCRYPTION=null
|
||||||
MAIL_FROM_ADDRESS=null
|
MAIL_FROM_ADDRESS=null
|
||||||
MAIL_FROM_NAME=me
|
MAIL_FROM_NAME=me
|
||||||
|
|
||||||
|
DB_PASSWORD=secret_db_password
|
||||||
|
MYSQL_PASSWORD=secret_db_password
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# ------------------------- check for database access -------------------------
|
||||||
|
function wait_for_db {
|
||||||
|
while true; do
|
||||||
|
echo "waiting for Database init"
|
||||||
|
php -r 'new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'");' > /dev/null && return 0
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
su www-data -c 'php artisan horizon' -s /bin/sh
|
|
@ -2,6 +2,8 @@ FROM composer:2.2.7 as composer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN composer install --ignore-platform-reqs --no-dev
|
RUN composer install --ignore-platform-reqs --no-dev
|
||||||
|
RUN php artisan telescope:publish
|
||||||
|
RUN php artisan horizon:publish
|
||||||
|
|
||||||
FROM node:17.9.0-slim as node
|
FROM node:17.9.0-slim as node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -10,9 +12,12 @@ RUN npm install && npm run prod && npm run img && rm -R node_modules
|
||||||
|
|
||||||
FROM nginx:1.21.6-alpine as nginx
|
FROM nginx:1.21.6-alpine as nginx
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --chown=www-data:www-data . /app
|
COPY --from=node /app /app
|
||||||
COPY --chown=www-data:www-data --from=node /app/public /app/public
|
COPY --from=composer /app/public/vendor /app/public/vendor
|
||||||
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
|
COPY ./.docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
RUN cd public && ln -s ../storage/app/public ./storage
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
VOLUME ["/app/storage/app"]
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# --------------------------- ensure appkey is set ----------------------------
|
||||||
|
if [ $APP_KEY = "YOUR_APP_KEY" ]; then
|
||||||
|
echo "----------------------- Keinen APP KEY gefunden. Key wird generiert: $(php artisan key:generate --show) ----------------------- Füge diesen Key als APP_KEY ein ---------------------"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ------------------------- check for database access -------------------------
|
||||||
|
function wait_for_db {
|
||||||
|
while true; do
|
||||||
|
echo "waiting for Database init"
|
||||||
|
php -r 'new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'");' > /dev/null && return 0
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_db
|
||||||
|
|
||||||
|
php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force
|
||||||
|
php artisan migrate --force
|
||||||
|
|
||||||
|
mkdir /app/packages/laravel-nami/.cookies || true
|
||||||
|
mkdir /app/storage/app || true
|
||||||
|
chown -R www-data:www-data /app/packages/laravel-nami/.cookies
|
||||||
|
chown -R www-data:www-data /app/storage/app
|
||||||
|
|
||||||
|
php-fpm -F -R -O
|
|
@ -6,19 +6,29 @@ RUN composer install --ignore-platform-reqs --no-dev
|
||||||
FROM node:17.9.0-slim as node
|
FROM node:17.9.0-slim as node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
RUN npm install && npm run prod && npm run img && rm -R node_modules
|
||||||
RUN npm install && npm run prod && rm -R node_modules
|
|
||||||
|
|
||||||
FROM php:8.1.6-fpm as php
|
FROM php:8.1.6-fpm as php
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip
|
RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip
|
||||||
RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra
|
RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra
|
||||||
RUN docker-php-ext-install pdo_mysql curl gd intl mbstring pcntl
|
RUN docker-php-ext-install pdo_mysql curl gd exif intl mbstring pcntl
|
||||||
RUN pecl install redis && docker-php-ext-enable redis
|
RUN pecl install redis && docker-php-ext-enable redis
|
||||||
COPY --chown=www-data:www-data . /app
|
COPY --chown=www-data:www-data . /app
|
||||||
COPY --chown=www-data:www-data --from=node /app/public /app/public
|
COPY --chown=www-data:www-data --from=node /app/public /app/public
|
||||||
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
|
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
|
||||||
|
|
||||||
|
USER www-data
|
||||||
|
RUN php artisan telescope:publish
|
||||||
|
RUN php artisan horizon:publish
|
||||||
|
|
||||||
|
USER root
|
||||||
|
COPY ./.docker/php-entrypoint /bin/php-entrypoint
|
||||||
|
COPY ./.docker/horizon-entrypoint /bin/horizon-entrypoint
|
||||||
|
|
||||||
|
VOLUME ["/app/packages/laravel-nami/.cookies", "/app/storage/app"]
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
|
|
||||||
CMD ["php-fpm", "-F", "-R", "-O"]
|
CMD /bin/php-entrypoint
|
||||||
|
|
|
@ -3,3 +3,8 @@ data
|
||||||
vendor
|
vendor
|
||||||
public/build
|
public/build
|
||||||
public/vendor
|
public/vendor
|
||||||
|
bootstrap/cache/services.php
|
||||||
|
bootstrap/cache/packages.php
|
||||||
|
bootstrap/cache/routes.php
|
||||||
|
packages/laravel-nami/.cookies
|
||||||
|
app/storage/app
|
||||||
|
|
32
.drone.yml
32
.drone.yml
|
@ -32,7 +32,7 @@ steps:
|
||||||
- apt-get update > /dev/null
|
- apt-get update > /dev/null
|
||||||
- apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip > /dev/null
|
- apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip > /dev/null
|
||||||
- apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra > /dev/null
|
- apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra > /dev/null
|
||||||
- docker-php-ext-install pdo_mysql curl gd intl mbstring pcntl > /dev/null
|
- docker-php-ext-install pdo_mysql curl gd exif intl mbstring pcntl > /dev/null
|
||||||
- pecl install redis && docker-php-ext-enable redis > /dev/null
|
- pecl install redis && docker-php-ext-enable redis > /dev/null
|
||||||
- php artisan migrate
|
- php artisan migrate
|
||||||
- php artisan test
|
- php artisan test
|
||||||
|
@ -63,6 +63,36 @@ steps:
|
||||||
PDFLATEX_BIN: /usr/bin/pdflatex
|
PDFLATEX_BIN: /usr/bin/pdflatex
|
||||||
XELATEX_BIN: /usr/bin/xelatex
|
XELATEX_BIN: /usr/bin/xelatex
|
||||||
|
|
||||||
|
- name: docker_app_push
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
dockerfile: ./.docker/php.Dockerfile
|
||||||
|
repo: zoomyboy/adrema-app
|
||||||
|
username: zoomyboy
|
||||||
|
password:
|
||||||
|
from_secret: docker_hub_token
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_TAG}
|
||||||
|
pull_image: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
|
- name: docker_webservice_push
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
dockerfile: ./.docker/nginx.Dockerfile
|
||||||
|
repo: zoomyboy/adrema-webservice
|
||||||
|
username: zoomyboy
|
||||||
|
password:
|
||||||
|
from_secret: docker_hub_token
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_TAG}
|
||||||
|
pull_image: true
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
- name: composer_no_dev
|
- name: composer_no_dev
|
||||||
image: composer:2.2.7
|
image: composer:2.2.7
|
||||||
commands:
|
commands:
|
||||||
|
|
55
README.md
55
README.md
|
@ -32,31 +32,45 @@ Außerdem ist AdReMa auch problemlos auf Handys und Tablets bedienbar ("mobiles
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
Submodules updaten:
|
## App Key generieren
|
||||||
|
|
||||||
```
|
Kopiere .app.env.example nach .app.env
|
||||||
git submodule update --init
|
|
||||||
```
|
|
||||||
|
|
||||||
Example env erstellen:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cp .app.env.example .app.env
|
cp .app.env.example .app.env
|
||||||
```
|
```
|
||||||
|
|
||||||
Container bauen
|
Services starten:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose build
|
docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
Key generieren
|
Es wird die ein App Key generiert: ``Keinen APP KEY gefunden. Key wird generiert: base64:..........``
|
||||||
|
|
||||||
```
|
Kopiere diesen App key und setze in in .app.env als APP_KEY ein (APP_KEY=base64:........).
|
||||||
docker-compose run php php artisan key:generate --show
|
|
||||||
```
|
|
||||||
|
|
||||||
Ersetze nun "YOUR_APP_KEY" in .app.env mit dem generierten Key (base64:qzX....).
|
## Einstellungen
|
||||||
|
|
||||||
|
Passe in der .app.env dann folgende Einstellungen an:
|
||||||
|
|
||||||
|
### APP_URL
|
||||||
|
|
||||||
|
Hier sollte die URL (mit HTTPS) stehen, unter der Adrema erreichbar sein soll (z.B. https://adrema.stamm-bipi.de)
|
||||||
|
|
||||||
|
### Mail
|
||||||
|
|
||||||
|
Setze nun die Einstellungen für den Mail-Versand ein. Du solltest mindestens MAIL_PORT, MAIL_HOST, MAIL_USERNAME, MAIL_PASSWORD und MAIL_ENCRYPTION setzen.
|
||||||
|
|
||||||
|
MAIL_FROM_NAME ist der Name, der als Absender von E-Mails gesetzt wird. z.B. "Stamm Bipi Service".
|
||||||
|
|
||||||
|
MAIL_FROM_ADDRESS die dazu gehörige E-Mail-Adresse, die natürlich erreichbar sein sollte (z.B. "vorstand@stamm-bipi.de").
|
||||||
|
|
||||||
|
### DB Passwort
|
||||||
|
|
||||||
|
Setze die beiden letzten Variablen (da wo "secret_db_password" steht) auf ein generiertes sicheres Passwort. Bei beiden Variablen muss der gleiche Wert eingestellt werden (also so wie vorher, nur sicherer :D )
|
||||||
|
|
||||||
|
## Starten
|
||||||
|
|
||||||
Führe nun den DB Container aus, um eine erste Version der Datenbank zu erstellen.
|
Führe nun den DB Container aus, um eine erste Version der Datenbank zu erstellen.
|
||||||
|
|
||||||
|
@ -64,24 +78,11 @@ Führe nun den DB Container aus, um eine erste Version der Datenbank zu erstelle
|
||||||
docker-compose up db -d
|
docker-compose up db -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Migrations ausführen
|
|
||||||
|
|
||||||
```
|
|
||||||
docker-compose run php php artisan migrate --seed
|
|
||||||
```
|
|
||||||
|
|
||||||
Alles stoppen, dann alles neu starten
|
|
||||||
|
|
||||||
```
|
|
||||||
docker-compose stop
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
Nun kannst du auf localhost:8000 die App öffnen, einen LB verwenden, den Port mit CLI Optionen ändern, etc.
|
Nun kannst du auf localhost:8000 die App öffnen, einen LB verwenden, den Port mit CLI Optionen ändern, etc.
|
||||||
|
|
||||||
## Standard Login
|
## Standard Login
|
||||||
|
|
||||||
Wenn du die Seeder ausführst ("--seed", siehe oben), wird ein Benutzer mit folgenden Zugangsdaten erstellt:
|
Beim ersten Starten wird ein Benutzer mit folgenden Zugangsdaten erstellt:
|
||||||
|
|
||||||
* E-Mail-Adresse: admin@example.com
|
* E-Mail-Adresse: admin@example.com
|
||||||
* Passwort: admin
|
* Passwort: admin
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
webservice:
|
||||||
|
image: zoomyboy/adrema-webservice:latest
|
||||||
|
depends_on:
|
||||||
|
- php
|
||||||
|
ports:
|
||||||
|
- '8000:80'
|
||||||
|
volumes:
|
||||||
|
- ./data/storage:/app/storage/app
|
||||||
|
|
||||||
|
php:
|
||||||
|
image: zoomyboy/adrema-app:latest
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
env_file:
|
||||||
|
- .app.env
|
||||||
|
environment:
|
||||||
|
DB_HOST: db
|
||||||
|
DB_DATABASE: db
|
||||||
|
DB_USERNAME: db
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
XELATEX_BIN: /usr/bin/xelatex
|
||||||
|
PDFLATEX_BIN: /usr/bin/pdflatex
|
||||||
|
REDIS_HOST: redis
|
||||||
|
volumes:
|
||||||
|
- ./data/storage:/app/storage/app
|
||||||
|
- ./cookies:/app/packages/laravel-nami/.cookies
|
||||||
|
|
||||||
|
horizon:
|
||||||
|
image: zoomyboy/adrema-app:latest
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- php
|
||||||
|
command: /bin/horizon-entrypoint
|
||||||
|
env_file:
|
||||||
|
- .app.env
|
||||||
|
environment:
|
||||||
|
DB_HOST: db
|
||||||
|
DB_DATABASE: db
|
||||||
|
DB_USERNAME: db
|
||||||
|
QUEUE_CONNECTION: redis
|
||||||
|
XELATEX_BIN: /usr/bin/xelatex
|
||||||
|
PDFLATEX_BIN: /usr/bin/pdflatex
|
||||||
|
REDIS_HOST: redis
|
||||||
|
volumes:
|
||||||
|
- ./data/storage:/app/storage/app
|
||||||
|
- ./cookies:/app/packages/laravel-nami/.cookies
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:10.6.5
|
||||||
|
env_file:
|
||||||
|
- .app.env
|
||||||
|
environment:
|
||||||
|
MARIADB_RANDOM_ROOT_PASSWORD: yes
|
||||||
|
MYSQL_DATABASE: db
|
||||||
|
MYSQL_USER: db
|
||||||
|
volumes:
|
||||||
|
- ./data/db:/var/lib/mysql
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:alpine3.18
|
||||||
|
container_name: redis
|
|
@ -4,51 +4,47 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./.docker/nginx.Dockerfile
|
dockerfile: ./.docker/nginx.Dockerfile
|
||||||
image: nginx:1.21.6-alpine
|
|
||||||
container_name: nginx
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- php
|
||||||
ports:
|
ports:
|
||||||
- '8000:80'
|
- '8000:80'
|
||||||
volumes:
|
volumes:
|
||||||
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
- ./data/storage:/app/storage/app
|
||||||
|
|
||||||
php:
|
php:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./.docker/php.Dockerfile
|
dockerfile: ./.docker/php.Dockerfile
|
||||||
container_name: php
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
command: php-fpm -F -R
|
|
||||||
env_file:
|
env_file:
|
||||||
- .app.env
|
- .app.env
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: db
|
DB_HOST: db
|
||||||
DB_DATABASE: db
|
DB_DATABASE: db
|
||||||
DB_USERNAME: db
|
DB_USERNAME: db
|
||||||
DB_PASSWORD: secret
|
|
||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
XELATEX_BIN: /usr/bin/xelatex
|
XELATEX_BIN: /usr/bin/xelatex
|
||||||
PDFLATEX_BIN: /usr/bin/pdflatex
|
PDFLATEX_BIN: /usr/bin/pdflatex
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
|
volumes:
|
||||||
|
- ./data/storage:/app/storage/app
|
||||||
|
- ./cookies:/app/packages/laravel-nami/.cookies
|
||||||
|
|
||||||
horizon:
|
horizon:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./.docker/php.Dockerfile
|
dockerfile: ./.docker/php.Dockerfile
|
||||||
container_name: horizon
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- php
|
- php
|
||||||
command: php artisan horizon
|
command: /bin/horizon-entrypoint
|
||||||
env_file:
|
env_file:
|
||||||
- .app.env
|
- .app.env
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: db
|
DB_HOST: db
|
||||||
DB_DATABASE: db
|
DB_DATABASE: db
|
||||||
DB_USERNAME: db
|
DB_USERNAME: db
|
||||||
DB_PASSWORD: secret
|
|
||||||
QUEUE_CONNECTION: redis
|
QUEUE_CONNECTION: redis
|
||||||
XELATEX_BIN: /usr/bin/xelatex
|
XELATEX_BIN: /usr/bin/xelatex
|
||||||
PDFLATEX_BIN: /usr/bin/pdflatex
|
PDFLATEX_BIN: /usr/bin/pdflatex
|
||||||
|
@ -56,10 +52,10 @@ services:
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mariadb:10.6.5
|
image: mariadb:10.6.5
|
||||||
container_name: db
|
env_file:
|
||||||
|
- .app.env
|
||||||
environment:
|
environment:
|
||||||
MARIADB_ROOT_PASSWORD: secret_root_password
|
MARIADB_RANDOM_ROOT_PASSWORD: yes
|
||||||
MYSQL_PASSWORD: secret
|
|
||||||
MYSQL_DATABASE: db
|
MYSQL_DATABASE: db
|
||||||
MYSQL_USER: db
|
MYSQL_USER: db
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in New Issue