mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 09:51:37 +00:00
Making the whole app into one docker image for easier usage (#104)
This commit is contained in:
parent
682da0d6d5
commit
59e8c82e5c
38
.env.docker
Executable file
38
.env.docker
Executable file
@ -0,0 +1,38 @@
|
||||
APP_NAME=Vito
|
||||
APP_ENV=production
|
||||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=vito
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=password
|
||||
|
||||
BROADCAST_DRIVER=null
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=default
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=
|
||||
MAIL_PORT=
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
SSH_PUBLIC_KEY_NAME=ssh-public.key
|
||||
SSH_PRIVATE_KEY_NAME=ssh-private.pem
|
65
Dockerfile
Normal file
65
Dockerfile
Normal file
@ -0,0 +1,65 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN echo "mysql-server mysql-server/root_password password password" | debconf-set-selections
|
||||
RUN echo "mysql-server mysql-server/root_password_again password password" | debconf-set-selections
|
||||
|
||||
# upgrade
|
||||
RUN apt clean && apt update && apt update && apt upgrade -y && apt autoremove -y
|
||||
|
||||
# requirements
|
||||
RUN apt install -y software-properties-common curl zip unzip git gcc
|
||||
|
||||
# nginx
|
||||
RUN apt install -y nginx
|
||||
|
||||
# php
|
||||
RUN apt update \
|
||||
&& apt install -y gnupg gosu curl ca-certificates zip unzip git supervisor libcap2-bin libpng-dev \
|
||||
python2 dnsutils librsvg2-bin fswatch wget \
|
||||
&& add-apt-repository ppa:ondrej/php -y \
|
||||
&& apt update \
|
||||
&& apt install -y php8.1 php8.1-fpm php8.1-mbstring php8.1-mysql php8.1-mcrypt php8.1-gd php8.1-xml \
|
||||
php8.1-curl php8.1-gettext php8.1-zip php8.1-bcmath php8.1-soap php8.1-redis
|
||||
COPY docker/standalone/php.ini /etc/php/8.1/cli/conf.d/99-vito.ini
|
||||
|
||||
# composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# mysql
|
||||
RUN wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb \
|
||||
&& mkdir -p /etc/apt/keyrings \
|
||||
&& apt clean \
|
||||
&& apt update \
|
||||
&& dpkg -i mysql-apt-config_0.8.22-1_all.deb \
|
||||
&& apt install mysql-server -y
|
||||
|
||||
RUN service mysql stop
|
||||
|
||||
# app
|
||||
COPY . /var/www/html
|
||||
RUN rm -rf /var/www/html/vendor
|
||||
RUN rm -rf /var/www/html/.env
|
||||
RUN composer install --no-dev --prefer-dist
|
||||
RUN chown -R www-data:www-data /var/www/html \
|
||||
&& chmod -R 755 /var/www/html/storage /var/www/html/bootstrap/cache
|
||||
|
||||
# webserver
|
||||
RUN rm /etc/nginx/sites-available/default
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
COPY docker/standalone/nginx.conf /etc/nginx/sites-available/default
|
||||
RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
|
||||
|
||||
# supervisord
|
||||
COPY docker/standalone/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# start
|
||||
COPY docker/standalone/start.sh /start.sh
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
EXPOSE 80 3306
|
||||
|
||||
CMD ["/start.sh"]
|
@ -19,7 +19,7 @@
|
||||
"laravel/socialite": "^5.2",
|
||||
"laravel/tinker": "^2.8",
|
||||
"livewire/livewire": "^3.0",
|
||||
"opcodesio/log-viewer": "^2.5",
|
||||
"opcodesio/log-viewer": "^3.0",
|
||||
"owenvoke/blade-fontawesome": "^2.5",
|
||||
"phpseclib/phpseclib": "~3.0"
|
||||
},
|
||||
|
81
composer.lock
generated
81
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "2c898cb3ae37c6267db77c5c95d0f926",
|
||||
"content-hash": "f2e6a21fc0abada9bc40b4e80df42b26",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@ -3570,20 +3570,21 @@
|
||||
},
|
||||
{
|
||||
"name": "opcodesio/log-viewer",
|
||||
"version": "v2.5.6",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opcodesio/log-viewer.git",
|
||||
"reference": "34619b89ec0501222a661863e80dc2c92618d8f3"
|
||||
"reference": "f1d89dc2e54e186f6852533a165fc49a6a83fff8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/opcodesio/log-viewer/zipball/34619b89ec0501222a661863e80dc2c92618d8f3",
|
||||
"reference": "34619b89ec0501222a661863e80dc2c92618d8f3",
|
||||
"url": "https://api.github.com/repos/opcodesio/log-viewer/zipball/f1d89dc2e54e186f6852533a165fc49a6a83fff8",
|
||||
"reference": "f1d89dc2e54e186f6852533a165fc49a6a83fff8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^8.0|^9.0|^10.0",
|
||||
"illuminate/contracts": "^8.0|^9.0|^10.0|^11.0",
|
||||
"opcodesio/mail-parser": "^0.1.6",
|
||||
"php": "^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
@ -3593,11 +3594,10 @@
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"itsgoingd/clockwork": "^5.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"nunomaduro/collision": "^6.0",
|
||||
"orchestra/testbench": "^7.6|^8.0",
|
||||
"pestphp/pest": "^1.21",
|
||||
"pestphp/pest-plugin-laravel": "^1.1",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"nunomaduro/collision": "^7.0|^8.0",
|
||||
"orchestra/testbench": "^7.6|^8.0|^9.0",
|
||||
"pestphp/pest": "^2.0",
|
||||
"pestphp/pest-plugin-laravel": "^2.0",
|
||||
"spatie/test-time": "^1.3"
|
||||
},
|
||||
"suggest": {
|
||||
@ -3642,7 +3642,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/opcodesio/log-viewer/issues",
|
||||
"source": "https://github.com/opcodesio/log-viewer/tree/v2.5.6"
|
||||
"source": "https://github.com/opcodesio/log-viewer/tree/v3.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3654,7 +3654,60 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-09-03T08:22:57+00:00"
|
||||
"time": "2024-02-14T15:14:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "opcodesio/mail-parser",
|
||||
"version": "v0.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/opcodesio/mail-parser.git",
|
||||
"reference": "639ef31cbd146a63416283e75afce152e13233ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/opcodesio/mail-parser/zipball/639ef31cbd146a63416283e75afce152e13233ea",
|
||||
"reference": "639ef31cbd146a63416283e75afce152e13233ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"pestphp/pest": "^2.16",
|
||||
"symfony/var-dumper": "^6.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Opcodes\\MailParser\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Arunas Skirius",
|
||||
"email": "arukomp@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Parse emails without the mailparse extension",
|
||||
"keywords": [
|
||||
"arukompas",
|
||||
"email",
|
||||
"email parser",
|
||||
"mail",
|
||||
"opcodesio",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/opcodesio/mail-parser/issues",
|
||||
"source": "https://github.com/opcodesio/mail-parser/tree/v0.1.6"
|
||||
},
|
||||
"time": "2023-11-19T08:47:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "owenvoke/blade-fontawesome",
|
||||
@ -9903,5 +9956,5 @@
|
||||
"ext-ftp": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Opcodes\LogViewer\Level;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
@ -14,6 +12,8 @@
|
||||
|
||||
'enabled' => env('LOG_VIEWER_ENABLED', true),
|
||||
|
||||
'require_auth_in_production' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Viewer Domain
|
||||
@ -135,6 +135,19 @@
|
||||
'include_files' => [
|
||||
'*.log',
|
||||
'**/*.log',
|
||||
|
||||
// You can include paths to other log types as well, such as apache, nginx, and more.
|
||||
'/var/log/httpd/*',
|
||||
'/var/log/nginx/*',
|
||||
|
||||
// MacOS Apple Silicon logs
|
||||
'/opt/homebrew/var/log/nginx/*',
|
||||
'/opt/homebrew/var/log/httpd/*',
|
||||
'/opt/homebrew/var/log/php-fpm.log',
|
||||
'/opt/homebrew/var/log/postgres*log',
|
||||
'/opt/homebrew/var/log/redis*log',
|
||||
'/opt/homebrew/var/log/supervisor*log',
|
||||
|
||||
// '/absolute/paths/supported',
|
||||
],
|
||||
|
||||
@ -150,6 +163,18 @@
|
||||
// 'my_secret.log'
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Hide unknown files.
|
||||
|--------------------------------------------------------------------------
|
||||
| The include/exclude options above might catch files which are not
|
||||
| logs supported by Log Viewer. In that case, you can hide them
|
||||
| from the UI and API calls by setting this to true.
|
||||
|
|
||||
*/
|
||||
|
||||
'hide_unknown_files' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shorter stack trace filters.
|
||||
@ -165,35 +190,6 @@
|
||||
'/vendor/barryvdh/laravel-debugbar/',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log matching patterns
|
||||
|--------------------------------------------------------------------------
|
||||
| Regexes for matching log files
|
||||
|
|
||||
*/
|
||||
|
||||
'patterns' => [
|
||||
'laravel' => [
|
||||
'log_matching_regex' => '/^\[(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}\.?(\d{6}([\+-]\d\d:\d\d)?)?)\].*/',
|
||||
|
||||
/**
|
||||
* This pattern, used for processing Laravel logs, returns these results:
|
||||
* $matches[0] - the full log line being tested.
|
||||
* $matches[1] - full timestamp between the square brackets (includes microseconds and timezone offset)
|
||||
* $matches[2] - timestamp microseconds, if available
|
||||
* $matches[3] - timestamp timezone offset, if available
|
||||
* $matches[4] - contents between timestamp and the severity level
|
||||
* $matches[5] - environment (local, production, etc)
|
||||
* $matches[6] - log severity (info, debug, error, etc)
|
||||
* $matches[7] - the log text, the rest of the text.
|
||||
*/
|
||||
'log_parsing_regex' => '/^\[(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}\.?(\d{6}([\+-]\d\d:\d\d)?)?)\](.*?(\w+)\.|.*?)('
|
||||
.implode('|', array_filter(Level::caseValues()))
|
||||
.')?: (.*?)( in [\/].*?:[0-9]+)?$/is',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache driver
|
||||
@ -214,4 +210,6 @@
|
||||
*/
|
||||
|
||||
'lazy_scan_chunk_size_in_mb' => 50,
|
||||
|
||||
'strip_extracted_context' => true,
|
||||
];
|
||||
|
28
docker/standalone/nginx.conf
Normal file
28
docker/standalone/nginx.conf
Normal file
@ -0,0 +1,28 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
root /var/www/html/public;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
index index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
}
|
3
docker/standalone/php.ini
Normal file
3
docker/standalone/php.ini
Normal file
@ -0,0 +1,3 @@
|
||||
[PHP]
|
||||
post_max_size = 100M
|
||||
upload_max_filesize = 100M
|
61
docker/standalone/start.sh
Normal file
61
docker/standalone/start.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
INIT_FLAG="/var/www/html/storage/.INIT_ENV"
|
||||
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-"password"}
|
||||
NAME=${NAME:-"vito"}
|
||||
EMAIL=${EMAIL:-"vito@example.com"}
|
||||
PASSWORD=${PASSWORD:-"password"}
|
||||
|
||||
# Check if the flag file does not exist, indicating a first run
|
||||
if [ ! -f "$INIT_FLAG" ]; then
|
||||
echo "First run of the container. Initializing MySQL..."
|
||||
|
||||
# Start MySQL temporarily
|
||||
service mysql start
|
||||
|
||||
# Wait for MySQL to start up completely (may need to adjust the sleep duration)
|
||||
sleep 3
|
||||
|
||||
# Create Database
|
||||
mysql -u root -p`echo password` -e "CREATE DATABASE IF NOT EXISTS vito CHARACTER SET utf8 COLLATE utf8_general_ci;"
|
||||
|
||||
# Change Password
|
||||
mysql -u root -p`echo password` -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MYSQL_ROOT_PASSWORD'; FLUSH PRIVILEGES;"
|
||||
|
||||
cp /var/www/html/.env.docker /var/www/html/.env
|
||||
|
||||
# Modify /var/www/html/.env and set DB_PASSWORD=password to DB_PASSWORD=MYSQL_ROOT_PASSWORD
|
||||
sed -i "s/DB_PASSWORD=password/DB_PASSWORD=$MYSQL_ROOT_PASSWORD/g" /var/www/html/.env
|
||||
|
||||
php /var/www/html/artisan key:generate
|
||||
|
||||
php /var/www/html/artisan migrate --force
|
||||
|
||||
php /var/www/html/artisan user:create "$NAME" "$EMAIL" "$PASSWORD"
|
||||
|
||||
openssl genpkey -algorithm RSA -out /var/www/html/storage/ssh-private.pem
|
||||
chmod 600 /var/www/html/storage/ssh-private.pem
|
||||
ssh-keygen -y -f /var/www/html/storage/ssh-private.pem > /var/www/html/storage/ssh-public.key
|
||||
|
||||
# Create the flag file to indicate completion of initialization tasks
|
||||
touch "$INIT_FLAG"
|
||||
fi
|
||||
|
||||
service mysql start
|
||||
|
||||
service php8.1-fpm start
|
||||
|
||||
service nginx start
|
||||
|
||||
php /var/www/html/artisan migrate --force
|
||||
php /var/www/html/artisan config:clear
|
||||
php /var/www/html/artisan config:cache
|
||||
php /var/www/html/artisan route:clear
|
||||
php /var/www/html/artisan route:cache
|
||||
php /var/www/html/artisan view:clear
|
||||
php /var/www/html/artisan view:cache
|
||||
php /var/www/html/artisan icons:cache
|
||||
|
||||
echo "Vito is running! 🚀"
|
||||
|
||||
/usr/bin/supervisord
|
16
docker/standalone/supervisord.conf
Normal file
16
docker/standalone/supervisord.conf
Normal file
@ -0,0 +1,16 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
redirect_stderr=true
|
||||
|
||||
[program:worker]
|
||||
user=root
|
||||
autostart=1
|
||||
autorestart=1
|
||||
numprocs=1
|
||||
command=/usr/bin/php /var/www/html/artisan queue:work --sleep=3 --backoff=0 --queue=default,ssh,ssh-long --timeout=3600 --tries=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/www/html/storage/logs/worker.log
|
||||
stopwaitsecs=3600
|
2
public/vendor/log-viewer/app.css
vendored
2
public/vendor/log-viewer/app.css
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/log-viewer/app.js
vendored
2
public/vendor/log-viewer/app.js
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/log-viewer/app.js.LICENSE.txt
vendored
2
public/vendor/log-viewer/app.js.LICENSE.txt
vendored
@ -5,6 +5,8 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*! #__NO_SIDE_EFFECTS__ */
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
4
public/vendor/log-viewer/mix-manifest.json
vendored
4
public/vendor/log-viewer/mix-manifest.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"/app.js": "/app.js?id=5f574f36f456b103dffcfa21d5612785",
|
||||
"/app.css": "/app.css?id=b701a4344131bb2c00e9f0b1ef1ab3c1",
|
||||
"/app.js": "/app.js?id=fc139aeb14d759b4a2906fc46d6c8150",
|
||||
"/app.css": "/app.css?id=12c5e78a91987c11d8a0cc04436541e9",
|
||||
"/img/log-viewer-128.png": "/img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166",
|
||||
"/img/log-viewer-32.png": "/img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d",
|
||||
"/img/log-viewer-64.png": "/img/log-viewer-64.png?id=8902d596fc883ca9eb8105bb683568c6"
|
||||
|
Loading…
x
Reference in New Issue
Block a user