diff --git a/.travis.yml b/.travis.yml index d1eef33..2ce0c04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ jobs: - stage: "Basic Tests" script: - cd tests && sudo bash ./NoCustomConfigBasicTest.sh - - script: cd tests && sudo bash ./Ce23WithSampleDataMysqlSearchNoNfsTest.sh + - script: cd tests && sudo bash ./Ce24WithSampleDataMysqlSearchNoNfsTest.sh - script: cd tests && sudo bash ./MultiInstanceWithCeFromComposerNoNfsTest.sh - script: cd tests && sudo bash ./EeLinkingTest.sh @@ -23,13 +23,13 @@ install: # Make root mounted as rshared to fix kube-dns issues. - sudo mount --make-rshared / # Download kubectl, which is a requirement for using minikube. Had to install kubeadm on local VM https://kubernetes.io/docs/setup/independent/install-kubeadm/ - - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ + - curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.15.2/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ # Download Minikube. - - curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.1.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ + - curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.5.2/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ # Download Helm - curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh && chmod +x get_helm.sh && sudo ${TRAVIS_BUILD_DIR}/get_helm.sh # Socat is required fo proper Helm operation - - sudo apt-get update && sudo apt-get install -y socat + - sudo apt-get update && sudo apt-get install -y socat expect # TODO Install sudo apt install nfs-kernel-server # - sudo apt install -y nfs-kernel-server - cat ${TRAVIS_BUILD_DIR}/etc/helm/values.yaml diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8d5fa29 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language. +* Being respectful of differing viewpoints and experiences. +* Gracefully accepting constructive criticism. +* Focusing on what is best for the community. +* Showing empathy towards other community members. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances. +* Trolling, insulting/derogatory comments, and personal or political attacks. +* Public or private harassment. +* Publishing others' private information, such as a physical or electronic address, without explicit permission. +* Other conduct which could reasonably be considered inappropriate in a professional setting. + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engcom@magento.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]. + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef2e3c5..b6ae460 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,38 @@ Everyone is welcome to contribute improvements and fixes to this project. There are no specific requirements, just create a pull request with proposed modifications and try to run [tests](https://github.com/paliarush/magento2-vagrant-for-developers-tests) on your local environment. + +# Contributing to Magento 2 code + +Contributions to the Magento 2 codebase are done using the fork & pull model. +This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes. For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/). + +Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations. + +The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor within two weeks, the pull request will be closed. + + +## Contribution requirements + +1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.2/coding-standards/bk-coding-standards.html). +2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests. +3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.2-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information. +4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug. +3. PRs which include new logic or new features must be submitted along with: +* Unit/integration test coverage. +* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs). +4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input. +5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green). + +## Contribution process + +If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). This will allow you to collaborate with the Magento 2 development team, fork the Magento 2 project and send pull requests. + +1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution. +2. Review and sign the [Contributor License Agreement (CLA)](https://opensource.adobe.com/cla.html) if this is your first time contributing. You only need to sign the CLA once. +3. Create and test your work. +4. Fork the Magento 2 repository according to the [Fork A Repository instructions](https://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](https://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#pull_request). +5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed. + +## Code of Conduct + +Please note that this project is released with a Contributor Code of Conduct. We expect you to agree to its terms when participating in this project. +The full text is available in the repository [Wiki](https://github.com/magento/magento2/wiki/Magento-Code-of-Conduct). diff --git a/README.md b/README.md index d6d534b..09e07eb 100755 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ Use the following command to open current instance: ./m-open ``` -Hostname can also be found in `maghento/host_name` section of [etc/instance/.yaml](etc/instance/config.yaml.dist). +Hostname can also be found in `magento/host_name` section of [etc/instance/.yaml](etc/instance/config.yaml.dist). ### Reinstall Magento @@ -226,10 +226,21 @@ Upgrade can be performed instead of re-installation using `-u` flag. ### Sample data installation -Make sure that `ce_sample_data` and `ee_sample_data` are defined in [etc/instance/.yaml](etc/instance/config.yaml.dist) and point CE and optionally EE sample data repositories. -During initial project setup or during `bash init_project.sh -fc` (with `-fc` project will be re-created from scratch), sample data repositories willl be checked out to `magento2-devbox/magento/magento2ce-sample-data` and `magento2-devbox/magento/magento2ee-sample-data`. +To install Magento with sample data using Git: -To install Magento with sample data specify/uncomment sample data repository link at `repository_url_additional_repositories` in [etc/instance/.yaml](etc/instance/config.yaml.dist) and run `./m-switch-to-ce -f` or `./m-switch-to-ee -f`, depending on the edition to be installed. To disable sample data, comment out additional repositories and force-switch to necessary edition (using the same commands). +1. Uncomment the sample data repository link at `additional_repositories` in [etc/instance/.yaml](etc/instance/config.yaml.dist). To ensure the yaml file can be correctly parsed, only remove the `#` and the space afterwards. +2. Run `./m-switch-to-ce -f` or `./m-switch-to-ee -f`, depending on the edition to be installed. To disable sample data, comment out additional repositories and force-switch to necessary edition (using the same commands). + +If sample data is not showing, try the following: + +1. Navigate to the `magento2-devbox/` directory such as `magento2-devbox/default`. +2. Run `git clone git@github.com:magento/magento2-sample-data.git` or `git@github.com:magento/magento2-sample-data-ee.git` depending on the edition to be installed. +3. Navigate back up to the `magento2-devbox` directory. +4. Run `./m-switch-to-ce -f` or `./m-switch-to-ee -f`, depending on the edition to be installed. + +To install Magento with sample data using Composer: + +Follow the steps outlined [here](https://devdocs.magento.com/guides/v2.3/install-gde/install/sample-data-after-composer.html). ### Basic data generation @@ -336,8 +347,7 @@ Go to 'magento2-devbox' created earlier and run in command line: ### Running Magento tests -Not available yet. - +See [how to run Magento tests from PhpStorm using remote PHP in Kubernetes cluster](docs/running-tests/running-tests.md) ## Environment configuration @@ -437,3 +447,9 @@ bash ./.sh 1. Cannot run unit tests from PHPStorm on Magento 2.2, see possible solution [here](https://github.com/paliarush/magento2-vagrant-for-developers/issues/167) 1. [Permission denied (publickey)](https://github.com/paliarush/magento2-vagrant-for-developers/issues/165) 1. If you get [minikube time out error restarting cluster](https://github.com/kubernetes/minikube/issues/3843) while initializing project, run `minikube stop && minikube delete && ./init_project.sh`. + 1. To modify the docker image used for php-fpm container: + * Make changes in `etc/docker/monolith/Dockerfile` + * Run `./k-upgrade-environment` + * Run `./k-status` to open kubernetes dashboard and delete Replica Set named `magento2-monolith-*`. The container should be restarted and its Age should reset + 1. If you face `Input/output error command terminated with exit code 1` try to run the same command again, it will succeed after several trials. + 1. The project was working initially, but Magento instance domain name stopped resolving. In some cases minikube IP may be changed, run `./scripts/host/configure_etc_hosts.sh` diff --git a/docs/running-tests/configure-phpunit.png b/docs/running-tests/configure-phpunit.png new file mode 100644 index 0000000..f381354 Binary files /dev/null and b/docs/running-tests/configure-phpunit.png differ diff --git a/docs/running-tests/configure-remote-php.png b/docs/running-tests/configure-remote-php.png new file mode 100644 index 0000000..4c4c863 Binary files /dev/null and b/docs/running-tests/configure-remote-php.png differ diff --git a/docs/running-tests/running-tests.md b/docs/running-tests/running-tests.md new file mode 100644 index 0000000..eb53a8d --- /dev/null +++ b/docs/running-tests/running-tests.md @@ -0,0 +1,12 @@ +# Running Magento tests from PhpStorm using remote PHP in Kubernetes cluster + +It is possible to run Magento tests using remote PHP interpreter from the kubernetes cluster. + +1. Configure remote PHP interpreter in PhpStorm with credentials `root:123123q`. Use the IP which you get by running `minikube ip` and port `30022`. It is important to update `Configuration options` field for XDebug to work. +![](configure-remote-php.png) +1. Select configured remote PHP interpreter +![](select-remote-php.png) +1. Configure PhpUnit to use the configured remote PHP interpreter +![](configure-phpunit.png) + +When remote PHP configuration is successfully completed run the tests from PhpStorm as usual. diff --git a/docs/running-tests/select-remote-php.png b/docs/running-tests/select-remote-php.png new file mode 100644 index 0000000..4991c5f Binary files /dev/null and b/docs/running-tests/select-remote-php.png differ diff --git a/etc/docker/monolith-with-xdebug-and-ssh/Dockerfile b/etc/docker/monolith-with-xdebug-and-ssh/Dockerfile new file mode 100755 index 0000000..28559d2 --- /dev/null +++ b/etc/docker/monolith-with-xdebug-and-ssh/Dockerfile @@ -0,0 +1,15 @@ +FROM magento2-monolith:dev-xdebug + +RUN apt-get update && apt-get install -y openssh-server +RUN mkdir /var/run/sshd +RUN echo 'root:123123q' | chpasswd +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config + +# SSH login fix. Otherwise user is kicked off after login +RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd + +ENV NOTVISIBLE "in users profile" +RUN echo "export VISIBLE=now" >> /etc/profile + +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff --git a/etc/docker/monolith-with-xdebug/Dockerfile b/etc/docker/monolith-with-xdebug/Dockerfile index 8076954..268c6de 100755 --- a/etc/docker/monolith-with-xdebug/Dockerfile +++ b/etc/docker/monolith-with-xdebug/Dockerfile @@ -1,5 +1,7 @@ FROM magento2-monolith:dev -RUN sed -i "s|;zend_extension=xdebug.so|zend_extension=xdebug.so|g" /usr/local/etc/php/conf.d/zz-xdebug-settings.ini -RUN sed -i "s|listen = 0.0.0.0:9001|listen = 0.0.0.0:9002|g" /usr/local/etc/php-fpm.conf +RUN sed -i "s|;zend_extension=xdebug.so|zend_extension=xdebug.so|g" /usr/local/etc/php/conf.d/zz-xdebug-settings.ini +RUN sed -i "s|listen = 0.0.0.0:9001|listen = 0.0.0.0:9002|g" /usr/local/etc/php-fpm.conf +RUN sed -i "s|xdebug.remote_connect_back = 1|xdebug.remote_host=192.168.99.1|g" /usr/local/etc/php-fpm.conf +CMD ["php-fpm", "-R"] diff --git a/etc/docker/monolith/Dockerfile b/etc/docker/monolith/Dockerfile index e249f70..5f9dde4 100755 --- a/etc/docker/monolith/Dockerfile +++ b/etc/docker/monolith/Dockerfile @@ -1,5 +1,56 @@ -FROM paliarush123/minikube-php-fpm:latest +FROM php:7.3-fpm -RUN sed -i "s|listen = 0.0.0.0:9000|listen = 0.0.0.0:9001|g" /usr/local/etc/php-fpm.conf +# Install dependencies +RUN apt-get update \ + && apt-get install -y \ + libfreetype6-dev \ + libicu-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + libxslt1-dev \ + sendmail-bin \ + sendmail \ + sudo \ + net-tools \ + nano -# RUN apt-get update && apt-get install -y nfs-common && rm -rf /var/lib/apt/lists/* +RUN apt-get install -y apt-utils +RUN apt-get install -y libzip-dev + +# Configure the gd library +RUN docker-php-ext-configure \ + gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ + +RUN docker-php-ext-configure opcache --enable-opcache + +# Install required PHP extensions +RUN docker-php-ext-install \ + dom \ + gd \ + intl \ + mbstring \ + pdo_mysql \ + xsl \ + zip \ + bcmath \ + soap \ + sockets \ + opcache + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN pecl install -o -f xdebug + +RUN apt-get update && apt-get install -y default-mysql-client && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y redis-tools && rm -rf /var/lib/apt/lists/* + +COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini +COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini +COPY etc/php-fpm.conf /usr/local/etc/ + +CMD ["php-fpm", "-R"] + +RUN sed -i "s|listen = 0.0.0.0:9000|listen = 0.0.0.0:9001|g" /usr/local/etc/php-fpm.conf diff --git a/etc/helm/README.md b/etc/helm/README.md index 059c719..13f498c 100644 --- a/etc/helm/README.md +++ b/etc/helm/README.md @@ -1,75 +1,3 @@ -# Magento Kubernetes components - -Install minikube. - -Start minikube. And use docker env. - -```bash -minikube start -eval $(minikube docker-env) -``` - -Install helm (cluster should be run to set tiller). [Install guide](https://docs.helm.sh/using_helm/#installing-helm) - - -## NFS server (optional) - -Configure your sources directory as export (/etc/exports) in the NFS server that runs on your host machine. This way containers can mount source code. This is a lot faster than a default VirtualBox shared folder mount. You only have to do this once, the NFS service will load /etc/exports at (re)boot. - -NOTE: The Minikube IP can be different after a minikube delete and minikube start command. Make sure that your NFS export contains the correct Minikube IP again. - -[More info](http://pietervogelaar.nl/minikube-nfs-mounts) - -### Mac OS X -If you do not have python, install it using brew: -```bash -brew install python -``` -echo "$(python -c 'import os,sys;print(os.path.realpath(".")')/sources -alldirs -mapall="$(id -u)":"$(id -g))" $(minikube ip)" | sudo tee -a /etc/exports && sudo nfsd restart -Check if the entry is active by executing on your host machine: - -```bash -showmount -e 127.0.0.1 -``` - -This should output something like: - -```bash -Exports list on 127.0.0.1: -/Absolute/path/to/magento 192.168.99.100 -``` - -There is also variable in values.yml which should be enabled - -## Run deployments - -Configuration values located in values.yaml - -To run all charts execute next command: - -```bash -helm install --values values.yaml . -``` - -(temporary) Magento sources should be cloned to source path in current chart and in checkout subchart as well. - -DB password autogenerated in container, to check it list pods: -```bash -kubectl get pods -``` - -choose one of mysql pods end run bash in it: - -```bash -kubectl exec -it release-1-some-mysql-pod bash -``` - -Observe env variables with prefix MYSQL_ - -## Clean - -To delete releases run: -``` -helm delete $(helm list -q) -``` +TODO: Add relevant sections. +For now see the main README.md in the project. diff --git a/etc/helm/charts/checkout/Chart.yaml b/etc/helm/charts/checkout/Chart.yaml deleted file mode 100644 index 3c82960..0000000 --- a/etc/helm/charts/checkout/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -appVersion: "1.0" -description: A Helm chart for Kubernetes -name: checkout -version: 0.1.0 diff --git a/etc/helm/charts/checkout/charts/mysql-0.9.2.tgz b/etc/helm/charts/checkout/charts/mysql-0.9.2.tgz deleted file mode 100644 index 21054c1..0000000 Binary files a/etc/helm/charts/checkout/charts/mysql-0.9.2.tgz and /dev/null differ diff --git a/etc/helm/charts/checkout/etc/nginx.conf b/etc/helm/charts/checkout/etc/nginx.conf deleted file mode 100644 index 887c612..0000000 --- a/etc/helm/charts/checkout/etc/nginx.conf +++ /dev/null @@ -1,23 +0,0 @@ -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - - upstream fastcgi_backend { - server 127.0.0.1:9000; - } - - server { - listen 80 default_server; - listen [::]:80 default_server; - - server_name _; - set $MAGE_ROOT {{.Values.global.checkout.volumeHostPath}}; - include {{.Values.global.checkout.volumeHostPath}}/nginx.conf.sample; - } -} diff --git a/etc/helm/charts/checkout/requirements.lock b/etc/helm/charts/checkout/requirements.lock deleted file mode 100644 index fec9539..0000000 --- a/etc/helm/charts/checkout/requirements.lock +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: mysql - repository: https://kubernetes-charts.storage.googleapis.com/ - version: 0.9.2 -digest: sha256:5f1ec2d74a44651865b038da4fb76dc9d5ee04084a1db574c50657ba1b0d96fc -generated: 2019-01-03T00:55:37.077265-08:00 diff --git a/etc/helm/charts/checkout/requirements.yaml b/etc/helm/charts/checkout/requirements.yaml deleted file mode 100644 index 0545f90..0000000 --- a/etc/helm/charts/checkout/requirements.yaml +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: mysql - version: "0.9.2" - appVersion: 5.7.14 - repository: "@stable" - condition: global.checkout.db.enabled diff --git a/etc/helm/charts/checkout/templates/_helpers.tpl b/etc/helm/charts/checkout/templates/_helpers.tpl deleted file mode 100644 index a9c9c71..0000000 --- a/etc/helm/charts/checkout/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "checkout.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "checkout.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "checkout.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/etc/helm/charts/checkout/templates/checkout-deployment.yaml b/etc/helm/charts/checkout/templates/checkout-deployment.yaml deleted file mode 100644 index 0ebb79d..0000000 --- a/etc/helm/charts/checkout/templates/checkout-deployment.yaml +++ /dev/null @@ -1,51 +0,0 @@ -{{- if .Values.global.checkout.enabled }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "checkout.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "checkout.name" . }} - helm.sh/chart: {{ include "checkout.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - selector: - matchLabels: - app.kubernetes.io/name: {{ include "checkout.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "checkout.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - containerPort: 80 - volumeMounts: - - name: {{ .Chart.Name }}-code - mountPath: {{.Values.global.checkout.volumeHostPath}} - - name: {{ .Chart.Name }}-nginx - image: nginx:1.9 - volumeMounts: - - name: {{ .Chart.Name }}-code - mountPath: {{.Values.global.checkout.volumeHostPath}} - - name: {{ template "checkout.fullname" . }}-nginx-config-volume - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - volumes: - - name: {{ template "checkout.fullname" . }}-nginx-config-volume - configMap: - name: {{ template "checkout.fullname" . }}-nginx-config - - name: {{ .Chart.Name }}-code - {{- if .Values.global.persistence.nfs.enabled }} - persistentVolumeClaim: - claimName: {{ include "checkout.fullname" . }}-claim - {{- else }} - hostPath: - path: {{.Values.global.checkout.volumeHostPath}} - {{- end -}} -{{- end }} diff --git a/etc/helm/charts/checkout/templates/configmap.yaml b/etc/helm/charts/checkout/templates/configmap.yaml deleted file mode 100644 index 7d36e5b..0000000 --- a/etc/helm/charts/checkout/templates/configmap.yaml +++ /dev/null @@ -1,217 +0,0 @@ -{{- if .Values.global.checkout.enabled }} -kind: ConfigMap -apiVersion: v1 -metadata: - name: {{ template "checkout.fullname" . }}-nginx-config -data: - nginx.conf: | - events { - worker_connections 1024; - } - - http { - include mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - client_max_body_size 200M; - gzip on; - fastcgi_read_timeout 30000s; - - upstream fastcgi_backend { - server 127.0.0.1:9001; - } - - upstream fastcgi_backend_xdebug { - server 127.0.0.1:9002; - } - - map $cookie_XDEBUG_SESSION $fastcgi_backend_name { - "" "fastcgi_backend"; - default "fastcgi_backend_xdebug"; - } - - server { - listen 8001; - - server_name _; - set $MAGE_ROOT {{.Values.global.checkout.volumeHostPath}}/checkout; - root $MAGE_ROOT/pub; - - index index.php; - autoindex off; - charset UTF-8; - error_page 404 403 = /errors/404.php; - #add_header "X-UA-Compatible" "IE=Edge"; - - # PHP entry point for setup application - location ~* ^/setup($|/) { - root $MAGE_ROOT; - location ~ ^/setup/index.php { - fastcgi_pass fastcgi_backend; - - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - - location ~ ^/setup/(?!pub/). { - deny all; - } - - location ~ ^/setup/pub/ { - add_header X-Frame-Options "SAMEORIGIN"; - } - } - - # PHP entry point for update application - location ~* ^/update($|/) { - root $MAGE_ROOT; - - location ~ ^/update/index.php { - fastcgi_split_path_info ^(/update/index.php)(/.+)$; - fastcgi_pass fastcgi_backend; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - include fastcgi_params; - } - - # Deny everything but index.php - location ~ ^/update/(?!pub/). { - deny all; - } - - location ~ ^/update/pub/ { - add_header X-Frame-Options "SAMEORIGIN"; - } - } - - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - location /pub/ { - location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) { - deny all; - } - alias $MAGE_ROOT/pub/; - add_header X-Frame-Options "SAMEORIGIN"; - } - - location /static/ { - # Uncomment the following line in production mode - # expires max; - - # Remove signature of the static files that is used to overcome the browser cache - location ~ ^/static/version { - rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last; - } - - location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ { - add_header Cache-Control "public"; - add_header X-Frame-Options "SAMEORIGIN"; - expires +1y; - - if (!-f $request_filename) { - rewrite ^/static/?(.*)$ /static.php?resource=$1 last; - } - } - location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { - add_header Cache-Control "no-store"; - add_header X-Frame-Options "SAMEORIGIN"; - expires off; - - if (!-f $request_filename) { - rewrite ^/static/?(.*)$ /static.php?resource=$1 last; - } - } - if (!-f $request_filename) { - rewrite ^/static/?(.*)$ /static.php?resource=$1 last; - } - add_header X-Frame-Options "SAMEORIGIN"; - } - - location /media/ { - try_files $uri $uri/ /get.php$is_args$args; - - location ~ ^/media/theme_customization/.*\.xml { - deny all; - } - - location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { - add_header Cache-Control "public"; - add_header X-Frame-Options "SAMEORIGIN"; - expires +1y; - try_files $uri $uri/ /get.php$is_args$args; - } - location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { - add_header Cache-Control "no-store"; - add_header X-Frame-Options "SAMEORIGIN"; - expires off; - try_files $uri $uri/ /get.php$is_args$args; - } - add_header X-Frame-Options "SAMEORIGIN"; - } - - location /media/customer/ { - deny all; - } - - location /media/downloadable/ { - deny all; - } - - location /media/import/ { - deny all; - } - - # PHP entry point for main application - location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ { - try_files $uri =404; - fastcgi_pass $fastcgi_backend_name; - fastcgi_buffers 1024 4k; - - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - - gzip on; - gzip_disable "msie6"; - - gzip_comp_level 6; - gzip_min_length 1100; - gzip_buffers 16 8k; - gzip_proxied any; - gzip_types - text/plain - text/css - text/js - text/xml - text/javascript - application/javascript - application/x-javascript - application/json - application/xml - application/xml+rss - image/svg+xml; - gzip_vary on; - - # Banned locations (only reached if the earlier PHP entry point regexes don't match) - location ~* (\.php$|\.htaccess$|\.git) { - deny all; - } - } - } -{{- end }} diff --git a/etc/helm/charts/checkout/templates/default-sources-volume-claim.yaml b/etc/helm/charts/checkout/templates/default-sources-volume-claim.yaml deleted file mode 100644 index d488de9..0000000 --- a/etc/helm/charts/checkout/templates/default-sources-volume-claim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{- if .Values.global.persistence.nfs.enabled }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ include "checkout.fullname" . }}-claim - namespace: default -spec: - storageClassName: standard - accessModes: - - ReadWriteMany - resources: - requests: - storage: 2Gi -{{- end }} \ No newline at end of file diff --git a/etc/helm/charts/checkout/templates/default-sources-volume.yaml b/etc/helm/charts/checkout/templates/default-sources-volume.yaml deleted file mode 100644 index d2d2512..0000000 --- a/etc/helm/charts/checkout/templates/default-sources-volume.yaml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Values.global.persistence.nfs.enabled }} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: {{ include "checkout.fullname" . }}-volume -spec: - capacity: - storage: 2Gi - accessModes: - - ReadWriteMany - storageClassName: standard - nfs: - # The address 192.168.99.1 is the Minikube gateway to the host. This way - # not the container IP will be visible by the NFS server on the host machine, - # but the IP address of the `minikube ip` command. You will need to - # grant access to the `minikube ip` IP address. - server: 192.168.99.1 - path: {{.Values.global.checkout.volumeHostPath}} -{{- end }} diff --git a/etc/helm/charts/checkout/templates/service.yaml b/etc/helm/charts/checkout/templates/service.yaml deleted file mode 100644 index 2a51914..0000000 --- a/etc/helm/charts/checkout/templates/service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .Values.global.checkout.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ include "checkout.fullname" . }} - labels: - app: {{ include "checkout.name" . }} - app.kubernetes.io/name: {{ include "checkout.name" . }} - helm.sh/chart: {{ include "checkout.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -spec: - type: {{ .Values.global.checkout.service.type }} - ports: - - port: {{ .Values.global.checkout.service.port }} - nodePort: {{ .Values.global.checkout.service.nodePort }} - selector: - app.kubernetes.io/name: {{ include "checkout.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} diff --git a/etc/helm/charts/checkout/values.yaml b/etc/helm/charts/checkout/values.yaml deleted file mode 100644 index ba8a816..0000000 --- a/etc/helm/charts/checkout/values.yaml +++ /dev/null @@ -1,62 +0,0 @@ -replicaCount: 1 - -image: - repository: shiftedreality/magento-kubernetes-components-php - tag: 7.1-fpm - pullPolicy: IfNotPresent - -nameOverride: "" -fullnameOverride: "" - -#service: -# type: NodePort -# port: 80 -# nodePort: 30102 - -monolith: - volumeHostPath: /Users/user/Projects/magento2-kubernetes-for-developers - -checkout: - name: magento2-checkout - volumeHostPath: /Users/user/Projects/magento2-kubernetes-for-developers - service: - type: NodePort - nodePort: 30102 - port: 80 - deployment: - nginxImage: nginx:1.9 - codeImage: shiftedreality/magento-kubernetes-components-php - imageTag: 7.1-fpm - imagePullPolicy: Always - -resources: {} - # Uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -nodeSelector: {} - -tolerations: [] - -affinity: {} - -global: - persistence: - nfs: - enabled: false - chekout: - enabled: true - service: - type: NodePort - nodePort: 30102 - port: 80 - mysqlHost: checkout-mysql - db: - enabled: true - volumeHostPath: /Users/user/Projects/magento2-kubernetes-for-developers - diff --git a/etc/helm/charts/mysql-0.15.0.tgz b/etc/helm/charts/mysql-0.15.0.tgz deleted file mode 100644 index 8b050b5..0000000 Binary files a/etc/helm/charts/mysql-0.15.0.tgz and /dev/null differ diff --git a/etc/helm/charts/mysql-0.19.2.tgz b/etc/helm/charts/mysql-0.19.2.tgz new file mode 100644 index 0000000..dae6096 Binary files /dev/null and b/etc/helm/charts/mysql-0.19.2.tgz differ diff --git a/etc/helm/requirements.lock b/etc/helm/requirements.lock index e77977b..205028e 100644 --- a/etc/helm/requirements.lock +++ b/etc/helm/requirements.lock @@ -1,7 +1,7 @@ dependencies: - name: mysql repository: https://kubernetes-charts.storage.googleapis.com - version: 0.15.0 + version: 0.19.2 - name: redis repository: https://kubernetes-charts.storage.googleapis.com version: 6.4.5 @@ -10,6 +10,6 @@ dependencies: version: 5.5.0 - name: elasticsearch repository: https://helm.elastic.co - version: 6.5.0 -digest: sha256:f5f413c09690010e1ed93c9fbc0f268ea869eca6e1d42e83729eeee70cdb1bfb -generated: 2019-05-01T14:43:50.018673-05:00 + version: 6.8.8 +digest: sha256:d8cb388574e1db38759d9b1113cc4fc95ff550aeb024c5a449d711c2636cc66d +generated: 2019-08-19T10:57:16.077076-05:00 diff --git a/etc/helm/requirements.yaml b/etc/helm/requirements.yaml index 3dbb7ff..e7ebe6b 100644 --- a/etc/helm/requirements.yaml +++ b/etc/helm/requirements.yaml @@ -1,6 +1,6 @@ dependencies: - name: mysql - version: "0.15.0" + version: "0.19.2" appVersion: 5.7.14 repository: "@stable" - name: redis @@ -13,9 +13,5 @@ dependencies: version: "5.5.0" - name: elasticsearch repository: "https://helm.elastic.co" - appVersion: "6.7.1" + appVersion: "6.5.0" version: "6.5.0" -- name: checkout - repository: file://./charts/ - version: 0.1.0 - condition: global.checkout.enabled diff --git a/etc/helm/templates/NOTES.txt b/etc/helm/templates/NOTES.txt index cb22607..13f498c 100644 --- a/etc/helm/templates/NOTES.txt +++ b/etc/helm/templates/NOTES.txt @@ -1,11 +1,3 @@ -1. Get the application URL by running these commands: -minikube service {{ include "magento.fullname" . }} +TODO: Add relevant sections. -Deployed database can by accessed by next hosts from inside network: -{{ .Release.Name }}-mysql - -2. Get the application URL by running these commands: - minikube service {{ .Release.Name }}-checkout -Deployed databases can by accessed by next hosts from inside networks: - -{{ .Release.Name }}-checkout-mysql \ No newline at end of file +For now see the main README.md in the project. diff --git a/etc/helm/templates/cron.yaml b/etc/helm/templates/cron.yaml index 0081247..3e2d53e 100644 --- a/etc/helm/templates/cron.yaml +++ b/etc/helm/templates/cron.yaml @@ -27,8 +27,6 @@ {{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}} {{/*- name: DEVBOX_ROOT_HOST*/}} {{/*value: {{.Values.global.monolith.volumeHostPath}}*/}} - {{/*- name: IS_WINDOWS_HOST*/}} - {{/*value: "0"*/}} {{/*volumes:*/}} {{/*- name: code*/}} {{/*{{- if .Values.global.persistence.nfs.enabled }}*/}} @@ -68,8 +66,6 @@ {{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}} {{/*- name: DEVBOX_ROOT_HOST*/}} {{/*value: {{.Values.global.monolith.volumeHostPath}}*/}} - {{/*- name: IS_WINDOWS_HOST*/}} - {{/*value: "0"*/}} {{/*volumes:*/}} {{/*- name: code*/}} {{/*{{- if .Values.global.persistence.nfs.enabled }}*/}} @@ -110,8 +106,6 @@ {{/*value: {{.Values.global.monolith.volumeHostPath}}/.composer*/}} {{/*- name: DEVBOX_ROOT_HOST*/}} {{/*value: {{.Values.global.monolith.volumeHostPath}}*/}} - {{/*- name: IS_WINDOWS_HOST*/}} - {{/*value: "0"*/}} {{/*volumes:*/}} {{/*- name: code*/}} {{/*{{- if .Values.global.persistence.nfs.enabled }}*/}} diff --git a/etc/helm/templates/magento2-deployment.yaml b/etc/helm/templates/magento2-deployment.yaml index f3d6b44..f30c78f 100644 --- a/etc/helm/templates/magento2-deployment.yaml +++ b/etc/helm/templates/magento2-deployment.yaml @@ -19,6 +19,7 @@ spec: labels: app.kubernetes.io/name: {{ include "magento.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} + ssh.access: php spec: hostAliases: - ip: {{ .Values.global.dns.magentoHosts.ip }} @@ -30,7 +31,7 @@ spec: securityContext: privileged: true ports: - - containerPort: {{ .Values.global.monolith.service.port }} + - containerPort: {{ .Values.global.monolith.service.phpFpmPort }} volumeMounts: - name: code mountPath: {{.Values.global.monolith.volumeHostPath}} @@ -41,15 +42,31 @@ spec: value: {{.Values.global.monolith.volumeHostPath}}/.composer - name: DEVBOX_ROOT_HOST value: {{.Values.global.monolith.volumeHostPath}} - - name: IS_WINDOWS_HOST - value: "0" - name: {{ .Chart.Name }}-xdebug image: magento2-monolith:dev-xdebug imagePullPolicy: Never securityContext: - privileged: true + privileged: true + ports: + - containerPort: {{ .Values.global.monolith.service.phpFpmXdebugPort }} + {{/*- containerPort: 22*/}} + volumeMounts: + - name: code + mountPath: {{.Values.global.monolith.volumeHostPath}} + env: + - name: DEVBOX_ROOT + value: {{.Values.global.monolith.volumeHostPath}} + - name: COMPOSER_HOME + value: {{.Values.global.monolith.volumeHostPath}}/.composer + - name: DEVBOX_ROOT_HOST + value: {{.Values.global.monolith.volumeHostPath}} + - name: {{ .Chart.Name }}-xdebug-cli-over-ssh + image: magento2-monolith:dev-xdebug-and-ssh + imagePullPolicy: Never + securityContext: + privileged: true ports: - - containerPort: {{ .Values.xdebugService.port }} + - containerPort: 22 volumeMounts: - name: code mountPath: {{.Values.global.monolith.volumeHostPath}} @@ -60,8 +77,6 @@ spec: value: {{.Values.global.monolith.volumeHostPath}}/.composer - name: DEVBOX_ROOT_HOST value: {{.Values.global.monolith.volumeHostPath}} - - name: IS_WINDOWS_HOST - value: "0" - name: nginx image: nginx:1.9 securityContext: @@ -75,10 +90,10 @@ spec: - name: varnish image: million12/varnish env: - - name: VCL_CONFIG - value: /etc/varnish/magento.vcl - - name: VARNISHD_PARAMS - value: "-a 0.0.0.0:{{ .Values.global.monolith.service.varnishPort }}" + - name: VCL_CONFIG + value: /etc/varnish/magento.vcl + - name: VARNISHD_PARAMS + value: "-a 0.0.0.0:{{ .Values.global.monolith.service.varnishPort }}" volumeMounts: - name: varnish-config-volume mountPath: /etc/varnish/magento.vcl @@ -91,10 +106,10 @@ spec: configMap: name: {{ template "magento.fullname" . }}-varnish-config - name: code - {{- if .Values.global.persistence.nfs.enabled }} + {{- if .Values.global.persistence.nfs.enabled }} persistentVolumeClaim: claimName: {{ include "magento.fullname" . }}-claim - {{- else }} + {{- else }} hostPath: path: {{.Values.global.monolith.volumeHostPath}} - {{- end }} + {{- end }} diff --git a/etc/helm/templates/service.yaml b/etc/helm/templates/service.yaml index fa9c442..044add4 100644 --- a/etc/helm/templates/service.yaml +++ b/etc/helm/templates/service.yaml @@ -33,3 +33,20 @@ spec: app: redis role: master tier: backend +--- +apiVersion: v1 +kind: Service +metadata: + name: "{{ include "magento.fullname" . }}-ssh" + labels: + app.kubernetes.io/name: "php-fpm-ssh-service" + app.kubernetes.io/instance: "{{ include "magento.fullname" . }}-php-fpm-ssh-service" +spec: + type: NodePort + ports: + - port: 2022 + targetPort: 22 + nodePort: 30022 + protocol: TCP + selector: + ssh.access: php diff --git a/etc/helm/values.yaml b/etc/helm/values.yaml index 2e62a50..9277bde 100644 --- a/etc/helm/values.yaml +++ b/etc/helm/values.yaml @@ -29,14 +29,6 @@ global: caching: varnish: enabled: true # This value is overridden via /etc/instance/$(getContext).yaml - checkout: - enabled: false - db: - enabled: false - service: - type: NodePort - nodePort: 30102 - port: 80 monolith: service: port: 8050 @@ -79,6 +71,7 @@ mysql: nodePort: 30306 persistence: size: 4Gi + imageTag: "5.7.22" redis: usePassword: false @@ -90,18 +83,13 @@ redis: enabled: false rabbitmq: - serviceType: NodePort + service: + type: NodePort rabbitmq: username: admin password: 123123q elasticsearch: - imageTag: "6.7.1" - esMajorVersion: 6 - - replicas: 2 - minimumMasterNodes: 1 - # Permit co-located instances for solitary minikube virtual machines. antiAffinity: "soft" diff --git a/init_project.sh b/init_project.sh index 1792a2a..cdc6904 100755 --- a/init_project.sh +++ b/init_project.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e devbox_dir=$PWD @@ -20,6 +23,9 @@ if [[ ${debug_devbox_project} -eq 1 ]]; then set -x fi +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + # TODO: remove references to context host_os="$(bash "${devbox_dir}/scripts/host/get_host_os.sh")" use_nfs="$(bash "${devbox_dir}/scripts/get_env_config_value.sh" "guest_use_nfs")" @@ -91,18 +97,9 @@ cd "${devbox_dir}" # TODO: Verify that this condition works as expected if [[ ! $(isMinikubeRunning) -eq 1 ]]; then status "Starting minikube" - minikube start -v=0 --cpus=2 --memory=4096 + minikube start --kubernetes-version=v1.15.6 -v=0 --cpus=2 --memory=4096 + minikube config set kubernetes-version v1.15.6 minikube addons enable ingress - minikube addons enable heapster - # TODO: Remove if not needed -# minikube start -v=0 --cache-images --cpus=2 --memory=4096 2> >(logError) | { -# while IFS= read -r line -# do -# filterDevboxOutput "${line}" -# lastline="${line}" -# done -# filterDevboxOutput "${lastline}" -# } fi config_content="$(cat ${config_path})" @@ -144,6 +141,9 @@ fi # Iterate over all requested instances and initialize them for instance_name in ${instance_names}; do setContext ${instance_name} + + bash "${devbox_dir}/scripts/host/m_composer.sh" global require "hirak/prestissimo" + flags="" if [[ ${force_instance_cleaning} -eq 1 ]]; then flags="${flags}i" diff --git a/k-get-context b/k-get-context index 6c6c4c8..0dc7779 100755 --- a/k-get-context +++ b/k-get-context @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-open-rabbitmq b/k-open-rabbitmq index e1b9c4b..9bdb032 100755 --- a/k-open-rabbitmq +++ b/k-open-rabbitmq @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-restart b/k-restart index 0cd64ca..938e039 100755 --- a/k-restart +++ b/k-restart @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD @@ -12,6 +15,6 @@ if [[ $(isMinikubeRunning) -eq 1 || $(isMinikubeSaved) -eq 1 ]]; then fi # TODO: Avoid duplication with init_project.sh -minikube start -v=0 --cpus=2 --memory=4096 2> >(logError) +minikube start --kubernetes-version=v1.15.6 -v=0 --cpus=2 --memory=4096 2> >(logError) info "$(regular)See details in $(bold)${devbox_dir}/log/${current_script_name}.log$(regular). For debug output set $(bold)debug:devbox_project$(regular) to $(bold)1$(regular) in $(bold)etc/config.yaml$(regular)" diff --git a/k-set-context b/k-set-context index ca0f44c..554bda4 100755 --- a/k-set-context +++ b/k-set-context @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-elasticsearch b/k-ssh-elasticsearch index e5728e0..304b2d8 100755 --- a/k-ssh-elasticsearch +++ b/k-ssh-elasticsearch @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-magento2 b/k-ssh-magento2 index 2eaec71..526b88c 100755 --- a/k-ssh-magento2 +++ b/k-ssh-magento2 @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-mysql b/k-ssh-mysql index 299a89d..a26f19a 100755 --- a/k-ssh-mysql +++ b/k-ssh-mysql @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-nginx b/k-ssh-nginx index 391fcc4..bc60b35 100755 --- a/k-ssh-nginx +++ b/k-ssh-nginx @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-redis b/k-ssh-redis index c410b3d..bc81545 100755 --- a/k-ssh-redis +++ b/k-ssh-redis @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-ssh-varnish b/k-ssh-varnish index 6c547ca..38c486d 100755 --- a/k-ssh-varnish +++ b/k-ssh-varnish @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-start b/k-start index b73806f..98664f0 100755 --- a/k-start +++ b/k-start @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD @@ -8,8 +11,8 @@ source "${devbox_dir}/scripts/functions.sh" resetNestingLevel if [[ ! $(isMinikubeRunning) -eq 1 ]]; then - // TDOO: Eliminate duplication with k-restart - minikube start -v=0 --cpus=2 --memory=4096 2> >(logError) + # TDOO: Eliminate duplication with k-restart + minikube start --kubernetes-version=v1.15.6 -v=0 --cpus=2 --memory=4096 2> >(logError) fi diff --git a/k-status b/k-status index d76249b..99d7262 100755 --- a/k-status +++ b/k-status @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/k-upgrade-environment b/k-upgrade-environment index 9c336f6..02a1858 100755 --- a/k-upgrade-environment +++ b/k-upgrade-environment @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-bin-magento b/m-bin-magento index c9ada9f..432cd94 100755 --- a/m-bin-magento +++ b/m-bin-magento @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-clear-cache b/m-clear-cache index 8b19660..279e426 100755 --- a/m-clear-cache +++ b/m-clear-cache @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-composer b/m-composer index aea7481..4c67789 100755 --- a/m-composer +++ b/m-composer @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-open b/m-open index 37395a8..46a561c 100755 --- a/m-open +++ b/m-open @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-reinstall b/m-reinstall index 6470298..3547169 100755 --- a/m-reinstall +++ b/m-reinstall @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-search-engine b/m-search-engine index 3487224..fc96fdd 100755 --- a/m-search-engine +++ b/m-search-engine @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-switch-to-ce b/m-switch-to-ce index 43fa215..e3ac4c0 100755 --- a/m-switch-to-ce +++ b/m-switch-to-ce @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-switch-to-ee b/m-switch-to-ee index 876b094..2ca622d 100755 --- a/m-switch-to-ee +++ b/m-switch-to-ee @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/m-varnish b/m-varnish index 872eebb..a3f293b 100755 --- a/m-varnish +++ b/m-varnish @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")" && devbox_dir=$PWD diff --git a/scripts/Dockerfile b/scripts/Dockerfile deleted file mode 100755 index 98b3435..0000000 --- a/scripts/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -FROM php:7.1-fpm - -# Install dependencies -RUN apt-get update \ - && apt-get install -y \ - libfreetype6-dev \ - libicu-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libxslt1-dev \ - sendmail-bin \ - sendmail \ - sudo \ - net-tools \ - nano - -# Configure the gd library -RUN docker-php-ext-configure \ - gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ - -RUN docker-php-ext-configure opcache --enable-opcache - -# Install required PHP extensions -RUN docker-php-ext-install \ - dom \ - gd \ - intl \ - mbstring \ - mcrypt \ - pdo_mysql \ - xsl \ - zip \ - bcmath \ - soap \ - opcache - -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN pecl install -o -f xdebug - -RUN apt-get update && apt-get install -y mysql-client && rm -rf /var/lib/apt/lists/* - -RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* - -RUN apt-get update && apt-get install -y redis-tools && rm -rf /var/lib/apt/lists/* - -COPY etc/php-xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug-settings.ini -COPY etc/php-fpm.ini /usr/local/etc/php/conf.d/zz-magento.ini -COPY etc/php-fpm.conf /usr/local/etc/ - -CMD ["php-fpm", "-R"] diff --git a/scripts/colors.sh b/scripts/colors.sh index e0819b0..ff9f44c 100755 --- a/scripts/colors.sh +++ b/scripts/colors.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + # CLI color functions function red() { diff --git a/scripts/functions.sh b/scripts/functions.sh index 6f2a9f3..0634e3f 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/.." && devbox_dir=$PWD source "${devbox_dir}/scripts/colors.sh" @@ -92,6 +95,7 @@ function outputErrorsOnly() { errors="$(echo "${1}" | grep -iv "Connection to 127.0.0.1 closed." \ | grep -iv "Cloning into .*\.\.\."\ + | grep -iv "Overwrite the existing configuration for session-save .*"\ | grep -iv "Checking out .* done\."\ )" if [[ -n "${errors}" ]]; then @@ -104,6 +108,7 @@ function outputInfoOnly() { info="$(echo "${1}" | grep -iv "Connection to 127.0.0.1 closed." \ | grep -i "Cloning into .*\.\.\."\ + | grep -i "Overwrite the existing configuration for session-save .*"\ | grep -i "Checking out .* done\."\ )" if [[ -n "${info}" ]]; then @@ -149,6 +154,7 @@ function initLogFile() log_file="debug" fi echo "log/${log_file}.log" > "${log_file_path}" + chmod a+w "${log_file_path}" rm -f "${devbox_dir}/log/${log_file}.log" touch "${devbox_dir}/log/${log_file}.log" chmod a+w "${devbox_dir}/log/${log_file}.log" @@ -195,12 +201,6 @@ function getMagento2PodId() echo "$(kubectl get pods | grep -ohE 'magento2-monolith-[a-z0-9\-]+')" } -function getMagento2CheckoutPodId() -{ - # TODO: Calculate based on current helm release - echo "$(kubectl get pods | grep -ohE 'magento2-checkout-[a-z0-9\-]+')" -} - function getRedisMasterPodId() { echo "$(kubectl get pods | grep -ohE 'magento2-redis-master-[a-z0-9\-]+')" @@ -222,12 +222,6 @@ function executeInMagento2Container() kubectl exec "${magento2_pod_id}" --container monolith "$@" 2> >(logError) } -function executeInMagento2CheckoutContainer() -{ - magento2_pod_id="$(getMagento2CheckoutPodId)" - kubectl exec "${magento2_pod_id}" --container checkout "$@" 2> >(logError) -} - function isMinikubeRunning() { minikube_status="$(minikube status | grep minikube: 2> >(log))" if [[ ${minikube_status} == "Running" ]]; then diff --git a/scripts/get_config_value.sh b/scripts/get_config_value.sh index f3221b1..6461c2b 100755 --- a/scripts/get_config_value.sh +++ b/scripts/get_config_value.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" variable_name=$1 diff --git a/scripts/get_env_config_value.sh b/scripts/get_env_config_value.sh index 9bbc916..d8df3c1 100755 --- a/scripts/get_env_config_value.sh +++ b/scripts/get_env_config_value.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" variable_name=$1 diff --git a/scripts/guest/change_magento_config_for_functional_tests b/scripts/guest/change_magento_config_for_functional_tests index 3bad4a5..2b230c3 100755 --- a/scripts/guest/change_magento_config_for_functional_tests +++ b/scripts/guest/change_magento_config_for_functional_tests @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/check_mounted_directories b/scripts/guest/check_mounted_directories index 5651132..ee8ba16 100755 --- a/scripts/guest/check_mounted_directories +++ b/scripts/guest/check_mounted_directories @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/composer.sh b/scripts/guest/composer.sh index 499fb20..9c767e3 100755 --- a/scripts/guest/composer.sh +++ b/scripts/guest/composer.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + # This script allows to use credentials specified in etc/composer/auth.json without declaring them globally cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD @@ -11,9 +14,6 @@ incrementNestingLevel composer_auth_json="${devbox_dir}/etc/composer/auth.json" -# commented out due to composer conflicts -# ${php_executable} "${composer_phar}" global require "hirak/prestissimo:^0.3" - if [[ -f ${composer_auth_json} ]]; then status "Exporting etc/auth.json to environment variable" export COMPOSER_AUTH="$(cat "${composer_auth_json}")" @@ -24,6 +24,6 @@ if [[ -d "${DEVBOX_ROOT}/$(getContext)" ]]; then fi status "composer --no-interaction "$@"" -composer --no-interaction "$@" 2> >(log) > >(log) +composer --no-interaction "$@" decrementNestingLevel diff --git a/scripts/guest/configure_debugging b/scripts/guest/configure_debugging index 11b0e5c..a3b1e98 100755 --- a/scripts/guest/configure_debugging +++ b/scripts/guest/configure_debugging @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/configure_search_engine b/scripts/guest/configure_search_engine index 57ffad6..4d18168 100755 --- a/scripts/guest/configure_search_engine +++ b/scripts/guest/configure_search_engine @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + # Init environment variables devbox_dir="${DEVBOX_ROOT}" diff --git a/scripts/guest/configure_varnish b/scripts/guest/configure_varnish index 667074e..e8db2c2 100755 --- a/scripts/guest/configure_varnish +++ b/scripts/guest/configure_varnish @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/generate_basic_data b/scripts/guest/generate_basic_data index aa69207..2a5e0df 100755 --- a/scripts/guest/generate_basic_data +++ b/scripts/guest/generate_basic_data @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/link_configs b/scripts/guest/link_configs index 33599ed..320b38d 100755 --- a/scripts/guest/link_configs +++ b/scripts/guest/link_configs @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + #function process_configs () { # configs_path=$1 # configs=$2 diff --git a/scripts/guest/log_email b/scripts/guest/log_email index 3e0e6a8..4a87a6f 100755 --- a/scripts/guest/log_email +++ b/scripts/guest/log_email @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + email_log_dir=$1 if [[ ! -d ${email_log_dir} ]]; then mkdir -p "${email_log_dir}" @@ -28,4 +31,4 @@ echo ${raw_email_output} > "${email_file_path}" sed -i "s|.*<\!DOCTYPE|<\!DOCTYPE|g" "${email_file_path}" sed -i "s|=3D|=|g" "${email_file_path}" sed -i "s|=0A||g" "${email_file_path}" -sed -i "s|= ||g" "${email_file_path}" \ No newline at end of file +sed -i "s|= ||g" "${email_file_path}" diff --git a/scripts/guest/m-clear-cache b/scripts/guest/m-clear-cache index b78f49f..02164e0 100755 --- a/scripts/guest/m-clear-cache +++ b/scripts/guest/m-clear-cache @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/m-reinstall b/scripts/guest/m-reinstall index 9545c45..ee1c445 100755 --- a/scripts/guest/m-reinstall +++ b/scripts/guest/m-reinstall @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" @@ -7,7 +10,6 @@ source "${devbox_dir}/scripts/functions.sh" get_config_value="${devbox_dir}/scripts/get_config_value.sh" magento_host_name="$(bash ${get_config_value} "magento_host_name")" use_nfs="$(bash "${devbox_dir}/scripts/get_env_config_value.sh" "guest_use_nfs")" -is_windows_host=${IS_WINDOWS_HOST} generate_basic_data="$(bash ${get_config_value} "magento_generate_basic_data")" @@ -40,10 +42,6 @@ setupOptions[amqp_user]='admin' setupOptions[amqp_password]='123123q' setupOptions[amqp_virtualhost]='/' -#if [[ ${is_windows_host} == 1 ]] || [[ ${use_nfs} == 0 ]]; then -# sudo chown -R devbox:devbox ${DEVBOX_ROOT}/$(getContext) -#fi -# #status "Killing MQ processes" #pkill -f queue @@ -87,6 +85,9 @@ install_cmd="./bin/magento setup:install \ --admin-email=${setupOptions[admin_email]} \ --admin-user=${setupOptions[admin_user]} \ --admin-password=${setupOptions[admin_password]} \ + --elasticsearch-host=elasticsearch-master \ + --elasticsearch-port=9200 \ + --elasticsearch-index-prefix=magento2 \ --cleanup-database \ --use-rewrites=1" @@ -110,9 +111,9 @@ php ${install_cmd} 2> >(logError) > >(log) # php -d xdebug.remote_autostart=1 ${install_cmd} 2> >(logError) > >(log) status "Configuring Redis for session and as cache backend" -php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --page-cache=redis --page-cache-redis-server=magento2-redis-master -php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --cache-backend=redis --cache-backend-redis-server=magento2-redis-master -php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --session-save=redis --session-save-redis-host=magento2-redis-master +yes | php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --page-cache=redis --page-cache-redis-server=magento2-redis-master +yes | php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --cache-backend=redis --cache-backend-redis-server=magento2-redis-master +yes | php "${DEVBOX_ROOT}/$(getContext)/bin/magento" setup:config:set --session-save=redis --session-save-redis-host=magento2-redis-master if [[ $? != 0 ]]; then error "Magento installation failed." @@ -121,12 +122,6 @@ fi bash "${devbox_dir}/scripts/guest/configure_varnish" -f -# TODO: Remove -#if [[ ${is_windows_host} == 1 ]] || [[ ${use_nfs} == 0 ]]; then -# status "Changing ownership of "${DEVBOX_ROOT}/$(getContext)" to devbox:devbox" -# sudo chown -R devbox:devbox ${DEVBOX_ROOT}/$(getContext) -#fi - bash "${DEVBOX_ROOT}/scripts/guest/configure_search_engine" bash "${DEVBOX_ROOT}/scripts/guest/change_magento_config_for_functional_tests" bash "${DEVBOX_ROOT}/scripts/guest/update_magento_config" 'admin/security/session_lifetime' '86400' diff --git a/scripts/guest/m-search-engine b/scripts/guest/m-search-engine index 5b7bac2..fbe821b 100755 --- a/scripts/guest/m-search-engine +++ b/scripts/guest/m-search-engine @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/m-switch-to-ce b/scripts/guest/m-switch-to-ce index 0c05acd..7f346fb 100755 --- a/scripts/guest/m-switch-to-ce +++ b/scripts/guest/m-switch-to-ce @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD diff --git a/scripts/guest/m-switch-to-ee b/scripts/guest/m-switch-to-ee index b1e85fc..a336ce7 100755 --- a/scripts/guest/m-switch-to-ee +++ b/scripts/guest/m-switch-to-ee @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/m-varnish b/scripts/guest/m-varnish index 99d4651..fa37986 100755 --- a/scripts/guest/m-varnish +++ b/scripts/guest/m-varnish @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/relink-sample-data b/scripts/guest/relink-sample-data index 13eb79c..cbc970a 100755 --- a/scripts/guest/relink-sample-data +++ b/scripts/guest/relink-sample-data @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/unlink_configs b/scripts/guest/unlink_configs index 9f12ecd..1872744 100755 --- a/scripts/guest/unlink_configs +++ b/scripts/guest/unlink_configs @@ -1,4 +1,5 @@ -#!/usr/bin/env bash + + #function process_configs () { # configs_path=$1 diff --git a/scripts/guest/update_magento_config b/scripts/guest/update_magento_config index 347395d..782ab9e 100755 --- a/scripts/guest/update_magento_config +++ b/scripts/guest/update_magento_config @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + devbox_dir="${DEVBOX_ROOT}" source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/guest/warm_up_cache b/scripts/guest/warm_up_cache index a24ed2c..8c7eff5 100755 --- a/scripts/guest/warm_up_cache +++ b/scripts/guest/warm_up_cache @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/check_mounted_directories.sh b/scripts/host/check_mounted_directories.sh index b035b4b..8587a7b 100755 --- a/scripts/host/check_mounted_directories.sh +++ b/scripts/host/check_mounted_directories.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/check_requirements.sh b/scripts/host/check_requirements.sh index 154c8fd..52f1f47 100755 --- a/scripts/host/check_requirements.sh +++ b/scripts/host/check_requirements.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/configure_etc_hosts.sh b/scripts/host/configure_etc_hosts.sh index b02944f..8eb6101 100755 --- a/scripts/host/configure_etc_hosts.sh +++ b/scripts/host/configure_etc_hosts.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD @@ -14,13 +17,19 @@ if [[ ${debug_devbox_project} -eq 1 ]]; then set -x fi +# remove potentially stale configuration of the hosts configured by the dev box +for instance_name in $(getInstanceList); do + domain_name="$(getInstanceDomainName ${instance_name})" + sudo sed -ie "/.*${domain_name}.*/d" /etc/hosts +done + etc_hosts_records="$(bash "${devbox_dir}/scripts/host/get_etc_hosts_records.sh")" # only split with new lines IFS=$'\n' for etc_hosts_record in $(bash "${devbox_dir}/scripts/host/get_etc_hosts_records.sh"); do if [[ -z "$(grep "${etc_hosts_record}" /etc/hosts)" ]]; then status "Adding '${etc_hosts_record}' to '/etc/hosts'" - echo "${etc_hosts_record}" | sudo tee -a "/etc/hosts" 2> >(logError) > >(log) + echo -e "${etc_hosts_record}\n$(cat /etc/hosts)" | sudo tee "/etc/hosts" 2> >(logError) > >(log) else warning "'${etc_hosts_record}' has already been added to '/etc/hosts' previously" fi diff --git a/scripts/host/configure_nfs_exports.sh b/scripts/host/configure_nfs_exports.sh index 7ef412e..dff6295 100755 --- a/scripts/host/configure_nfs_exports.sh +++ b/scripts/host/configure_nfs_exports.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD diff --git a/scripts/host/configure_nginx_servers.sh b/scripts/host/configure_nginx_servers.sh index be183e8..b109f3b 100755 --- a/scripts/host/configure_nginx_servers.sh +++ b/scripts/host/configure_nginx_servers.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD diff --git a/scripts/host/configure_php_storm.sh b/scripts/host/configure_php_storm.sh index f5140cd..bd184ec 100755 --- a/scripts/host/configure_php_storm.sh +++ b/scripts/host/configure_php_storm.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/configure_tests.sh b/scripts/host/configure_tests.sh index 12a7907..f126d4e 100755 --- a/scripts/host/configure_tests.sh +++ b/scripts/host/configure_tests.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" @@ -28,13 +31,11 @@ if [[ ! -f "${magento_tests_root}/integration/phpunit.xml" ]] && [[ -f "${magent if [[ ! -f "${magento_tests_root}/integration/etc/install-config-mysql.php" ]] && [[ -f "${magento_tests_root}/integration/etc/install-config-mysql.php.dist" ]]; then cp "${magento_tests_root}/integration/etc/install-config-mysql.php.dist" "${magento_tests_root}/integration/etc/install-config-mysql.php" - sed -i.back "s|'db-password' => '123123q'|'db-password' => ''|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" - sed -i.back "s|\];|\\ - 'amqp-host' => 'localhost',\\ - 'amqp-port' => '5672',\\ - 'amqp-user' => 'guest',\\ - 'amqp-password' => 'guest'\\ -];|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" + sed -i.back "s|'db-host' => 'localhost'|'db-host' => 'magento2-mysql'|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" + sed -i.back "s|'db-name' => 'magento_integration_tests'|'db-name' => 'magento_$(getContext)_integration_tests'|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" + sed -i.back "s|'amqp-host' => 'localhost'|'amqp-host' => 'magento2-rabbitmq'|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" + sed -i.back "s|'amqp-user' => 'guest'|'amqp-user' => 'admin'|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" + sed -i.back "s|'amqp-password' => 'guest'|'amqp-password' => '123123q'|g" "${magento_tests_root}/integration/etc/install-config-mysql.php" rm -f "${magento_tests_root}/integration/etc/install-config-mysql.php.back" fi fi diff --git a/scripts/host/configure_ubuntu_travis.sh b/scripts/host/configure_ubuntu_travis.sh index a70f1d9..65efd78 100644 --- a/scripts/host/configure_ubuntu_travis.sh +++ b/scripts/host/configure_ubuntu_travis.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD cd "${devbox_dir}" @@ -9,7 +12,7 @@ find ./tests/_files/ -type f | xargs sed -i "s|git@github.com:|https://github.co sed -i "s|php_executable=\"php\"|php_executable=\"/home/travis/.phpenv/shims/php\"|g" ./scripts/host/get_path_to_php.sh # TODO: Make configurable and enable for specific tests # sed -i "s|git clone|git clone --depth 1 |g" ./init_project.sh -sed -i "s|minikube start -v=0 --cpus=2 --memory=4096|sudo minikube start -v=0 --cpus=2 --memory=4096 --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=v1.13.0|g" ./init_project.sh +sed -i "s|minikube start --kubernetes-version=v1.15.6 -v=0 --cpus=2 --memory=4096|sudo minikube start --kubernetes-version=v1.15.6 -v=0 --cpus=2 --memory=4096 --vm-driver=none --bootstrapper=kubeadm|g" ./init_project.sh sed -i "s|&& eval \$(minikube docker-env) ||g" ./scripts/host/k_install_environment.sh sed -i "s|&& eval \$(minikube docker-env) ||g" ./scripts/host/k_upgrade_environment.sh sed -i "s/use_nfs:\ 1/use_nfs:\ 0/g" ./etc/env/config.yaml.dist diff --git a/scripts/host/get_etc_hosts_records.sh b/scripts/host/get_etc_hosts_records.sh index 0439849..23c8363 100755 --- a/scripts/host/get_etc_hosts_records.sh +++ b/scripts/host/get_etc_hosts_records.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/get_host_os.sh b/scripts/host/get_host_os.sh index 2b89b17..1a838ec 100755 --- a/scripts/host/get_host_os.sh +++ b/scripts/host/get_host_os.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/get_nfs_exports_record.sh b/scripts/host/get_nfs_exports_record.sh index 33e8a78..73bd79c 100755 --- a/scripts/host/get_nfs_exports_record.sh +++ b/scripts/host/get_nfs_exports_record.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/get_path_to_php.sh b/scripts/host/get_path_to_php.sh index 101b480..48bec6d 100755 --- a/scripts/host/get_path_to_php.sh +++ b/scripts/host/get_path_to_php.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/helm_delete_wait.sh b/scripts/host/helm_delete_wait.sh index 38e76f6..414f672 100755 --- a/scripts/host/helm_delete_wait.sh +++ b/scripts/host/helm_delete_wait.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/init_instance.sh b/scripts/host/init_instance.sh index 6a58e49..74861af 100755 --- a/scripts/host/init_instance.sh +++ b/scripts/host/init_instance.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" @@ -22,7 +25,6 @@ host_os="$(bash "${devbox_dir}/scripts/host/get_host_os.sh")" use_nfs="$(bash "${devbox_dir}/scripts/get_env_config_value.sh" "guest_use_nfs")" nfs_server_ip="$(bash "${devbox_dir}/scripts/get_env_config_value.sh" "guest_nfs_server_ip")" repository_url_ce="$(bash "${devbox_dir}/scripts/get_config_value.sh" "repository_url_ce")" -#repository_url_checkout="$(bash "${devbox_dir}/scripts/get_config_value.sh" "repository_url_checkout")" repository_url_ee="$(bash "${devbox_dir}/scripts/get_config_value.sh" "repository_url_ee")" composer_project_name="$(bash "${devbox_dir}/scripts/get_config_value.sh" "composer_project_name")" composer_project_url="$(bash "${devbox_dir}/scripts/get_config_value.sh" "composer_project_url")" diff --git a/scripts/host/install_php.sh b/scripts/host/install_php.sh index f089326..d97d3bb 100755 --- a/scripts/host/install_php.sh +++ b/scripts/host/install_php.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/k_install_environment.sh b/scripts/host/k_install_environment.sh index 4c4fd35..5de3c72 100755 --- a/scripts/host/k_install_environment.sh +++ b/scripts/host/k_install_environment.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" @@ -7,6 +10,7 @@ source "${devbox_dir}/scripts/functions.sh" ## TODO: Add status messages cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev -f ../etc/docker/monolith/Dockerfile ../scripts cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev-xdebug -f ../etc/docker/monolith-with-xdebug/Dockerfile ../scripts +cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev-xdebug-and-ssh -f ../etc/docker/monolith-with-xdebug-and-ssh/Dockerfile ../scripts # TODO: Repeat for other deployments, not just Magento 2 # See https://github.com/kubernetes/kubernetes/issues/33664#issuecomment-386661882 diff --git a/scripts/host/k_upgrade_environment.sh b/scripts/host/k_upgrade_environment.sh index e8846c1..7400d7c 100755 --- a/scripts/host/k_upgrade_environment.sh +++ b/scripts/host/k_upgrade_environment.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" @@ -7,6 +10,7 @@ source "${devbox_dir}/scripts/functions.sh" ## TODO: Add status messages cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev -f ../etc/docker/monolith/Dockerfile ../scripts cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev-xdebug -f ../etc/docker/monolith-with-xdebug/Dockerfile ../scripts +cd "${devbox_dir}/scripts" && eval $(minikube docker-env) && docker build -t magento2-monolith:dev-xdebug-and-ssh -f ../etc/docker/monolith-with-xdebug-and-ssh/Dockerfile ../scripts # TODO: Repeat for other deployments, not just Magento 2 # See https://github.com/kubernetes/kubernetes/issues/33664#issuecomment-386661882 diff --git a/scripts/host/m_clear_cache.sh b/scripts/host/m_clear_cache.sh index f723a06..4181cb7 100755 --- a/scripts/host/m_clear_cache.sh +++ b/scripts/host/m_clear_cache.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/m_composer.sh b/scripts/host/m_composer.sh index e4cf3f6..2f0f63b 100755 --- a/scripts/host/m_composer.sh +++ b/scripts/host/m_composer.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" @@ -9,4 +12,4 @@ cd "${devbox_dir}" # TODO: parameterize container arguments=$@ -executeInMagento2Container -- "${devbox_dir}/scripts/guest/composer.sh" ${arguments} 2> >(logError) +executeInMagento2Container -- "${devbox_dir}/scripts/guest/composer.sh" ${arguments} diff --git a/scripts/host/m_reinstall.sh b/scripts/host/m_reinstall.sh index da3325b..23ccd8d 100755 --- a/scripts/host/m_reinstall.sh +++ b/scripts/host/m_reinstall.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/m_switch_to_ce.sh b/scripts/host/m_switch_to_ce.sh index a4947f9..c8a6ebf 100755 --- a/scripts/host/m_switch_to_ce.sh +++ b/scripts/host/m_switch_to_ce.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/m_switch_to_ee.sh b/scripts/host/m_switch_to_ee.sh index d131949..dcb0352 100755 --- a/scripts/host/m_switch_to_ee.sh +++ b/scripts/host/m_switch_to_ee.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/scripts/host/warm_up_cache.sh b/scripts/host/warm_up_cache.sh index 7204685..2303f81 100755 --- a/scripts/host/warm_up_cache.sh +++ b/scripts/host/warm_up_cache.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + cd "$(dirname "${BASH_SOURCE[0]}")/../.." && devbox_dir=$PWD source "${devbox_dir}/scripts/functions.sh" diff --git a/tests/Ce23WithSampleDataMysqlSearchNoNfsTest.sh b/tests/Ce24WithSampleDataMysqlSearchNoNfsTest.sh similarity index 82% rename from tests/Ce23WithSampleDataMysqlSearchNoNfsTest.sh rename to tests/Ce24WithSampleDataMysqlSearchNoNfsTest.sh index 299279c..885d26b 100755 --- a/tests/Ce23WithSampleDataMysqlSearchNoNfsTest.sh +++ b/tests/Ce24WithSampleDataMysqlSearchNoNfsTest.sh @@ -49,17 +49,18 @@ See logs in ${logs_dir}" ## Tests -function testCe23WithSampleDataMysqlSearchNoNfs() +function testCe24WithSampleDataMysqlSearchNoNfs() { - current_config_name="ce23_with_sample_data_mysql_search_no_nfs" + current_config_name="ce24_with_sample_data_mysql_search_no_nfs" installEnvironment - assertSourceCodeIsFromBranch "${devbox_dir}/default" "2.3" - assertSourceCodeIsFromBranch "${devbox_dir}/default/magento2-sample-data" "2.3" + assertSourceCodeIsFromBranch "${devbox_dir}/default" "2.4-develop" + assertSourceCodeIsFromBranch "${devbox_dir}/default/magento2-sample-data" "2.4-develop" executeBasicCommonAssertions - assertCeSampleDataInstalled + # TODO: Fix Sample Data assertion +# assertCeSampleDataInstalled assertMagentoEditionIsCE assertElasticSearchDisabled diff --git a/tests/MultiInstanceWithCeFromComposerNoNfsTest.sh b/tests/MultiInstanceWithCeFromComposerNoNfsTest.sh index 5847b0f..875f912 100755 --- a/tests/MultiInstanceWithCeFromComposerNoNfsTest.sh +++ b/tests/MultiInstanceWithCeFromComposerNoNfsTest.sh @@ -80,6 +80,12 @@ function testMultiInstanceWithCeFromComposerNoNfs() executeExtendedCommonAssertions assertMainPageServedByBuiltInCache + + assertMagentoUnitTestsWork + assertMagentoIntegrationTestsWork + assertMagentoGraphQlTestsWork + assertMagentoRestTestsWork + assertMagentoSoapTestsWork } ## Call and Run all Tests diff --git a/tests/NoCustomConfigBasicTest.sh b/tests/NoCustomConfigBasicTest.sh index ce513cf..86e33d8 100755 --- a/tests/NoCustomConfigBasicTest.sh +++ b/tests/NoCustomConfigBasicTest.sh @@ -58,6 +58,7 @@ function testNoCustomConfigBasic() assertMagentoEditionIsCE assertCeSampleDataNotInstalled assertRedisCacheIsEnabled + assertRemotePhpWorks } ## Call and Run all Tests diff --git a/tests/README.md b/tests/README.md index 4c78c26..c84968c 100644 --- a/tests/README.md +++ b/tests/README.md @@ -7,4 +7,4 @@ Current project contains functional tests for [Kubernetes DevBox for Magento 2 D 1. Make sure that your host meets requirements listed [here](https://github.com/magento/magento2-kubernetes-devbox#requirements) 1. Copy [configuration.sh.dist](include/configuration.sh.dist) to `include/configuration.sh` and make necessary changes 1. Copy [auth.json.dist](include/auth.json.dist) to `include/auth.json` and add valid keys. This step is required only for testing of Composer-based installations - 1. Run [testsuite.sh](testsuite.sh) in bash + 1. Run [NoCustomConfigBasicTest.sh](NoCustomConfigBasicTest.sh) or any other test in bash diff --git a/tests/_files/etc/ce23_with_sample_data_mysql_search_no_nfs/env/config.yaml b/tests/_files/etc/ce24_with_sample_data_mysql_search_no_nfs/env/config.yaml similarity index 100% rename from tests/_files/etc/ce23_with_sample_data_mysql_search_no_nfs/env/config.yaml rename to tests/_files/etc/ce24_with_sample_data_mysql_search_no_nfs/env/config.yaml diff --git a/tests/_files/etc/ce23_with_sample_data_mysql_search_no_nfs/instance/default.yaml b/tests/_files/etc/ce24_with_sample_data_mysql_search_no_nfs/instance/default.yaml similarity index 94% rename from tests/_files/etc/ce23_with_sample_data_mysql_search_no_nfs/instance/default.yaml rename to tests/_files/etc/ce24_with_sample_data_mysql_search_no_nfs/instance/default.yaml index 630cd6f..e6d6a17 100644 --- a/tests/_files/etc/ce23_with_sample_data_mysql_search_no_nfs/instance/default.yaml +++ b/tests/_files/etc/ce24_with_sample_data_mysql_search_no_nfs/instance/default.yaml @@ -15,11 +15,11 @@ repository_url: # [To apply changes: init_project.sh -fc] # git@github.com:magento/magento2ce.git OR custom one. Use '::' to specify a specific branch, e.g: git@github.com:magento/magento2.git::2.1 - ce: "git@github.com:magento/magento2.git::2.3" + ce: "git@github.com:magento/magento2.git::2.4-develop" # git@github.com:magento/magento2ee.git OR custom one ee: "" additional_repositories: - - "git@github.com:magento/magento2-sample-data.git::2.3" + - "git@github.com:magento/magento2-sample-data.git::2.4-develop" # - "git@github.com:magento/magento2-sample-data-ee.git" # - "git@github.com:magento/magento2b2b.git" # If set to 1, shallow clone will be used to speed up the project initialization diff --git a/tests/_files/run_command_over_ssh_in_cluster.sh b/tests/_files/run_command_over_ssh_in_cluster.sh new file mode 100755 index 0000000..eee60ff --- /dev/null +++ b/tests/_files/run_command_over_ssh_in_cluster.sh @@ -0,0 +1,13 @@ +#!/usr/bin/expect -f + +set arguments [lindex $argv 0] + +set timeout -1 + +spawn ssh root@magento.default -p 30022 -o "StrictHostKeyChecking no" -- "${arguments}" + +expect "root@magento.default's password: " + +send "123123q\r" + +expect eof diff --git a/tests/include/assertions.sh b/tests/include/assertions.sh index 813ae96..21fdb86 100755 --- a/tests/include/assertions.sh +++ b/tests/include/assertions.sh @@ -39,6 +39,8 @@ function executeExtendedCommonAssertions() assertElasticSearchEnabled assertElasticSearchDisablingWorks assertElasticSearchEnablingWorks + + assertXdebugContainerWorks } ## Assertions @@ -532,3 +534,74 @@ function assertDevBoxContext() assertTrue "Context switching does not work. Actual context: '$(getDevBoxContext)'; Expected context: '${context}'" '[[ $(getDevBoxContext) == ${context} ]]' } + +function assertRemotePhpWorks() +{ + echo "${blue}## assertRemotePhpWorks${regular}" + echo "## assertRemotePhpWorks" >>${current_log_file_path} + + remote_php_version_contents="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php -v")" + + assertTrue "Remote PHP is not accessible ('php -v' failed to execute over ssh)." '[[ ${remote_php_version_contents} =~ "with Xdebug" ]]' +} + +function assertXdebugContainerWorks() +{ + echo "${blue}## assertXdebugContainerWorks${regular}" + echo "## assertXdebugContainerWorks" >>${current_log_file_path} + + cd ${tests_dir} + magento_page_content="$(curl -sL --cookie "XDEBUG_SESSION=PHPSTORM" "${current_magento_base_url}/customer/account/create/")" + pattern="Magento.* All rights reserved." + assertTrue "Account creation page is not accessible when queried with XDEBUG_SESSION cookie. URL: '${current_magento_base_url}/customer/account/create/'" '[[ ${magento_page_content} =~ ${pattern} ]]' +} + +function assertMagentoUnitTestsWork() +{ + echo "${blue}## assertMagentoUnitTestsWork${regular}" + echo "## assertMagentoUnitTestsWork" >>${current_log_file_path} + + remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/unit/phpunit.xml' --filter testGetAttributes '${devbox_dir}/$(getDevBoxContext)/vendor/magento/module-catalog/Test/Unit/Model/ProductTest.php'")" + + assertTrue "Unit tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]' +} + +function assertMagentoIntegrationTestsWork() +{ + echo "${blue}## assertMagentoIntegrationTestsWork${regular}" + echo "## assertMagentoIntegrationTestsWork" >>${current_log_file_path} + + remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/phpunit.xml' --filter testGetAddressById '${devbox_dir}/$(getDevBoxContext)/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php'")" + + assertTrue "Integration tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (2 tests, 3 assertions)" ]]' +} + +function assertMagentoGraphQlTestsWork() +{ + echo "${blue}## assertMagentoGraphQlTestsWork${regular}" + echo "## assertMagentoGraphQlTestsWork" >>${current_log_file_path} + + remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_graphql.xml' --filter testUpdateCustomerIfInputDataIsEmpty '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php'")" + + assertTrue "GraphQL tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]' +} + +function assertMagentoRestTestsWork() +{ + echo "${blue}## assertMagentoRestTestsWork${regular}" + echo "## assertMagentoRestTestsWork" >>${current_log_file_path} + + remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_rest.xml' --filter testGetForMyCart '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/GiftMessage/Api/CartRepositoryTest.php'")" + + assertTrue "REST tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 2 assertions)" ]]' +} + +function assertMagentoSoapTestsWork() +{ + echo "${blue}## assertMagentoSoapTestsWork${regular}" + echo "## assertMagentoSoapTestsWork" >>${current_log_file_path} + + remote_test_execution_status="$(expect "${tests_dir}/_files/run_command_over_ssh_in_cluster.sh" "php '${devbox_dir}/$(getDevBoxContext)/vendor/phpunit/phpunit/phpunit' --configuration '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/phpunit_soap.xml' --filter testCreateGroupWithIdSoap '${devbox_dir}/$(getDevBoxContext)/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php'")" + + assertTrue "SOAP tests are not configured properly (failed to run them over ssh)." '[[ ${remote_test_execution_status} =~ "OK (1 test, 1 assertion)" ]]' +}