├── .dockerignore ├── .gitignore ├── README.md ├── infrastructure ├── certs │ └── nginx │ │ └── .gitkeep ├── helm │ └── sf │ │ ├── .helmignore │ │ ├── Chart.yaml │ │ ├── charts │ │ └── postgresql-3.13.1.tgz │ │ ├── requirements.yaml │ │ ├── templates │ │ ├── _helpers.tpl │ │ ├── sf-deployment.yaml │ │ └── sf-service.yaml │ │ └── values.yaml ├── kubernetes │ └── tiller-sa.yaml ├── nginx │ ├── Dockerfile │ ├── nginx.conf │ └── symfony_prod.conf └── php-fpm │ ├── Dockerfile │ ├── symfony.ini │ ├── symfony.pool.conf │ └── xdebug.ini ├── run ├── build.sh ├── down.sh ├── info.sh ├── ksync.sh ├── pg_tunnel.sh ├── registry.sh └── up.sh └── symfony ├── .env.test ├── .gitignore ├── README.md ├── assets ├── css │ └── app.css └── js │ └── app.js ├── bin ├── console └── phpunit ├── composer.json ├── composer.lock ├── config ├── bootstrap.php ├── bundles.php ├── packages │ ├── assets.yaml │ ├── cache.yaml │ ├── dev │ │ ├── debug.yaml │ │ ├── easy_log_handler.yaml │ │ ├── monolog.yaml │ │ ├── routing.yaml │ │ ├── swiftmailer.yaml │ │ └── web_profiler.yaml │ ├── doctrine.yaml │ ├── doctrine_migrations.yaml │ ├── framework.yaml │ ├── prod │ │ ├── doctrine.yaml │ │ └── monolog.yaml │ ├── routing.yaml │ ├── security.yaml │ ├── sensio_framework_extra.yaml │ ├── swiftmailer.yaml │ ├── test │ │ ├── framework.yaml │ │ ├── monolog.yaml │ │ ├── routing.yaml │ │ ├── swiftmailer.yaml │ │ ├── validator.yaml │ │ └── web_profiler.yaml │ ├── translation.yaml │ ├── twig.yaml │ ├── validator.yaml │ └── webpack_encore.yaml ├── routes.yaml ├── routes │ ├── annotations.yaml │ └── dev │ │ ├── twig.yaml │ │ └── web_profiler.yaml └── services.yaml ├── package.json ├── phpunit.xml.dist ├── public ├── images │ └── sf.png └── index.php ├── src ├── Controller │ ├── .gitignore │ └── DefaultController.php ├── Entity │ ├── .gitignore │ └── Product.php ├── Kernel.php ├── Migrations │ └── .gitignore └── Repository │ └── .gitignore ├── symfony.lock ├── templates ├── Default │ └── main.html.twig └── base.html.twig ├── tests └── .gitignore ├── translations └── .gitignore ├── webpack.config.js └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | symfony/vendor 2 | symfony/cache 3 | symfony/var -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /symfony/.env 3 | **/.DS_Store 4 | /infrastructure/certs/nginx/* 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Kim Wüstkamp 2 | www.wuestkamp.com 3 | 4 | # Kubernetes Symfony Local Development Environment 5 | This repo was created alongside the articles on https://medium.com/@wuestkamp 6 | 7 | 8 | ## setup 9 | ``` 10 | kubectl create -f infrastructure/kubernetes/tiller-sa.yaml 11 | helm init --service-account tiller --upgrade 12 | ./run/registry.sh 13 | ./run/build.sh 14 | ./run/up.sh 15 | ./run/ksync.sh 16 | ``` 17 | 18 | ## Part 1 19 | checkout branch part1 20 | 21 | https://medium.com/@wuestkamp/symfony4-kubernetes-local-development-environment-1-simple-construct-b444e596967 22 | 23 | ### in short 24 | First we need a local container repository, run with: 25 | 26 | `run/registry.sh` 27 | 28 | Build the containers: `run/build.sh` 29 | 30 | Setup the Kubernetes objects: `run/up.sh` 31 | 32 | View info about the cluster: `run/info.sh` 33 | 34 | Then call http://localhost in your browser 35 | 36 | Delete Kubernetes objects: `run/down.sh` 37 | 38 | ## Part 2 39 | checkout branch part2 40 | 41 | https://medium.com/@wuestkamp/symfony4-kubernetes-local-development-environment-2-looking-at-speed-issues-a61955927e69 42 | 43 | We were looking in setting up code syncing via volume shares with different options. 44 | 45 | ## Part 3 46 | checkout branch part3 47 | 48 | https://medium.com/@wuestkamp/symfony4-kubernetes-local-development-environment-3-ksync-510deb161da3 49 | 50 | We did setup Ksync so solve the volume-share speed issues form part 2 51 | 52 | ## Part 4 53 | checkout branch part4 54 | 55 | https://medium.com/devopslinks/symfony4-kubernetes-local-development-environment-4-helm-37c395aea400 56 | 57 | We did setup Helm so switch nicely between local development and production deployment. 58 | 59 | ## Part 5 60 | checkout branch part5 61 | 62 | https://medium.com/@wuestkamp/symfony4-kubernetes-local-development-environment-5-postgresql-https-xdebug-5f408b548665 63 | 64 | We did setup Postgresql, HTTP for Nginx and Xdebug 65 | 66 | ## Part 6 67 | 68 | coming up... 69 | -------------------------------------------------------------------------------- /infrastructure/certs/nginx/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/infrastructure/certs/nginx/.gitkeep -------------------------------------------------------------------------------- /infrastructure/helm/sf/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /infrastructure/helm/sf/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: A Helm chart for Symfony Kubernetes 4 | name: sf 5 | version: 0.1.0 6 | -------------------------------------------------------------------------------- /infrastructure/helm/sf/charts/postgresql-3.13.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/infrastructure/helm/sf/charts/postgresql-3.13.1.tgz -------------------------------------------------------------------------------- /infrastructure/helm/sf/requirements.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: postgresql 3 | version: 3.13.1 4 | repository: https://kubernetes-charts.storage.googleapis.com/ 5 | condition: postgresql.enabled -------------------------------------------------------------------------------- /infrastructure/helm/sf/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{- define "pod.id" -}} 2 | {{- if eq .Values.environment "dev" -}} 3 | {{- default "sf-pod" -}} 4 | {{- else -}} 5 | {{- printf "sf-pod-%s" .Chart.Version -}} 6 | {{- end -}} 7 | {{- end -}} 8 | 9 | {{- define "deployment.id" -}} 10 | {{- if eq .Values.environment "dev" -}} 11 | {{- default "sf-deployment" -}} 12 | {{- else -}} 13 | {{- printf "sf-deployment-%s" .Chart.Version -}} 14 | {{- end -}} 15 | {{- end -}} -------------------------------------------------------------------------------- /infrastructure/helm/sf/templates/sf-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: {{ template "deployment.id" . }} 5 | labels: 6 | id: {{ template "deployment.id" . }} 7 | annotations: 8 | environment: {{ .Values.environment }} 9 | spec: 10 | replicas: {{ .Values.replicas }} 11 | selector: 12 | matchLabels: 13 | id: {{ template "pod.id" . }} 14 | template: 15 | metadata: 16 | labels: 17 | id: {{ template "pod.id" . }} 18 | spec: 19 | restartPolicy: Always 20 | hostAliases: 21 | - ip: {{ .Values.localhost }} 22 | hostnames: 23 | - "docker-host.localhost" 24 | volumes: 25 | - name: secret-volume 26 | secret: 27 | secretName: nginxsecret 28 | {{ if ne .Values.environment "dev" }} 29 | # we create one shared volume for the symfony assets so nginx and php can access those 30 | - name: sf-public 31 | emptyDir: {} 32 | {{ end }} 33 | {{ if eq .Values.php.xdebug true }} 34 | - name: php-xdebug-config 35 | configMap: 36 | name: php-xdebug-config 37 | {{ end }} 38 | 39 | {{ if ne .Values.environment "dev" }} 40 | initContainers: 41 | # this container is of same image as our php container, its executed to initialise our pod. 42 | # it will mount the shared volume sf-public and copy the (already compiled) symfony assets into it 43 | - name: init 44 | image: {{ .Values.php.image }} 45 | imagePullPolicy: {{ .Values.php.imagePullPolicy }} 46 | volumeMounts: 47 | - mountPath: /tmp/sf-public 48 | name: sf-public 49 | command: ['sh', '-c', 'cp -r /var/www/symfony/public/* /tmp/sf-public/; true;'] 50 | {{ end }} 51 | 52 | containers: 53 | # the nginx container, it mounts the shared volume to provide assets directly via http response 54 | - image: {{ .Values.nginx.image }} 55 | imagePullPolicy: {{ .Values.nginx.imagePullPolicy }} 56 | name: nginx 57 | ports: 58 | - containerPort: 80 59 | - containerPort: 443 60 | volumeMounts: 61 | - mountPath: /etc/nginx/ssl 62 | name: secret-volume 63 | readOnly: true 64 | {{ if ne .Values.environment "dev" }} 65 | - mountPath: /var/www/symfony/public 66 | name: sf-public 67 | {{ end }} 68 | 69 | # the php container 70 | - image: {{ .Values.php.image }} 71 | imagePullPolicy: {{ .Values.php.imagePullPolicy }} 72 | name: php 73 | env: 74 | - name: APP_ENV 75 | value: {{ .Values.php.symfony.appEnv }} 76 | - name: DATABASE_URL 77 | value: {{ .Values.php.symfony.databaseUrl }} 78 | - name: PHP_POD_NAME 79 | valueFrom: 80 | fieldRef: 81 | fieldPath: metadata.name 82 | volumeMounts: 83 | {{ if ne .Values.environment "dev" }} 84 | - mountPath: /var/www/symfony/public 85 | name: sf-public 86 | {{ end }} 87 | {{ if eq .Values.php.xdebug true }} 88 | - mountPath: /etc/php7/conf.d/xdebug.ini 89 | name: php-xdebug-config 90 | subPath: xdebug.ini 91 | {{ end }} -------------------------------------------------------------------------------- /infrastructure/helm/sf/templates/sf-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: sf-service 5 | spec: 6 | ports: 7 | - name: "80" 8 | port: 80 9 | targetPort: 80 10 | - name: "443" 11 | port: 443 12 | targetPort: 443 13 | selector: 14 | id: {{ template "pod.id" . }} # label of our pod 15 | type: LoadBalancer 16 | -------------------------------------------------------------------------------- /infrastructure/helm/sf/values.yaml: -------------------------------------------------------------------------------- 1 | replicas: 1 2 | environment: dev 3 | localhost: 192.168.0.234 4 | 5 | php: 6 | symfony: 7 | appEnv: dev 8 | databaseUrl: pgsql://pg:abcdef@sf-postgresql:5432/symfony 9 | image: localhost:5000/wuestkamp_php:latest 10 | imagePullPolicy: Always 11 | xdebug: true 12 | 13 | nginx: 14 | image: localhost:5000/wuestkamp_nginx:latest 15 | imagePullPolicy: Always 16 | 17 | postgresql: 18 | enabled: true 19 | postgresqlUsername: pg 20 | postgresqlPassword: abcdef 21 | postgresqlDatabase: symfony 22 | persistence: 23 | enabled: true -------------------------------------------------------------------------------- /infrastructure/kubernetes/tiller-sa.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: tiller 5 | namespace: kube-system 6 | --- 7 | apiVersion: rbac.authorization.k8s.io/v1beta1 8 | kind: ClusterRoleBinding 9 | metadata: 10 | name: tiller 11 | roleRef: 12 | apiGroup: rbac.authorization.k8s.io 13 | kind: ClusterRole 14 | name: cluster-admin 15 | subjects: 16 | - kind: ServiceAccount 17 | name: tiller 18 | namespace: kube-system -------------------------------------------------------------------------------- /infrastructure/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.8 2 | 3 | MAINTAINER Kim Wüstkamp 4 | 5 | RUN apk add --update nginx 6 | RUN rm -rf /var/cache/apk/* && rm -rf /tmp/* 7 | 8 | ARG build_path 9 | 10 | ADD $build_path/nginx.conf /etc/nginx/ 11 | ADD $build_path/symfony_prod.conf /etc/nginx/conf.d/ 12 | 13 | RUN rm /etc/nginx/conf.d/default.conf 14 | 15 | RUN adduser -D -g '' -G www-data www-data 16 | 17 | RUN mkdir /etc/nginx/ssl 18 | 19 | CMD ["nginx"] 20 | 21 | EXPOSE 80 -------------------------------------------------------------------------------- /infrastructure/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /run/nginx.pid; 4 | 5 | events { 6 | worker_connections 2048; 7 | multi_accept on; 8 | use epoll; 9 | } 10 | 11 | http { 12 | server_tokens off; 13 | sendfile on; 14 | tcp_nopush on; 15 | tcp_nodelay on; 16 | keepalive_timeout 15; 17 | types_hash_max_size 2048; 18 | include /etc/nginx/mime.types; 19 | default_type application/octet-stream; 20 | access_log off; 21 | error_log off; 22 | gzip on; 23 | gzip_disable "msie6"; 24 | include /etc/nginx/conf.d/*.conf; 25 | include /etc/nginx/sites-enabled/*; 26 | open_file_cache max=100; 27 | client_body_temp_path /tmp 1 2; 28 | client_body_buffer_size 256k; 29 | client_body_in_file_only off; 30 | } 31 | 32 | daemon off; 33 | -------------------------------------------------------------------------------- /infrastructure/nginx/symfony_prod.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name _; 3 | listen 80; 4 | listen [::]:80; 5 | listen 443 default_server ssl; 6 | listen [::]:443 default_server ssl; 7 | 8 | ssl_certificate /etc/nginx/ssl/tls.crt; 9 | ssl_certificate_key /etc/nginx/ssl/tls.key; 10 | 11 | root /var/www/symfony/public; 12 | 13 | location / { 14 | try_files $uri @rewriteapp; 15 | } 16 | 17 | location @rewriteapp { 18 | rewrite ^(.*)$ /index.php/$1 last; 19 | } 20 | 21 | location ~ ^/index\.php(/|$) { 22 | fastcgi_pass 127.0.0.1:9000; 23 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 24 | include fastcgi_params; 25 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 26 | fastcgi_param HTTPS off; 27 | } 28 | 29 | error_log /var/log/nginx/symfony_error.log; 30 | access_log /var/log/nginx/symfony_access.log; 31 | } 32 | -------------------------------------------------------------------------------- /infrastructure/php-fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.3.3-fpm-alpine3.9 2 | 3 | LABEL maintainer="Kim Wuestkamp " 4 | 5 | RUN apk add --update \ 6 | php7-fpm \ 7 | php7-apcu \ 8 | php7-ctype \ 9 | php7-curl \ 10 | php7-dom \ 11 | php7-gd \ 12 | php7-iconv \ 13 | php7-imagick \ 14 | php7-json \ 15 | php7-intl \ 16 | php7-mcrypt \ 17 | php7-fileinfo\ 18 | php7-mbstring \ 19 | php7-opcache \ 20 | php7-openssl \ 21 | php7-pdo \ 22 | php7-pdo_mysql \ 23 | php7-mysqli \ 24 | php7-xml \ 25 | php7-zlib \ 26 | php7-phar \ 27 | php7-tokenizer \ 28 | php7-session \ 29 | php7-simplexml \ 30 | php7-xdebug \ 31 | libzip-dev \ 32 | php7-zip \ 33 | postgresql-dev \ 34 | postgresql-client \ 35 | make \ 36 | curl \ 37 | shadow 38 | 39 | RUN docker-php-ext-install pdo pdo_pgsql zip 40 | 41 | RUN usermod -u 1000 www-data 42 | RUN groupmod -g 1000 www-data 43 | 44 | RUN rm -rf /var/cache/apk/* && rm -rf /tmp/* && \ 45 | curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer 46 | 47 | ARG build_path 48 | 49 | ADD $build_path/symfony.ini /etc/php7/conf.d/ 50 | ADD $build_path/symfony.ini /etc/php7/cli/conf.d/ 51 | #ADD $build_path/xdebug.ini /etc/php7/conf.d/ 52 | 53 | RUN rm /etc/php7/php-fpm.d/www.conf 54 | ADD $build_path/symfony.pool.conf /etc/php7/php-fpm.d/ 55 | 56 | CMD ["php-fpm7", "-F"] 57 | 58 | WORKDIR /var/www/symfony 59 | 60 | # Install composer packages (by starting with coping only composer file, to make use of docker layering feature) 61 | COPY symfony/composer.json symfony/composer.lock ./ 62 | RUN composer install 63 | 64 | COPY symfony . 65 | 66 | RUN rm -rf var/cache 67 | RUN rm -rf var/log 68 | RUN mkdir -p var/log var/cache 69 | RUN chown -R www-data:www-data var 70 | RUN chmod -R 777 var -------------------------------------------------------------------------------- /infrastructure/php-fpm/symfony.ini: -------------------------------------------------------------------------------- 1 | date.timezone = UTC 2 | -------------------------------------------------------------------------------- /infrastructure/php-fpm/symfony.pool.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'symfony'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('symfony' here) 4 | [symfony] 5 | 6 | ; Unix user/group of processes 7 | ; Note: The user is mandatory. If the group is not set, the default user's group 8 | ; will be used. 9 | user = www-data 10 | group = www-data 11 | 12 | ; The address on which to accept FastCGI requests. 13 | ; Valid syntaxes are: 14 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 15 | ; a specific port; 16 | ; 'port' - to listen on a TCP socket to all addresses on a 17 | ; specific port; 18 | ; '/path/to/unix/socket' - to listen on a unix socket. 19 | ; Note: This value is mandatory. 20 | listen = 127.0.0.1:9000 21 | 22 | ; Choose how the process manager will control the number of child processes. 23 | ; Possible Values: 24 | ; static - a fixed number (pm.max_children) of child processes; 25 | ; dynamic - the number of child processes are set dynamically based on the 26 | ; following directives. With this process management, there will be 27 | ; always at least 1 children. 28 | ; pm.max_children - the maximum number of children that can 29 | ; be alive at the same time. 30 | ; pm.start_servers - the number of children created on startup. 31 | ; pm.min_spare_servers - the minimum number of children in 'idle' 32 | ; state (waiting to process). If the number 33 | ; of 'idle' processes is less than this 34 | ; number then some children will be created. 35 | ; pm.max_spare_servers - the maximum number of children in 'idle' 36 | ; state (waiting to process). If the number 37 | ; of 'idle' processes is greater than this 38 | ; number then some children will be killed. 39 | ; ondemand - no children are created at startup. Children will be forked when 40 | ; new requests will connect. The following parameter are used: 41 | ; pm.max_children - the maximum number of children that 42 | ; can be alive at the same time. 43 | ; pm.process_idle_timeout - The number of seconds after which 44 | ; an idle process will be killed. 45 | ; Note: This value is mandatory. 46 | pm = dynamic 47 | 48 | ; The number of child processes to be created when pm is set to 'static' and the 49 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 50 | ; This value sets the limit on the number of simultaneous requests that will be 51 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 52 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 53 | ; CGI. The below defaults are based on a server without much resources. Don't 54 | ; forget to tweak pm.* to fit your needs. 55 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 56 | ; Note: This value is mandatory. 57 | pm.max_children = 20 58 | 59 | ; The number of child processes created on startup. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 62 | pm.start_servers = 2 63 | 64 | ; The desired minimum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.min_spare_servers = 1 68 | 69 | ; The desired maximum number of idle server processes. 70 | ; Note: Used only when pm is set to 'dynamic' 71 | ; Note: Mandatory when pm is set to 'dynamic' 72 | pm.max_spare_servers = 3 73 | 74 | ;--------------------- 75 | 76 | ; Make specific Docker environment variables available to PHP 77 | env[APP_ENV] = $APP_ENV 78 | env[DATABASE_URL] = $DATABASE_URL 79 | env[PHP_POD_NAME] = $PHP_POD_NAME 80 | 81 | catch_workers_output = yes 82 | 83 | -------------------------------------------------------------------------------- /infrastructure/php-fpm/xdebug.ini: -------------------------------------------------------------------------------- 1 | zend_extension=xdebug.so 2 | 3 | [Xdebug] 4 | xdebug.remote_enable=true 5 | xdebug.remote_port=9000 6 | xdebug.remote_host=docker-host.localhost -------------------------------------------------------------------------------- /run/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONTAINER_REPO="localhost:5000" 4 | CONTAINER_PHP=$CONTAINER_REPO/wuestkamp_php 5 | CONTAINER_NGINX=$CONTAINER_REPO/wuestkamp_nginx 6 | 7 | yarn --cwd symfony install 8 | yarn --cwd symfony encore dev 9 | 10 | docker build -t $CONTAINER_PHP:latest -f infrastructure/php-fpm/Dockerfile --build-arg build_path=infrastructure/php-fpm . #--no-cache 11 | docker build -t $CONTAINER_NGINX:latest -f infrastructure/nginx/Dockerfile --build-arg build_path=infrastructure/nginx . #--no-cache 12 | 13 | docker push $CONTAINER_PHP:latest 14 | docker push $CONTAINER_NGINX:latest 15 | -------------------------------------------------------------------------------- /run/down.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | helm del --purge sf -------------------------------------------------------------------------------- /run/info.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | watch "kubectl config current-context; echo ''; kubectl config view | grep namespace; echo ''; kubectl get namespace,node,ingress,pod,svc,job,cronjob,deployment,rs,pv,pvc,secret,configmap,ep -o wide" 4 | -------------------------------------------------------------------------------- /run/ksync.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ksync init 4 | ksync create --selector=id=sf-pod -c php $(pwd)/symfony /var/www/symfony 5 | ksync create --selector=id=sf-pod -c nginx $(pwd)/symfony/public /var/www/symfony/public 6 | ksync watch -------------------------------------------------------------------------------- /run/pg_tunnel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | kubectl port-forward sf-postgresql-0 5432:5432 3 | -------------------------------------------------------------------------------- /run/registry.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker run -d -p 5000:5000 --name registry registry:latest || docker start registry -------------------------------------------------------------------------------- /run/up.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | kubectl create secret tls nginxsecret --key infrastructure/certs/nginx/server.key --cert infrastructure/certs/nginx/server.csr 3 | kubectl create configmap php-xdebug-config --from-file infrastructure/php-fpm/xdebug.ini 4 | 5 | if [ "$1" == "prod" ]; then 6 | helm install --name sf infrastructure/helm/sf --set environment=${1:-dev} --set php.symfony.appEnv=${1:-dev} --set php.xdebug=false 7 | else 8 | helm install --name sf infrastructure/helm/sf --set environment=${1:-dev} --set php.symfony.appEnv=${1:-dev} 9 | fi -------------------------------------------------------------------------------- /symfony/.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='s$cretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | -------------------------------------------------------------------------------- /symfony/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ###> symfony/framework-bundle ### 3 | /.env.local 4 | /.env.local.php 5 | /.env.*.local 6 | /public/bundles/ 7 | /var/ 8 | /vendor/ 9 | ###< symfony/framework-bundle ### 10 | 11 | ###> symfony/phpunit-bridge ### 12 | .phpunit 13 | /phpunit.xml 14 | ###< symfony/phpunit-bridge ### 15 | 16 | ###> symfony/web-server-bundle ### 17 | /.web-server-pid 18 | ###< symfony/web-server-bundle ### 19 | public/assets/.DS_Store public/assets/images/.DS_Store 20 | 21 | ###> symfony/webpack-encore-bundle ### 22 | /node_modules/ 23 | /public/build/ 24 | npm-debug.log 25 | yarn-error.log 26 | ###< symfony/webpack-encore-bundle ### 27 | -------------------------------------------------------------------------------- /symfony/README.md: -------------------------------------------------------------------------------- 1 | `yarn encore dev` 2 | -------------------------------------------------------------------------------- /symfony/assets/css/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: lightskyblue; 3 | } 4 | -------------------------------------------------------------------------------- /symfony/assets/js/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Welcome to your app's main JavaScript file! 3 | * 4 | * We recommend including the built version of this JavaScript file 5 | * (and its CSS file) in your base layout (base.html.twig). 6 | */ 7 | 8 | // any CSS you require will output into a single css file (app.css in this case) 9 | require('../css/app.css'); 10 | 11 | // Need jQuery? Install it with "yarn add jquery", then uncomment to require it. 12 | //const $ = require('jquery'); 13 | 14 | console.log('Hello there... JS running.'); 15 | -------------------------------------------------------------------------------- /symfony/bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getParameterOption(['--env', '-e'], null, true)) { 19 | putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); 20 | } 21 | 22 | if ($input->hasParameterOption('--no-debug', true)) { 23 | putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); 24 | } 25 | 26 | require dirname(__DIR__).'/config/bootstrap.php'; 27 | 28 | if ($_SERVER['APP_DEBUG']) { 29 | umask(0000); 30 | 31 | if (class_exists(Debug::class)) { 32 | Debug::enable(); 33 | } 34 | } 35 | 36 | $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); 37 | $application = new Application($kernel); 38 | $application->run($input); 39 | -------------------------------------------------------------------------------- /symfony/bin/phpunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | =1.2) 9 | if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { 10 | $_SERVER += $env; 11 | $_ENV += $env; 12 | } elseif (!class_exists(Dotenv::class)) { 13 | throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); 14 | } else { 15 | // load all the .env files 16 | (new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); 17 | } 18 | 19 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; 20 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; 21 | $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; 22 | -------------------------------------------------------------------------------- /symfony/config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], 6 | Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], 7 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 8 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 9 | Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], 10 | Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], 11 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], 12 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], 13 | Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], 14 | Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], 15 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 16 | Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true], 17 | Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], 18 | ]; 19 | -------------------------------------------------------------------------------- /symfony/config/packages/assets.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | assets: 3 | json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' 4 | -------------------------------------------------------------------------------- /symfony/config/packages/cache.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | cache: 3 | # Put the unique name of your app here: the prefix seed 4 | # is used to compute stable namespaces for cache keys. 5 | #prefix_seed: your_vendor_name/app_name 6 | 7 | # The app cache caches to the filesystem by default. 8 | # Other options include: 9 | 10 | # Redis 11 | #app: cache.adapter.redis 12 | #default_redis_provider: redis://localhost 13 | 14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) 15 | #app: cache.adapter.apcu 16 | 17 | # Namespaced pools use the above "app" backend by default 18 | #pools: 19 | #my.dedicated.cache: ~ 20 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/debug.yaml: -------------------------------------------------------------------------------- 1 | debug: 2 | # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. 3 | # See the "server:dump" command to start a new server. 4 | dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" 5 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/easy_log_handler.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | EasyCorp\EasyLog\EasyLogHandler: 3 | public: false 4 | arguments: ['%kernel.logs_dir%/%kernel.environment%.log'] 5 | 6 | #// FIXME: How to add this configuration automatically without messing up with the monolog configuration? 7 | #monolog: 8 | # handlers: 9 | # buffered: 10 | # type: buffer 11 | # handler: easylog 12 | # channels: ['!event'] 13 | # level: debug 14 | # easylog: 15 | # type: service 16 | # id: EasyCorp\EasyLog\EasyLogHandler 17 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: stream 5 | path: "%kernel.logs_dir%/%kernel.environment%.log" 6 | level: debug 7 | channels: ["!event"] 8 | # uncomment to get logging in your browser 9 | # you may have to allow bigger header sizes in your Web server configuration 10 | #firephp: 11 | # type: firephp 12 | # level: info 13 | #chromephp: 14 | # type: chromephp 15 | # level: info 16 | console: 17 | type: console 18 | process_psr_3_messages: false 19 | channels: ["!event", "!doctrine", "!console"] 20 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | # See https://symfony.com/doc/current/email/dev_environment.html 2 | swiftmailer: 3 | # send all emails to a specific address 4 | #delivery_addresses: ['me@example.com'] 5 | -------------------------------------------------------------------------------- /symfony/config/packages/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: true 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { only_exceptions: false } 7 | -------------------------------------------------------------------------------- /symfony/config/packages/doctrine.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # Adds a fallback DATABASE_URL if the env var is not set. 3 | # This allows you to run cache:warmup even if your 4 | # environment variables are not available yet. 5 | # You should not need to change this value. 6 | env(DATABASE_URL): '' 7 | 8 | doctrine: 9 | dbal: 10 | # configure these for your database server 11 | driver: 'pdo_pgsql' 12 | url: '%env(resolve:DATABASE_URL)%' 13 | orm: 14 | auto_generate_proxy_classes: true 15 | naming_strategy: doctrine.orm.naming_strategy.underscore 16 | auto_mapping: true 17 | mappings: 18 | App: 19 | is_bundle: false 20 | type: annotation 21 | dir: '%kernel.project_dir%/src/Entity' 22 | prefix: 'App\Entity' 23 | alias: App 24 | -------------------------------------------------------------------------------- /symfony/config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | dir_name: '%kernel.project_dir%/src/Migrations' 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | namespace: DoctrineMigrations 6 | -------------------------------------------------------------------------------- /symfony/config/packages/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | secret: '%env(APP_SECRET)%' 3 | #default_locale: en 4 | #csrf_protection: true 5 | #http_method_override: true 6 | 7 | # Enables session support. Note that the session will ONLY be started if you read or write from it. 8 | # Remove or comment this section to explicitly disable session support. 9 | session: 10 | handler_id: ~ 11 | cookie_secure: auto 12 | cookie_samesite: lax 13 | 14 | #esi: true 15 | #fragments: true 16 | php_errors: 17 | log: true 18 | -------------------------------------------------------------------------------- /symfony/config/packages/prod/doctrine.yaml: -------------------------------------------------------------------------------- 1 | doctrine: 2 | orm: 3 | auto_generate_proxy_classes: false 4 | metadata_cache_driver: 5 | type: service 6 | id: doctrine.system_cache_provider 7 | query_cache_driver: 8 | type: service 9 | id: doctrine.system_cache_provider 10 | result_cache_driver: 11 | type: service 12 | id: doctrine.result_cache_provider 13 | 14 | services: 15 | doctrine.result_cache_provider: 16 | class: Symfony\Component\Cache\DoctrineProvider 17 | public: false 18 | arguments: 19 | - '@doctrine.result_cache_pool' 20 | doctrine.system_cache_provider: 21 | class: Symfony\Component\Cache\DoctrineProvider 22 | public: false 23 | arguments: 24 | - '@doctrine.system_cache_pool' 25 | 26 | framework: 27 | cache: 28 | pools: 29 | doctrine.result_cache_pool: 30 | adapter: cache.app 31 | doctrine.system_cache_pool: 32 | adapter: cache.system 33 | -------------------------------------------------------------------------------- /symfony/config/packages/prod/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: fingers_crossed 5 | action_level: error 6 | handler: nested 7 | excluded_404s: 8 | # regex: exclude all 404 errors from the logs 9 | - ^/ 10 | nested: 11 | type: stream 12 | path: "%kernel.logs_dir%/%kernel.environment%.log" 13 | level: debug 14 | console: 15 | type: console 16 | process_psr_3_messages: false 17 | channels: ["!event", "!doctrine"] 18 | deprecation: 19 | type: stream 20 | path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" 21 | deprecation_filter: 22 | type: filter 23 | handler: deprecation 24 | max_level: info 25 | channels: ["php"] 26 | -------------------------------------------------------------------------------- /symfony/config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: ~ 4 | utf8: true 5 | -------------------------------------------------------------------------------- /symfony/config/packages/security.yaml: -------------------------------------------------------------------------------- 1 | security: 2 | # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers 3 | providers: 4 | in_memory: { memory: ~ } 5 | firewalls: 6 | dev: 7 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 8 | security: false 9 | main: 10 | anonymous: true 11 | 12 | # activate different ways to authenticate 13 | 14 | # http_basic: true 15 | # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate 16 | 17 | # form_login: true 18 | # https://symfony.com/doc/current/security/form_login_setup.html 19 | 20 | # Easy way to control access for large sections of your site 21 | # Note: Only the *first* access control that matches will be used 22 | access_control: 23 | # - { path: ^/admin, roles: ROLE_ADMIN } 24 | # - { path: ^/profile, roles: ROLE_USER } 25 | -------------------------------------------------------------------------------- /symfony/config/packages/sensio_framework_extra.yaml: -------------------------------------------------------------------------------- 1 | sensio_framework_extra: 2 | router: 3 | annotations: false 4 | -------------------------------------------------------------------------------- /symfony/config/packages/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | url: '%env(MAILER_URL)%' 3 | spool: { type: 'memory' } 4 | -------------------------------------------------------------------------------- /symfony/config/packages/test/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | test: true 3 | session: 4 | storage_id: session.storage.mock_file 5 | -------------------------------------------------------------------------------- /symfony/config/packages/test/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: stream 5 | path: "%kernel.logs_dir%/%kernel.environment%.log" 6 | level: debug 7 | channels: ["!event"] 8 | -------------------------------------------------------------------------------- /symfony/config/packages/test/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /symfony/config/packages/test/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | disable_delivery: true 3 | -------------------------------------------------------------------------------- /symfony/config/packages/test/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | # As of Symfony 4.3 you can disable the NotCompromisedPassword Validator 4 | # disable_not_compromised_password: true 5 | -------------------------------------------------------------------------------- /symfony/config/packages/test/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: false 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { collect: false } 7 | -------------------------------------------------------------------------------- /symfony/config/packages/translation.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | default_locale: '%locale%' 3 | translator: 4 | default_path: '%kernel.project_dir%/translations' 5 | fallbacks: 6 | - '%locale%' 7 | -------------------------------------------------------------------------------- /symfony/config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | debug: '%kernel.debug%' 4 | strict_variables: '%kernel.debug%' 5 | -------------------------------------------------------------------------------- /symfony/config/packages/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | email_validation_mode: html5 4 | -------------------------------------------------------------------------------- /symfony/config/packages/webpack_encore.yaml: -------------------------------------------------------------------------------- 1 | webpack_encore: 2 | # The path where Encore is building the assets. 3 | # This should match Encore.setOutputPath() in webpack.config.js. 4 | output_path: '%kernel.project_dir%/public/build' 5 | 6 | # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) 7 | # Available in version 1.2 8 | #cache: '%kernel.debug%' 9 | -------------------------------------------------------------------------------- /symfony/config/routes.yaml: -------------------------------------------------------------------------------- 1 | #index: 2 | # path: / 3 | # controller: App\Controller\DefaultController::index 4 | -------------------------------------------------------------------------------- /symfony/config/routes/annotations.yaml: -------------------------------------------------------------------------------- 1 | controllers: 2 | resource: ../../src/Controller/ 3 | type: annotation 4 | -------------------------------------------------------------------------------- /symfony/config/routes/dev/twig.yaml: -------------------------------------------------------------------------------- 1 | _errors: 2 | resource: '@TwigBundle/Resources/config/routing/errors.xml' 3 | prefix: /_error 4 | -------------------------------------------------------------------------------- /symfony/config/routes/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler_wdt: 2 | resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' 3 | prefix: /_wdt 4 | 5 | web_profiler_profiler: 6 | resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' 7 | prefix: /_profiler 8 | -------------------------------------------------------------------------------- /symfony/config/services.yaml: -------------------------------------------------------------------------------- 1 | # This file is the entry point to configure your own services. 2 | # Files in the packages/ subdirectory configure your dependencies. 3 | 4 | # Put parameters here that don't need to change on each machine where the app is deployed 5 | # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration 6 | parameters: 7 | locale: 'en' 8 | 9 | services: 10 | # default configuration for services in *this* file 11 | _defaults: 12 | autowire: true # Automatically injects dependencies in your services. 13 | autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. 14 | 15 | # makes classes in src/ available to be used as services 16 | # this creates a service per class whose id is the fully-qualified class name 17 | App\: 18 | resource: '../src/*' 19 | exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' 20 | 21 | # controllers are imported separately to make sure services can be injected 22 | # as action arguments even if you don't extend any base controller class 23 | App\Controller\: 24 | resource: '../src/Controller' 25 | tags: ['controller.service_arguments'] 26 | 27 | # add more service definitions when explicit configuration is needed 28 | # please note that last definitions always *replace* previous ones 29 | -------------------------------------------------------------------------------- /symfony/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@symfony/webpack-encore": "^0.22.0", 4 | "webpack-notifier": "^1.6.0" 5 | }, 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "scripts": { 9 | "dev-server": "encore dev-server", 10 | "dev": "encore dev", 11 | "watch": "encore dev --watch", 12 | "build": "encore production --progress" 13 | }, 14 | "dependencies": { 15 | "jquery": "^3.3.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /symfony/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | tests 19 | 20 | 21 | 22 | 23 | 24 | src 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /symfony/public/images/sf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/public/images/sf.png -------------------------------------------------------------------------------- /symfony/public/index.php: -------------------------------------------------------------------------------- 1 | handle($request); 26 | $response->send(); 27 | $kernel->terminate($request, $response); 28 | -------------------------------------------------------------------------------- /symfony/src/Controller/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/src/Controller/.gitignore -------------------------------------------------------------------------------- /symfony/src/Controller/DefaultController.php: -------------------------------------------------------------------------------- 1 | render('Default/main.html.twig', [ 16 | 'hostname' => getenv('PHP_POD_NAME'), 17 | ]); 18 | } 19 | } -------------------------------------------------------------------------------- /symfony/src/Entity/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/src/Entity/.gitignore -------------------------------------------------------------------------------- /symfony/src/Entity/Product.php: -------------------------------------------------------------------------------- 1 | getProjectDir().'/var/cache/'.$this->environment; 21 | } 22 | 23 | public function getLogDir() 24 | { 25 | return $this->getProjectDir().'/var/log'; 26 | } 27 | 28 | public function registerBundles() 29 | { 30 | $contents = require $this->getProjectDir().'/config/bundles.php'; 31 | foreach ($contents as $class => $envs) { 32 | if ($envs[$this->environment] ?? $envs['all'] ?? false) { 33 | yield new $class(); 34 | } 35 | } 36 | } 37 | 38 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) 39 | { 40 | $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); 41 | $container->setParameter('container.dumper.inline_class_loader', true); 42 | $confDir = $this->getProjectDir().'/config'; 43 | 44 | $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); 45 | $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); 46 | $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); 47 | $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); 48 | } 49 | 50 | protected function configureRoutes(RouteCollectionBuilder $routes) 51 | { 52 | $confDir = $this->getProjectDir().'/config'; 53 | 54 | $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); 55 | $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); 56 | $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /symfony/src/Migrations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/src/Migrations/.gitignore -------------------------------------------------------------------------------- /symfony/src/Repository/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/src/Repository/.gitignore -------------------------------------------------------------------------------- /symfony/symfony.lock: -------------------------------------------------------------------------------- 1 | { 2 | "doctrine/annotations": { 3 | "version": "1.0", 4 | "recipe": { 5 | "repo": "github.com/symfony/recipes", 6 | "branch": "master", 7 | "version": "1.0", 8 | "ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672" 9 | } 10 | }, 11 | "doctrine/cache": { 12 | "version": "v1.8.0" 13 | }, 14 | "doctrine/collections": { 15 | "version": "v1.5.0" 16 | }, 17 | "doctrine/common": { 18 | "version": "v2.10.0" 19 | }, 20 | "doctrine/dbal": { 21 | "version": "v2.9.2" 22 | }, 23 | "doctrine/doctrine-bundle": { 24 | "version": "1.6", 25 | "recipe": { 26 | "repo": "github.com/symfony/recipes", 27 | "branch": "master", 28 | "version": "1.6", 29 | "ref": "453e89b78ded666f351617baca5ae40d20622351" 30 | } 31 | }, 32 | "doctrine/doctrine-cache-bundle": { 33 | "version": "1.3.5" 34 | }, 35 | "doctrine/doctrine-migrations-bundle": { 36 | "version": "1.2", 37 | "recipe": { 38 | "repo": "github.com/symfony/recipes", 39 | "branch": "master", 40 | "version": "1.2", 41 | "ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1" 42 | } 43 | }, 44 | "doctrine/event-manager": { 45 | "version": "v1.0.0" 46 | }, 47 | "doctrine/inflector": { 48 | "version": "v1.3.0" 49 | }, 50 | "doctrine/instantiator": { 51 | "version": "1.1.0" 52 | }, 53 | "doctrine/lexer": { 54 | "version": "v1.0.1" 55 | }, 56 | "doctrine/migrations": { 57 | "version": "v1.8.1" 58 | }, 59 | "doctrine/orm": { 60 | "version": "v2.6.3" 61 | }, 62 | "doctrine/persistence": { 63 | "version": "v1.1.0" 64 | }, 65 | "doctrine/reflection": { 66 | "version": "v1.0.0" 67 | }, 68 | "easycorp/easy-log-handler": { 69 | "version": "1.0", 70 | "recipe": { 71 | "repo": "github.com/symfony/recipes", 72 | "branch": "master", 73 | "version": "1.0", 74 | "ref": "70062abc2cd58794d2a90274502f81b55cd9951b" 75 | } 76 | }, 77 | "egulias/email-validator": { 78 | "version": "2.1.7" 79 | }, 80 | "facebook/webdriver": { 81 | "version": "1.6.0" 82 | }, 83 | "fig/link-util": { 84 | "version": "1.0.0" 85 | }, 86 | "jdorn/sql-formatter": { 87 | "version": "v1.2.17" 88 | }, 89 | "monolog/monolog": { 90 | "version": "1.24.0" 91 | }, 92 | "nikic/php-parser": { 93 | "version": "v4.1.1" 94 | }, 95 | "ocramius/proxy-manager": { 96 | "version": "2.1.1" 97 | }, 98 | "phpdocumentor/reflection-common": { 99 | "version": "1.0.1" 100 | }, 101 | "phpdocumentor/reflection-docblock": { 102 | "version": "4.3.0" 103 | }, 104 | "phpdocumentor/type-resolver": { 105 | "version": "0.4.0" 106 | }, 107 | "psr/cache": { 108 | "version": "1.0.1" 109 | }, 110 | "psr/container": { 111 | "version": "1.0.0" 112 | }, 113 | "psr/link": { 114 | "version": "1.0.0" 115 | }, 116 | "psr/log": { 117 | "version": "1.1.0" 118 | }, 119 | "psr/simple-cache": { 120 | "version": "1.0.1" 121 | }, 122 | "sensio/framework-extra-bundle": { 123 | "version": "5.2", 124 | "recipe": { 125 | "repo": "github.com/symfony/recipes", 126 | "branch": "master", 127 | "version": "5.2", 128 | "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" 129 | } 130 | }, 131 | "swiftmailer/swiftmailer": { 132 | "version": "v6.1.3" 133 | }, 134 | "symfony/asset": { 135 | "version": "v4.2.1" 136 | }, 137 | "symfony/browser-kit": { 138 | "version": "v4.2.1" 139 | }, 140 | "symfony/cache": { 141 | "version": "v4.2.1" 142 | }, 143 | "symfony/config": { 144 | "version": "v4.2.1" 145 | }, 146 | "symfony/console": { 147 | "version": "3.3", 148 | "recipe": { 149 | "repo": "github.com/symfony/recipes", 150 | "branch": "master", 151 | "version": "3.3", 152 | "ref": "0fa049c19069a65f52c1c181d64be3de672c1504" 153 | } 154 | }, 155 | "symfony/contracts": { 156 | "version": "v1.0.2" 157 | }, 158 | "symfony/css-selector": { 159 | "version": "v4.2.1" 160 | }, 161 | "symfony/debug": { 162 | "version": "v4.2.1" 163 | }, 164 | "symfony/debug-bundle": { 165 | "version": "4.1", 166 | "recipe": { 167 | "repo": "github.com/symfony/recipes", 168 | "branch": "master", 169 | "version": "4.1", 170 | "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea" 171 | } 172 | }, 173 | "symfony/debug-pack": { 174 | "version": "v1.0.7" 175 | }, 176 | "symfony/dependency-injection": { 177 | "version": "v4.2.1" 178 | }, 179 | "symfony/doctrine-bridge": { 180 | "version": "v4.2.1" 181 | }, 182 | "symfony/dom-crawler": { 183 | "version": "v4.2.1" 184 | }, 185 | "symfony/dotenv": { 186 | "version": "v4.2.1" 187 | }, 188 | "symfony/event-dispatcher": { 189 | "version": "v4.2.1" 190 | }, 191 | "symfony/expression-language": { 192 | "version": "v4.2.1" 193 | }, 194 | "symfony/filesystem": { 195 | "version": "v4.2.1" 196 | }, 197 | "symfony/finder": { 198 | "version": "v4.2.1" 199 | }, 200 | "symfony/flex": { 201 | "version": "1.0", 202 | "recipe": { 203 | "repo": "github.com/symfony/recipes", 204 | "branch": "master", 205 | "version": "1.0", 206 | "ref": "dc3fc2e0334a4137c47cfd5a3ececc601fa61a0b" 207 | } 208 | }, 209 | "symfony/form": { 210 | "version": "v4.2.1" 211 | }, 212 | "symfony/framework-bundle": { 213 | "version": "4.2", 214 | "recipe": { 215 | "repo": "github.com/symfony/recipes", 216 | "branch": "master", 217 | "version": "4.2", 218 | "ref": "ad330af340e55acbaabccf857f6ae2ab3cef34d6" 219 | } 220 | }, 221 | "symfony/http-foundation": { 222 | "version": "v4.2.1" 223 | }, 224 | "symfony/http-kernel": { 225 | "version": "v4.2.1" 226 | }, 227 | "symfony/inflector": { 228 | "version": "v4.2.1" 229 | }, 230 | "symfony/intl": { 231 | "version": "v4.2.1" 232 | }, 233 | "symfony/maker-bundle": { 234 | "version": "1.0", 235 | "recipe": { 236 | "repo": "github.com/symfony/recipes", 237 | "branch": "master", 238 | "version": "1.0", 239 | "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" 240 | } 241 | }, 242 | "symfony/monolog-bridge": { 243 | "version": "v4.2.1" 244 | }, 245 | "symfony/monolog-bundle": { 246 | "version": "3.1", 247 | "recipe": { 248 | "repo": "github.com/symfony/recipes", 249 | "branch": "master", 250 | "version": "3.1", 251 | "ref": "18ebf5a940573a20de06f9c4060101eeb438cf3d" 252 | } 253 | }, 254 | "symfony/options-resolver": { 255 | "version": "v4.2.1" 256 | }, 257 | "symfony/orm-pack": { 258 | "version": "v1.0.5" 259 | }, 260 | "symfony/panther": { 261 | "version": "v0.2.0" 262 | }, 263 | "symfony/phpunit-bridge": { 264 | "version": "4.1", 265 | "recipe": { 266 | "repo": "github.com/symfony/recipes", 267 | "branch": "master", 268 | "version": "4.1", 269 | "ref": "0e548dd90adba18fabd4ef419b14d361fe4d6c74" 270 | } 271 | }, 272 | "symfony/polyfill-intl-icu": { 273 | "version": "v1.10.0" 274 | }, 275 | "symfony/polyfill-mbstring": { 276 | "version": "v1.10.0" 277 | }, 278 | "symfony/polyfill-php72": { 279 | "version": "v1.10.0" 280 | }, 281 | "symfony/process": { 282 | "version": "v4.2.1" 283 | }, 284 | "symfony/profiler-pack": { 285 | "version": "v1.0.4" 286 | }, 287 | "symfony/property-access": { 288 | "version": "v4.2.1" 289 | }, 290 | "symfony/property-info": { 291 | "version": "v4.2.1" 292 | }, 293 | "symfony/routing": { 294 | "version": "4.2", 295 | "recipe": { 296 | "repo": "github.com/symfony/recipes", 297 | "branch": "master", 298 | "version": "4.2", 299 | "ref": "5374e24d508ba8fd6ba9eb15170255fdb778316a" 300 | } 301 | }, 302 | "symfony/security-bundle": { 303 | "version": "3.3", 304 | "recipe": { 305 | "repo": "github.com/symfony/recipes", 306 | "branch": "master", 307 | "version": "3.3", 308 | "ref": "f8a63faa0d9521526499c0a8f403c9964ecb0527" 309 | } 310 | }, 311 | "symfony/security-core": { 312 | "version": "v4.2.1" 313 | }, 314 | "symfony/security-csrf": { 315 | "version": "v4.2.1" 316 | }, 317 | "symfony/security-guard": { 318 | "version": "v4.2.1" 319 | }, 320 | "symfony/security-http": { 321 | "version": "v4.2.1" 322 | }, 323 | "symfony/serializer": { 324 | "version": "v4.2.1" 325 | }, 326 | "symfony/serializer-pack": { 327 | "version": "v1.0.2" 328 | }, 329 | "symfony/stopwatch": { 330 | "version": "v4.2.1" 331 | }, 332 | "symfony/swiftmailer-bundle": { 333 | "version": "2.5", 334 | "recipe": { 335 | "repo": "github.com/symfony/recipes", 336 | "branch": "master", 337 | "version": "2.5", 338 | "ref": "3db029c03e452b4a23f7fc45cec7c922c2247eb8" 339 | } 340 | }, 341 | "symfony/test-pack": { 342 | "version": "v1.0.5" 343 | }, 344 | "symfony/translation": { 345 | "version": "3.3", 346 | "recipe": { 347 | "repo": "github.com/symfony/recipes", 348 | "branch": "master", 349 | "version": "3.3", 350 | "ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a" 351 | } 352 | }, 353 | "symfony/twig-bridge": { 354 | "version": "v4.2.1" 355 | }, 356 | "symfony/twig-bundle": { 357 | "version": "3.3", 358 | "recipe": { 359 | "repo": "github.com/symfony/recipes", 360 | "branch": "master", 361 | "version": "3.3", 362 | "ref": "369b5b29dc52b2c190002825ae7ec24ab6f962dd" 363 | } 364 | }, 365 | "symfony/validator": { 366 | "version": "4.1", 367 | "recipe": { 368 | "repo": "github.com/symfony/recipes", 369 | "branch": "master", 370 | "version": "4.1", 371 | "ref": "0cdc982334f45d554957a6167e030482795bf9d7" 372 | } 373 | }, 374 | "symfony/var-dumper": { 375 | "version": "v4.2.1" 376 | }, 377 | "symfony/var-exporter": { 378 | "version": "v4.2.1" 379 | }, 380 | "symfony/web-link": { 381 | "version": "v4.2.1" 382 | }, 383 | "symfony/web-profiler-bundle": { 384 | "version": "3.3", 385 | "recipe": { 386 | "repo": "github.com/symfony/recipes", 387 | "branch": "master", 388 | "version": "3.3", 389 | "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6" 390 | } 391 | }, 392 | "symfony/web-server-bundle": { 393 | "version": "3.3", 394 | "recipe": { 395 | "repo": "github.com/symfony/recipes", 396 | "branch": "master", 397 | "version": "3.3", 398 | "ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a" 399 | } 400 | }, 401 | "symfony/webpack-encore-bundle": { 402 | "version": "1.0", 403 | "recipe": { 404 | "repo": "github.com/symfony/recipes", 405 | "branch": "master", 406 | "version": "1.0", 407 | "ref": "1b88cff897d383c45522a457ea9daba85a9b9ab2" 408 | } 409 | }, 410 | "symfony/yaml": { 411 | "version": "v4.2.1" 412 | }, 413 | "twig/twig": { 414 | "version": "v2.6.0" 415 | }, 416 | "webmozart/assert": { 417 | "version": "1.4.0" 418 | }, 419 | "zendframework/zend-code": { 420 | "version": "3.3.1" 421 | }, 422 | "zendframework/zend-eventmanager": { 423 | "version": "3.2.1" 424 | } 425 | } 426 | -------------------------------------------------------------------------------- /symfony/templates/Default/main.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% import _self as self %} 4 | 5 | {% block javascripts %} 6 | {{ encore_entry_script_tags('app') }} 7 | {% endblock %} 8 | 9 | {% block stylesheets %} 10 | {{ encore_entry_link_tags('app') }} 11 | {% endblock %} 12 | 13 | {% block body %} 14 |
15 | 16 |

{{ hostname }}

17 |
18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /symfony/templates/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}Kubernetes Local Development{% endblock %} 6 | {% block stylesheets %}{% endblock %} 7 | 8 | 9 | {% block body %}{% endblock %} 10 | {% block javascripts %}{% endblock %} 11 | 12 | 13 | -------------------------------------------------------------------------------- /symfony/tests/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/tests/.gitignore -------------------------------------------------------------------------------- /symfony/translations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuestkamp/kubernetes-local-dev/c0e92950db4e32258e9243bf56032b9412a1cd23/symfony/translations/.gitignore -------------------------------------------------------------------------------- /symfony/webpack.config.js: -------------------------------------------------------------------------------- 1 | var Encore = require('@symfony/webpack-encore'); 2 | 3 | Encore 4 | // directory where compiled assets will be stored 5 | .setOutputPath('public/build/') 6 | // public path used by the web server to access the output path 7 | .setPublicPath('/build') 8 | // only needed for CDN's or sub-directory deploy 9 | //.setManifestKeyPrefix('build/') 10 | 11 | /* 12 | * ENTRY CONFIG 13 | * 14 | * Add 1 entry for each "page" of your app 15 | * (including one that's included on every page - e.g. "app") 16 | * 17 | * Each entry will result in one JavaScript file (e.g. app.js) 18 | * and one CSS file (e.g. app.css) if you JavaScript imports CSS. 19 | */ 20 | .addEntry('app', './assets/js/app.js') 21 | //.addEntry('page1', './assets/js/page1.js') 22 | //.addEntry('page2', './assets/js/page2.js') 23 | 24 | // When enabled, Webpack "splits" your files into smaller pieces for greater optimization. 25 | .splitEntryChunks() 26 | 27 | // will require an extra script tag for runtime.js 28 | // but, you probably want this, unless you're building a single-page app 29 | .enableSingleRuntimeChunk() 30 | 31 | /* 32 | * FEATURE CONFIG 33 | * 34 | * Enable & configure other features below. For a full 35 | * list of features, see: 36 | * https://symfony.com/doc/current/frontend.html#adding-more-features 37 | */ 38 | .cleanupOutputBeforeBuild() 39 | .enableBuildNotifications() 40 | .enableSourceMaps(!Encore.isProduction()) 41 | // enables hashed filenames (e.g. app.abc123.css) 42 | .enableVersioning(Encore.isProduction()) 43 | 44 | // enables Sass/SCSS support 45 | //.enableSassLoader() 46 | 47 | // uncomment if you use TypeScript 48 | //.enableTypeScriptLoader() 49 | 50 | // uncomment if you're having problems with a jQuery plugin 51 | //.autoProvidejQuery() 52 | 53 | // uncomment if you use API Platform Admin (composer req api-admin) 54 | //.enableReactPreset() 55 | //.addEntry('admin', './assets/js/admin.js') 56 | ; 57 | 58 | module.exports = Encore.getWebpackConfig(); 59 | --------------------------------------------------------------------------------