Commit aacd4848 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '29-optimize-pipeline' into 'master'

Resolve "optimize pipeline"

Closes #29

See merge request !28
parents 7786af55 2c85f03c
<?php
return [
'proxy' => [
'host' => env("PROXY_HOST", ""),
"port" => env("PROXY_PORT", ""),
"user" => env("PROXY_USER", ""),
"password" => env("PROXY_PASSWORD", "")
],
];
\ No newline at end of file
version: '3.7'
services:
assets:
image: node:16
user: "1000:1000"
nodejs:
image: proxy/development:latest
restart: always
build:
context: .
dockerfile: Dockerfile
target: development
volumes:
- .:/html
command: bash -c "npm i --cache .npm --prefer-offline && npm run watch"
composer:
image: proxy/development:latest
environment:
- COMPOSER_HOME=/html/.composer
volumes:
- .:/usr/src/app
- .npm:/home/node/.npm
working_dir: /usr/src/app
command: bash -c "npm i --prefer-offline && npm run watch"
- .:/html
command: composer install
phpfpm:
depends_on:
- "assets"
- "redis"
- "nodejs"
restart: on-failure
build:
context: .
dockerfile: DockerfileDev
image: proxy:latest
working_dir: /html
image: proxy/development:latest
user: 1000:1000
volumes:
- .:/html
- ./helpers/entrypoint.sh:/entrypoint.sh
web:
depends_on:
- "phpfpm"
image: proxy:latest
working_dir: /html
- "nodejs"
image: proxy/development:latest
command: nginx
restart: always
user: "1000:1000"
volumes:
- .:/html
- ./config/nginx.conf:/etc/nginx/nginx.conf
- ./config/nginx-default-dev.conf:/etc/nginx/sites-available/default
ports:
- "8080:80"
- "8080:8080"
redis:
image: redis:5.0.3-alpine
user: "redis:redis"
container_name: redis
worker:
depends_on:
- "phpfpm"
restart: on-failure
image: proxy:latest
working_dir: /html
- "nodejs"
restart: always
image: proxy/development:latest
volumes:
- .:/html
command: "su -s /bin/sh -c 'php artisan requests:fetcher' www-data"
volumes:
node-cache:
\ No newline at end of file
command: "php artisan requests:fetcher"
\ No newline at end of file
#!/bin/sh
set -e
if [ ! -f .env ];
then
cp .env.example .env
php artisan key:generate
fi
php artisan optimize
php-fpm7.4 -F -R
\ No newline at end of file
#!/bin/sh
set -e
NODE_VERSION=v14.17.5
NODE_DISTRO=linux-x64
NODE_URL="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-$NODE_DISTRO.tar.xz"
# Download Nodejs archive
curl -o /tmp/node-$NODE_VERSION-$NODE_DISTRO.tar.xz "$NODE_URL"
tar -xJvf /tmp/node-$NODE_VERSION-$NODE_DISTRO.tar.xz -C /usr/local/lib
mv /usr/local/lib/node-$NODE_VERSION-$NODE_DISTRO /usr/local/lib/nodejs
rm /tmp/node-$NODE_VERSION-$NODE_DISTRO.tar.xz
echo "export PATH=/usr/local/lib/nodejs/bin:$PATH" >> ~/.profile
. ~/.profile
\ No newline at end of file
#!/bin/sh
set -e
mc alias set --path=on --api S3v4 packages $S3_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY
if mc cp packages/$S3_BUCKETNAME/packages.tar /tmp/;
then
tar -xf /tmp/packages.tar
fi
# Install node modules
npm i --cache .npm --prefer-offline --no-audit --progress=false
npm run prod
# Install composer modules
export COMPOSER_HOME=.composer
composer install --no-dev
# Add the new cache to the bucket
tar -cf /tmp/packages.tar .npm .composer
mc cp /tmp/packages.tar packages/$S3_BUCKETNAME/
# Cleanup
rm /tmp/packages.tar
rm -rf .npm .composer
\ No newline at end of file
This diff is collapsed.
......@@ -36,7 +36,7 @@ Route::get('p/{host?}/{path?}', [ProxyController::class, 'proxy'])->name('proxy'
Route::get('{host?}/{path?}', [ProxyController::class, 'proxyPage'])->name('proxy-wrapper-page')->where('host', '[^\.]+(\.[^\.]+)+')->where('path', '(.*)');
Route::post('{host?}/{path?}', function (Request $request) {
if (env("APP_ENV", "") !== "production") {
if (App::environment() !== "production") {
$validatedData = $request->validate([
'url' => 'required|url|max:255',
]);
......
server {
listen 80;
server_name localhost;
root /html/public;
index index.php index.html index.htm;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
user nginx;
worker_processes 100;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
include /etc/nginx/conf.d/*.conf;
}
#!/bin/bash
# Set the redis hostname
sed -i "s/REDIS_HOST=/REDIS_HOST=${REDIS_SERVICE_NAME}.${POD_NAMESPACE}/g" .env
/etc/init.d/php7.3-fpm start
/etc/init.d/nginx start
tail -f /dev/null
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment