-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mysql | ||
spec: | ||
ports: | ||
- port: 3306 | ||
selector: | ||
app: mysql | ||
clusterIP: None | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mysql | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: mysql | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: mysql | ||
spec: | ||
containers: | ||
- image: mysql:latest | ||
name: mysql | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: password | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql | ||
volumeMounts: | ||
- name: mysql-persistent-storage | ||
mountPath: /var/lib/mysql | ||
volumes: | ||
- name: mysql-persistent-storage | ||
persistentVolumeClaim: | ||
claimName: mysql-pv-claim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: mysql-pv-volume | ||
labels: | ||
type: local | ||
spec: | ||
storageClassName: manual | ||
capacity: | ||
storage: 1Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "/mnt/data" | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: mysql-pv-claim | ||
spec: | ||
storageClassName: manual | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/sh | ||
Red='\033[0;31m' # Red | ||
Green='\033[0;32m' # Green | ||
echo "" | ||
echo "***********************************************************" | ||
echo " Starting LARAVEL PHP-FPM Container " | ||
echo "***********************************************************" | ||
|
||
set -e | ||
|
||
## Check if the artisan file exists | ||
if [ -f /var/www/html/artisan ]; then | ||
echo "${Green} artisan file found, creating laravel supervisor config..." | ||
##Create Laravel Scheduler process | ||
TASK=/etc/supervisor/conf.d/laravel-worker.conf | ||
touch $TASK | ||
cat > "$TASK" <<EOF | ||
[program:Laravel-scheduler] | ||
process_name=%(program_name)s_%(process_num)02d | ||
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done" | ||
autostart=true | ||
autorestart=true | ||
numprocs=1 | ||
user=www-data | ||
stdout_logfile=/var/log/laravel_scheduler.out.log | ||
redirect_stderr=true | ||
[program:Laravel-worker] | ||
process_name=%(program_name)s_%(process_num)02d | ||
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 | ||
autostart=true | ||
autorestart=true | ||
numprocs=$LARAVEL_PROCS_NUMBER | ||
user=www-data | ||
redirect_stderr=true | ||
stdout_logfile=/var/log/laravel_worker.log | ||
EOF | ||
echo "${Green} Laravel supervisor config created" | ||
else | ||
echo "${Red} artisan file not found" | ||
fi | ||
|
||
## Check if the supervisor config file exists | ||
if [ -f /var/www/html/conf/worker/supervisor.conf ]; then | ||
echo "additional supervisor config found" | ||
cp /var/www/html/conf/worker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf | ||
else | ||
echo "${Red} Supervisor.conf not found" | ||
echo "${Green} If you want to add more supervisor configs, create config file in /var/www/html/conf/worker/supervisor.conf" | ||
echo "${Green} Start supervisor with default config..." | ||
fi | ||
## Check if php.ini file exists | ||
if [ -f /var/www/html/conf/php/php.ini ]; then | ||
cp /var/www/html/conf/php/php.ini $PHP_INI_DIR/conf.d/ | ||
echo "Custom php.ini file found and copied in $PHP_INI_DIR/conf.d/" | ||
else | ||
echo "Custom php.ini file not found" | ||
echo "If you want to add a custom php.ini file, you add it in /var/www/html/conf/php/php.ini" | ||
fi | ||
|
||
echo "" | ||
echo "**********************************" | ||
echo " Starting Supervisord... " | ||
echo "***********************************" | ||
supervisord -c /etc/supervisor/supervisord.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes