From 7d750c45087fa8eab442edb2f50675c7be9ecb1b Mon Sep 17 00:00:00 2001 From: Dominik Hebeler <dominik@suma-ev.de> Date: Mon, 19 Aug 2019 09:39:07 +0200 Subject: [PATCH] Added docker deployment and new gitlab-ci --- .env.example | 32 ----- .gitlab-ci.yml | 44 +++---- .gitlab-ci.yml.bak | 29 +++++ Dockerfile | 22 ++++ docker-compose.yml | 27 +++++ package-lock.json | 180 +++++++++++++---------------- readme.md | 43 +------ service-configs/nginx/default.conf | 55 +++++++++ service-configs/nginx/nginx.conf | 32 +++++ service-configs/start.sh | 6 + 10 files changed, 273 insertions(+), 197 deletions(-) delete mode 100644 .env.example create mode 100644 .gitlab-ci.yml.bak create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 service-configs/nginx/default.conf create mode 100644 service-configs/nginx/nginx.conf create mode 100755 service-configs/start.sh diff --git a/.env.example b/.env.example deleted file mode 100644 index 251aeb9..0000000 --- a/.env.example +++ /dev/null @@ -1,32 +0,0 @@ -APP_ENV=local -APP_KEY= -APP_DEBUG=true -APP_LOG_LEVEL=debug -APP_URL=http://localhost - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -SESSION_DRIVER=file -QUEUE_DRIVER=sync - -REDIS_HOST=127.0.0.1 -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_DRIVER=smtp -MAIL_HOST=mailtrap.io -MAIL_PORT=2525 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f03838..d0d5e55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,15 @@ -# This file is a template, and might need editing before it works on your project. -# Full project: https://gitlab.com/pages/plain-html -update(proxy.suma-ev.de): - tags: - - proxy.suma-ev.de - only: - - master@open-source/Proxy - before_script: - # Abhängigkeiten überprüfen - - which composer - - which git - - which php - script: - - if [ -d ~/.Proxy ]; then rm -rf ~/.Proxy;fi - - mkdir ~/.Proxy - - cp -r * ~/.Proxy - - cd ~/.Proxy - - composer install - - npm install - - npm run production - - cp ~/.env . - - touch storage/logs/laravel.log - - chmod -R 777 storage - - chmod -R 777 bootstrap/cache - - if [ -f ~/Proxy/artisan ]; then php ~/Proxy/artisan down;fi - - cd ~/ - - while [ -d ~/Proxy ]; do rm -rf ~/Proxy;done - - mv .Proxy Proxy - - if [ -f ~/Proxy/artisan ]; then php ~/Proxy/artisan up;fi +include: + - template: Auto-DevOps.gitlab-ci.yml + +services: +- redis + +review: + variables: + HELM_UPGRADE_EXTRA_ARGS: --set service.internalPort=80 --set service.commonName= --set ingress.tls.enabled=false --set ingress.annotations.kubernetes\.io/tls-acme="false" --set ingress.annotations.nginx\.ingress\.kubernetes\.io/ssl-redirect="false" + +production: + variables: + HELM_UPGRADE_EXTRA_ARGS: --set service.internalPort=80 --set service.commonName= --set ingress.annotations.certmanager\.k8s\.io/cluster-issuer=letsencrypt-prod + environment: + url: https://proxy.metager.de diff --git a/.gitlab-ci.yml.bak b/.gitlab-ci.yml.bak new file mode 100644 index 0000000..4f03838 --- /dev/null +++ b/.gitlab-ci.yml.bak @@ -0,0 +1,29 @@ +# This file is a template, and might need editing before it works on your project. +# Full project: https://gitlab.com/pages/plain-html +update(proxy.suma-ev.de): + tags: + - proxy.suma-ev.de + only: + - master@open-source/Proxy + before_script: + # Abhängigkeiten überprüfen + - which composer + - which git + - which php + script: + - if [ -d ~/.Proxy ]; then rm -rf ~/.Proxy;fi + - mkdir ~/.Proxy + - cp -r * ~/.Proxy + - cd ~/.Proxy + - composer install + - npm install + - npm run production + - cp ~/.env . + - touch storage/logs/laravel.log + - chmod -R 777 storage + - chmod -R 777 bootstrap/cache + - if [ -f ~/Proxy/artisan ]; then php ~/Proxy/artisan down;fi + - cd ~/ + - while [ -d ~/Proxy ]; do rm -rf ~/Proxy;done + - mv .Proxy Proxy + - if [ -f ~/Proxy/artisan ]; then php ~/Proxy/artisan up;fi diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..47f7b75 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +From nginx + +RUN apt -y update +RUN apt -y install php-fpm +RUN apt -y install ca-certificates +RUN apt -y install zip +RUN apt -y install php7.3-mbstring +RUN apt -y install php7.3-dom +RUN apt -y install php7.3-zip +RUN apt -y install php7.3-curl + +COPY /service-configs/nginx/default.conf /etc/nginx/conf.d/default.conf + +RUN sed -i 's/listen.owner = www-data/listen.owner = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf +RUN sed -i 's/listen.group = www-data/listen.group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf +RUN sed -i 's/user = www-data/user = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf +RUN sed -i 's/group = www-data/group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf +RUN sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.3/fpm/php.ini + +WORKDIR /html + +CMD /html/service-configs/start.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..36680d9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: '3.7' +services: + phpdeps: + image: composer/composer:latest + volumes: + - .:/app + command: install + assets: + image: node:8 + volumes: + - .:/usr/src/app + working_dir: /usr/src/app + command: bash -c "npm install && chmod -R go+w node_modules && npm run watch" + web: + depends_on: + - "phpdeps" + - "assets" + - "redis" + build: . + working_dir: /html + volumes: + - .:/html + ports: + - "8080:80" + redis: + image: redis + container_name: redis \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 267f8d9..9532d2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4117,23 +4117,21 @@ "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.3.6" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -4146,20 +4144,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4200,7 +4195,7 @@ "dev": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "fs.realpath": { @@ -4215,14 +4210,14 @@ "dev": true, "optional": true, "requires": { - "aproba": "1.2.0", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "glob": { @@ -4231,12 +4226,12 @@ "dev": true, "optional": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "has-unicode": { @@ -4251,7 +4246,7 @@ "dev": true, "optional": true, "requires": { - "safer-buffer": "2.1.2" + "safer-buffer": "^2.1.0" } }, "ignore-walk": { @@ -4260,7 +4255,7 @@ "dev": true, "optional": true, "requires": { - "minimatch": "3.0.4" + "minimatch": "^3.0.4" } }, "inflight": { @@ -4269,15 +4264,14 @@ "dev": true, "optional": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4289,9 +4283,8 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "isarray": { @@ -4304,25 +4297,22 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" } }, "minizlib": { @@ -4331,14 +4321,13 @@ "dev": true, "optional": true, "requires": { - "minipass": "2.2.4" + "minipass": "^2.2.1" } }, "mkdirp": { "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4355,9 +4344,9 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.9", - "iconv-lite": "0.4.21", - "sax": "1.2.4" + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" } }, "node-pre-gyp": { @@ -4366,16 +4355,16 @@ "dev": true, "optional": true, "requires": { - "detect-libc": "1.0.3", - "mkdirp": "0.5.1", - "needle": "2.2.0", - "nopt": "4.0.1", - "npm-packlist": "1.1.10", - "npmlog": "4.1.2", - "rc": "1.2.6", - "rimraf": "2.6.2", - "semver": "5.5.0", - "tar": "4.4.1" + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" } }, "nopt": { @@ -4384,8 +4373,8 @@ "dev": true, "optional": true, "requires": { - "abbrev": "1.1.1", - "osenv": "0.1.5" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npm-bundled": { @@ -4400,8 +4389,8 @@ "dev": true, "optional": true, "requires": { - "ignore-walk": "3.0.1", - "npm-bundled": "1.0.3" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" } }, "npmlog": { @@ -4410,17 +4399,16 @@ "dev": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4432,9 +4420,8 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -4455,8 +4442,8 @@ "dev": true, "optional": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "path-is-absolute": { @@ -4477,10 +4464,10 @@ "dev": true, "optional": true, "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.5", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -4497,13 +4484,13 @@ "dev": true, "optional": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "rimraf": { @@ -4512,7 +4499,7 @@ "dev": true, "optional": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { @@ -4554,11 +4541,10 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { @@ -4567,7 +4553,7 @@ "dev": true, "optional": true, "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { @@ -4575,7 +4561,7 @@ "bundled": true, "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -4590,13 +4576,13 @@ "dev": true, "optional": true, "requires": { - "chownr": "1.0.1", - "fs-minipass": "1.2.5", - "minipass": "2.2.4", - "minizlib": "1.1.0", - "mkdirp": "0.5.1", - "safe-buffer": "5.1.1", - "yallist": "3.0.2" + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" } }, "util-deprecate": { @@ -4611,7 +4597,7 @@ "dev": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { diff --git a/readme.md b/readme.md index 70f23e0..c5bd181 100644 --- a/readme.md +++ b/readme.md @@ -1,40 +1,5 @@ -<p align="center"><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p> +MetaGer - Proxy -<p align="center"> -<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a> -<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a> -<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a> -<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a> -</p> - -## About Laravel - -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: - -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). - -Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked. - -## Learning Laravel - -Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework. - -If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions). - -## Security Vulnerabilities - -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). +## Installation with docker +* `docker run -it --rm --name metager-proxy-npm-install -v "$PWD":/usr/src/app -w /usr/src/app node:8 npm install && npm run prod` +* `docker run --rm -v $(pwd):/app composer/composer:latest install` \ No newline at end of file diff --git a/service-configs/nginx/default.conf b/service-configs/nginx/default.conf new file mode 100644 index 0000000..c2cbb91 --- /dev/null +++ b/service-configs/nginx/default.conf @@ -0,0 +1,55 @@ +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; + #} +} + diff --git a/service-configs/nginx/nginx.conf b/service-configs/nginx/nginx.conf new file mode 100644 index 0000000..a222807 --- /dev/null +++ b/service-configs/nginx/nginx.conf @@ -0,0 +1,32 @@ + +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; +} diff --git a/service-configs/start.sh b/service-configs/start.sh new file mode 100755 index 0000000..1c98575 --- /dev/null +++ b/service-configs/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +/etc/init.d/php7.3-fpm start +/etc/init.d/nginx start + +tail -f /dev/null \ No newline at end of file -- GitLab