mirror of
https://github.com/anna-sara/vbytes_lan.git
synced 2025-12-23 21:17:12 +01:00
Compare commits
2 commits
19c995ad66
...
00dac42e2c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00dac42e2c | ||
|
|
2eaf312f25 |
11 changed files with 38 additions and 220 deletions
|
|
@ -1,8 +1,8 @@
|
|||
FROM php:8.2-apache
|
||||
FROM php:8.2-apache-buster
|
||||
RUN usermod -u 1000 www-data
|
||||
RUN a2enmod rewrite
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg2 zlib1g-dev libzip-dev zlib1g-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libxml2-dev libicu-dev
|
||||
&& apt-get install -y gnupg2 zlib1g-dev libzip-dev zlib1g-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libxml2-dev
|
||||
RUN docker-php-ext-install zip mysqli pdo pdo_mysql && docker-php-ext-enable mysqli pdo pdo_mysql sodium
|
||||
RUN docker-php-ext-configure gd
|
||||
RUN docker-php-ext-install gd
|
||||
|
|
@ -159,7 +159,7 @@ class ParticipantsTable
|
|||
->action(function (array $data, Participant $record) {
|
||||
$mailContent = Mailtemplate::where('id', $data['mailtemplate'])->get();
|
||||
Mail::to($record->guardian_email)
|
||||
->send(new LanMail($mailContent, $record));
|
||||
->queue(new LanMail($mailContent, $record));
|
||||
Participant::where('id', $record->id)->update(['emailed' => true]);
|
||||
})
|
||||
->hidden(fn($record) => !$record->emailed)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class VolunteersTable
|
|||
->action(function (array $data, Volunteer $record) {
|
||||
$mailContent = Mailtemplate::where('id', $data['mailtemplate'])->get();
|
||||
Mail::to($record->email)
|
||||
->send(new LanMail($mailContent, $record));
|
||||
->queue(new LanMail($mailContent, $record));
|
||||
Volunteer::where('id', $record->id)->update(['emailed' => true]);
|
||||
})
|
||||
->hidden(fn($record) => $record->emailed),
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@ class ApiToken
|
|||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->api_token === config('apikeys.key_1')) {
|
||||
if ($request->header('X-API-KEY') === config('apikeys.key_1')) {
|
||||
|
||||
$request->merge(["permission" => "key_1"]);
|
||||
|
||||
} elseif ($request->api_token === config('apikeys.key_2')) {
|
||||
} elseif ($request->header('X-API-KEY') === config('apikeys.key_2')) {
|
||||
|
||||
$request->merge(["permission" => "key_2"]);
|
||||
|
||||
} elseif ($request->api_token === config('apikeys.key_3')) {
|
||||
} elseif ($request->header('X-API-KEY') === config('apikeys.key_3')) {
|
||||
|
||||
$request->merge(["permission" => "key_3"]);
|
||||
|
||||
} elseif ($request->api_token === config('apikeys.key_4')) {
|
||||
} elseif ($request->header('X-API-KEY') === config('apikeys.key_4')) {
|
||||
|
||||
$request->merge(["permission" => "key_4"]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
services:
|
||||
web:
|
||||
image: laravel-www
|
||||
container_name: laravel-www
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/dev/Dockerfile
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
depends_on:
|
||||
- db
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
CONTAINER_ROLE: app
|
||||
networks:
|
||||
- app
|
||||
db:
|
||||
container_name: laravel-mysql
|
||||
image: "mariadb"
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||
volumes:
|
||||
- "mysql:/var/lib/mysql"
|
||||
networks:
|
||||
- app
|
||||
queue:
|
||||
image: laravel-www
|
||||
container_name: laravel-queue
|
||||
depends_on:
|
||||
- web
|
||||
- db
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
networks:
|
||||
- app
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV}
|
||||
CONTAINER_ROLE: queue
|
||||
CACHE_STORE: ${CACHE_STORE}
|
||||
SESSION_DRIVER: ${SESSION_DRIVER}
|
||||
QUEUE_CONNECTION: ${QUEUE_CONNECTION}
|
||||
networks:
|
||||
app:
|
||||
driver: bridge
|
||||
volumes:
|
||||
mysql:
|
||||
driver: local
|
||||
|
|
@ -1,52 +1,31 @@
|
|||
services:
|
||||
web:
|
||||
image: laravel-www
|
||||
container_name: laravel-www
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/php/Dockerfile
|
||||
depends_on:
|
||||
- db
|
||||
api:
|
||||
image: php
|
||||
build: .
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
CONTAINER_ROLE: app
|
||||
networks:
|
||||
- app
|
||||
db:
|
||||
container_name: laravel-mysql
|
||||
image: "mariadb"
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: "password"
|
||||
MYSQL_DATABASE: "vbytes_lan"
|
||||
MYSQL_USER: "root"
|
||||
MYSQL_PASSWORD: "password"
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||
volumes:
|
||||
- "mysql:/var/lib/mysql"
|
||||
- "appdb:/var/lib/mysql"
|
||||
networks:
|
||||
- app
|
||||
queue:
|
||||
image: laravel-www
|
||||
container_name: laravel-queue
|
||||
depends_on:
|
||||
- web
|
||||
- db
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
networks:
|
||||
- app
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV}
|
||||
CONTAINER_ROLE: queue
|
||||
CACHE_STORE: ${CACHE_STORE}
|
||||
SESSION_DRIVER: ${SESSION_DRIVER}
|
||||
QUEUE_CONNECTION: ${QUEUE_CONNECTION}
|
||||
networks:
|
||||
app:
|
||||
driver: bridge
|
||||
volumes:
|
||||
mysql:
|
||||
appdb:
|
||||
driver: local
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
<VirtualHost *:80>
|
||||
DocumentRoot /var/www/html/public
|
||||
|
||||
<Directory "/var/www/html/public">
|
||||
AllowOverride all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
FROM php:8.4-apache
|
||||
|
||||
|
||||
## Copy the entire Laravel application code into the container
|
||||
COPY . /var/www/html
|
||||
|
||||
# Apache vhost & entry script
|
||||
COPY docker/apache/default.conf /etc/apache2/sites-available/000-default.conf
|
||||
COPY docker/scripts/start.sh /usr/local/bin/start
|
||||
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/html \
|
||||
&& chmod u+x /usr/local/bin/start \
|
||||
&& a2enmod rewrite
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg2 zlib1g-dev libzip-dev zlib1g-dev libicu-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libxml2-dev curl unzip
|
||||
RUN docker-php-ext-install zip mysqli pdo pdo_mysql && docker-php-ext-enable mysqli pdo pdo_mysql sodium
|
||||
RUN docker-php-ext-configure gd
|
||||
RUN docker-php-ext-install gd
|
||||
RUN docker-php-ext-configure intl
|
||||
RUN docker-php-ext-install intl
|
||||
|
||||
# Install Node.js and build tools
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
nodejs \
|
||||
npm \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Add Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& composer install --no-interaction --no-progress
|
||||
|
||||
# Install Node.js dependencies and build assets
|
||||
RUN npm install && npm run build
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
CMD ["/usr/local/bin/start"]
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
role=${CONTAINER_ROLE:-app}
|
||||
env=${APP_ENV:-production}
|
||||
|
||||
chown -R www-data:www-data /var/www/html
|
||||
chmod -R 775 /var/www/html/storage
|
||||
chmod -R 775 /var/www/html/bootstrap/cache
|
||||
|
||||
if [ ! -d "/var/www/html/vendor" ]; then
|
||||
composer install --no-interaction --no-progress
|
||||
fi
|
||||
|
||||
if [ -f "/var/www/html/.env" ]; then
|
||||
if ! grep -q "^APP_KEY=" .env || grep -q "^APP_KEY=$" .env; then
|
||||
php artisan key:generate
|
||||
fi
|
||||
fi
|
||||
|
||||
#if [ "${RUN_MIGRATIONS:-false}" = "true" ]; then
|
||||
#php artisan migrate --force
|
||||
#fi
|
||||
|
||||
if [ "$env" != "local" ]; then
|
||||
echo "Caching configuration..."
|
||||
(cd /var/www/html &&
|
||||
php artisan optimize &&
|
||||
php artisan filament:optimize &&
|
||||
php artisan config:cache &&
|
||||
php artisan route:cache &&
|
||||
php artisan view:cache)
|
||||
fi
|
||||
|
||||
|
||||
if [ "$role" = "app" ]; then
|
||||
|
||||
exec apache2-foreground
|
||||
|
||||
elif [ "$role" = "queue" ]; then
|
||||
|
||||
echo "Running the queue..."
|
||||
php /var/www/html/artisan queue:work --verbose --tries=3 --timeout=90
|
||||
|
||||
elif [ "$role" = "scheduler" ]; then
|
||||
|
||||
echo "Scheduler role"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo "Could not match the container role \"$role\""
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
## Endpoints
|
||||
|
||||
<details>
|
||||
<summary><code>GET</code> <code><b>/data/{api_token}</b></code></summary>
|
||||
<summary><code>GET</code> <code><b>/data</b></code></summary>
|
||||
|
||||
##### Parameters
|
||||
##### Headers
|
||||
|
||||
> | name | type | data type | description |
|
||||
> |-------------|------------|----------------|--------------------------------------------------------------|
|
||||
> | `api_token` | required | string | Api key with permission |
|
||||
> | `x-api-key` | required | string | Api key with permission |
|
||||
|
||||
|
||||
##### Responses
|
||||
|
|
@ -124,13 +124,13 @@
|
|||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>GET</code> <code><b>/version/{api_token}</b></code></summary>
|
||||
<summary><code>GET</code> <code><b>/version</b></code></summary>
|
||||
|
||||
##### Parameters
|
||||
##### Headers
|
||||
|
||||
> | name | type | data type | description |
|
||||
> |-------------|------------|----------------|--------------------------------------------------------------|
|
||||
> | `api_token` | required | string | Api key with permission |
|
||||
> | `x-api-key` | required | string | Api key with permission |
|
||||
|
||||
##### Responses
|
||||
|
||||
|
|
@ -181,13 +181,13 @@
|
|||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>POST</code> <code><b>/participant/{api_token}</b></code></summary>
|
||||
<summary><code>POST</code> <code><b>/participant</b></code></summary>
|
||||
|
||||
##### Parameters
|
||||
##### Headers
|
||||
|
||||
> | name | type | data type | description |
|
||||
> |-------------|-----------|-------------------------|-----------------------------------------------------------------------|
|
||||
> | `api_token` | required | string | Api key with permission |
|
||||
> | `x-api-key` | required | string | Api key with permission |
|
||||
|
||||
##### Body data
|
||||
|
||||
|
|
@ -237,13 +237,13 @@
|
|||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>POST</code> <code><b>/volunteer/{api_token}</b></code></summary>
|
||||
<summary><code>POST</code> <code><b>/volunteer</b></code></summary>
|
||||
|
||||
##### Parameters
|
||||
##### Headers
|
||||
|
||||
> | name | type | data type | description |
|
||||
> |-------------|-----------|-------------------------|-----------------------------------------------------------------------|
|
||||
> | `api_token` | required | string | Api key with permission |
|
||||
> | `x-api-key` | required | string | Api key with permission |
|
||||
|
||||
|
||||
##### Body data
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ use App\Http\Controllers\VersionController;
|
|||
// return $request->user();
|
||||
//})->middleware('auth:sanctum');
|
||||
|
||||
Route::get('/data/{api_token}', [ParticipantController::class, 'index'] )->middleware([ApiToken::class]);
|
||||
Route::get('/data', [ParticipantController::class, 'index'] )->middleware([ApiToken::class]);
|
||||
|
||||
Route::get('/version/{api_token}', [VersionController::class, 'index'] )->middleware([ApiToken::class]);
|
||||
Route::get('/version', [VersionController::class, 'index'] )->middleware([ApiToken::class]);
|
||||
|
||||
Route::post('/participant/{api_token}', [ParticipantController::class, 'store'] )->middleware([ApiToken::class]);
|
||||
Route::post('/participant', [ParticipantController::class, 'store'] )->middleware([ApiToken::class]);
|
||||
|
||||
Route::post('/volunteer/{api_token}', [VolunteerController::class, 'store'] )->middleware([ApiToken::class]);
|
||||
Route::post('/volunteer', [VolunteerController::class, 'store'] )->middleware([ApiToken::class]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue