├── .gitignore
├── .gitpod.Dockerfile
├── .gitpod.yml
├── .vscode
└── launch.json
├── LICENSE
├── README.md
├── cypress.config.js
├── cypress
└── e2e
│ └── test
│ └── index.cy.js
└── gitpod
├── .my.cnf
├── client.cnf
├── default.vcl
├── end-2-end-test.yml
├── m2-install.sh
├── mysql.cnf
├── mysql.conf
├── nginx-varnish.conf
├── nginx.conf
├── php-fpm.conf
├── sp-elasticsearch.conf
├── sp-php-fpm.conf
└── sp-redis.conf
/.gitignore:
--------------------------------------------------------------------------------
1 | /.buildpath
2 | /.cache
3 | /.metadata
4 | /.project
5 | /.settings
6 | /.vscode
7 | atlassian*
8 | /nbproject
9 | /robots.txt
10 | /pub/robots.txt
11 | /sitemap
12 | /sitemap.xml
13 | /pub/sitemap
14 | /pub/sitemap.xml
15 | /.idea
16 | /.gitattributes
17 | /app/config_sandbox
18 | /app/etc/config.php
19 | /app/etc/env.php
20 | /app/code/Magento/TestModule*
21 | /lib/internal/flex/uploader/.actionScriptProperties
22 | /lib/internal/flex/uploader/.flexProperties
23 | /lib/internal/flex/uploader/.project
24 | /lib/internal/flex/uploader/.settings
25 | /lib/internal/flex/varien/.actionScriptProperties
26 | /lib/internal/flex/varien/.flexLibProperties
27 | /lib/internal/flex/varien/.project
28 | /lib/internal/flex/varien/.settings
29 | /node_modules
30 | /.grunt
31 | /Gruntfile.js
32 | /package.json
33 | /.php_cs
34 | /.php_cs.cache
35 | /.php-cs-fixer.php
36 | /.php-cs-fixer.cache
37 | /grunt-config.json
38 | /pub/media/*.*
39 | !/pub/media/.htaccess
40 | /pub/media/attribute/*
41 | !/pub/media/attribute/.htaccess
42 | /pub/media/analytics/*
43 | /pub/media/catalog/*
44 | !/pub/media/catalog/.htaccess
45 | /pub/media/customer/*
46 | !/pub/media/customer/.htaccess
47 | /pub/media/downloadable/*
48 | !/pub/media/downloadable/.htaccess
49 | /pub/media/favicon/*
50 | /pub/media/import/*
51 | !/pub/media/import/.htaccess
52 | /pub/media/logo/*
53 | /pub/media/custom_options/*
54 | !/pub/media/custom_options/.htaccess
55 | /pub/media/theme/*
56 | /pub/media/theme_customization/*
57 | !/pub/media/theme_customization/.htaccess
58 | /pub/media/wysiwyg/*
59 | !/pub/media/wysiwyg/.htaccess
60 | /pub/media/tmp/*
61 | !/pub/media/tmp/.htaccess
62 | /pub/media/captcha/*
63 | /pub/media/sitemap/*
64 | !/pub/media/sitemap/.htaccess
65 | /pub/static/*
66 | !/pub/static/.htaccess
67 |
68 | /var/*
69 | !/var/.htaccess
70 | /vendor/*
71 | !/vendor/.htaccess
72 | /generated/*
73 | !/generated/.htaccess
74 |
75 | .DS_Store
76 | /gitpod/db-installed.flag
77 | /mysql/*
78 | /gitpod/teague-stripped.sql
79 | /gitpod/teague_m2.sql
80 | /magento2/*
81 |
--------------------------------------------------------------------------------
/.gitpod.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM gitpod/workspace-full:latest
2 |
3 | # Magento Config
4 | ENV INSTALL_MAGENTO YES
5 | ENV MAGENTO_VERSION 2.4.7-p3
6 | ENV MAGENTO_ADMIN_EMAIL admin@magento.com
7 | ENV MAGENTO_ADMIN_PASSWORD password1
8 | ENV MAGENTO_ADMIN_USERNAME admin
9 | ENV MAGENTO_COMPOSER_AUTH_USER 64229a8ef905329a184da4f174597d25
10 | ENV MAGENTO_COMPOSER_AUTH_PASS a0df0bec06011c7f1e8ea8833ca7661e
11 | ENV MAGENTO_INSTALL_MAGE_CACHE_CLEANER YES
12 |
13 | # Platform Config
14 | ENV PHP_VERSION 8.3
15 | ENV PERCONA_MAJOR 5.7
16 | ENV ELASTICSEARCH_VERSION 7.9.3
17 | ENV COMPOSER_VERSION 2.7.6
18 | ENV NODE_VERSION 14.17.3
19 | ENV MYSQL_ROOT_PASSWORD nem4540
20 | ENV XDEBUG_DEFAULT_ENABLED YES
21 |
22 | # add node and npm to path so the commands are available
23 | ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
24 | ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
25 |
26 | RUN sudo apt-get update
27 | RUN sudo apt-get -y install lsb-release
28 | RUN sudo apt-get -y install apt-utils
29 | RUN sudo apt-get -y install python-is-python3
30 | RUN sudo apt-get install -y libmysqlclient-dev
31 | RUN sudo apt-get -y install rsync
32 | RUN sudo apt-get -y install curl
33 | RUN sudo apt-get -y install libnss3-dev
34 | RUN sudo apt-get -y install openssh-client
35 | RUN sudo apt-get -y install mc
36 | RUN sudo apt install -y software-properties-common
37 | RUN sudo apt-get -y install gcc make autoconf libc-dev pkg-config
38 | RUN sudo apt-get -y install libmcrypt-dev
39 | RUN sudo mkdir -p /tmp/pear/cache
40 | RUN sudo mkdir -p /etc/bash_completion.d/cargo
41 | RUN sudo apt install -y php-dev
42 | RUN sudo apt install -y php-pear
43 | RUN sudo install-packages php-xdebug
44 |
45 | #Install php-fpm
46 | RUN sudo apt-get update \
47 | && sudo apt-get install -y curl zip unzip git supervisor sqlite3 \
48 | && sudo apt update && sudo apt -y upgrade \
49 | && sudo apt install ca-certificates apt-transport-https -y \
50 | && sudo add-apt-repository ppa:ondrej/php \
51 | && sudo apt-get update \
52 | && sudo apt-get install -y php${PHP_VERSION}-dev php${PHP_VERSION}-fpm php${PHP_VERSION}-common php${PHP_VERSION}-cli php${PHP_VERSION}-imagick php${PHP_VERSION}-gd php${PHP_VERSION}-mysql php${PHP_VERSION}-pgsql php${PHP_VERSION}-imap php-memcached php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php${PHP_VERSION}-xmlrpc php${PHP_VERSION}-soap php${PHP_VERSION}-zip php${PHP_VERSION}-curl php${PHP_VERSION}-bcmath php${PHP_VERSION}-sqlite3 php${PHP_VERSION}-intl php-dev php${PHP_VERSION}-dev php${PHP_VERSION}-xdebug php-redis \
53 | && sudo php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --version=${COMPOSER_VERSION} --filename=composer \
54 | && sudo chown -R gitpod:gitpod /etc/php \
55 | && sudo apt-get remove -y --purge software-properties-common \
56 | && sudo apt-get -y autoremove \
57 | && sudo apt-get clean \
58 | && sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
59 | && sudo update-alternatives --set php /usr/bin/php${PHP_VERSION} \
60 | && sudo echo "daemon off;" >> /etc/nginx/nginx.conf
61 |
62 | #Adjust few options for xDebug and disable it by default
63 | RUN sudo echo "xdebug.remote_enable=on" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini
64 | #&& echo "xdebug.remote_autostart=on" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini
65 | #&& echo "xdebug.profiler_enable=On" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini \
66 | #&& echo "xdebug.profiler_output_dir = /var/log/" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini \
67 | #&& echo "xdebug.profiler_output_name = gitpod_xdebug.log >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini \
68 | #&& echo "xdebug.show_error_trace=On" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini \
69 | #&& echo "xdebug.show_exception_trace=On" >> /etc/php/${PHP_VERSION}/mods-available/xdebug.ini
70 |
71 | RUN if [ ! "$XDEBUG_DEFAULT_ENABLED" = "YES" ]; then sudo mv /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini-bak; fi
72 |
73 | # Install MySQL
74 | RUN sudo apt-get update \
75 | && sudo apt-get -y install gnupg2 \
76 | && sudo apt-get clean && sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/* \
77 | && sudo mkdir /var/run/mysqld \
78 | && sudo wget -c https://repo.percona.com/apt/percona-release_latest.stretch_all.deb \
79 | && sudo dpkg -i percona-release_latest.stretch_all.deb \
80 | && sudo apt-get update
81 |
82 | RUN set -ex; \
83 | { \
84 | for key in \
85 | percona-server-server/root_password \
86 | percona-server-server/root_password_again \
87 | "percona-server-server-${PERCONA_MAJOR}/root-pass" \
88 | "percona-server-server-${PERCONA_MAJOR}/re-root-pass" \
89 | ; do \
90 | sudo echo "percona-server-server-${PERCONA_MAJOR}" "$key" password ${MYSQL_ROOT_PASSWORD}; \
91 | done; \
92 | } | sudo debconf-set-selections; \
93 | sudo apt-get update; \
94 | sudo percona-release setup ps-57; \
95 | sudo apt-get install -y \
96 | percona-server-server-${PERCONA_MAJOR} percona-server-client-${PERCONA_MAJOR} percona-server-common-${PERCONA_MAJOR} \
97 | ;
98 |
99 | RUN sudo chown -R gitpod:gitpod /etc/mysql /var/run/mysqld /var/log/mysql /var/lib/mysql /var/lib/mysql-files /var/lib/mysql-keyring
100 |
101 | # Install our own MySQL config
102 | COPY gitpod/mysql.cnf /etc/mysql/conf.d/mysqld.cnf
103 | COPY gitpod/.my.cnf /home/gitpod/.my.cnf
104 | COPY gitpod/mysql.conf /etc/supervisor/conf.d/mysql.conf
105 | RUN sudo chown gitpod:gitpod /home/gitpod/.my.cnf
106 |
107 | # Install default-login for MySQL clients
108 | COPY gitpod/client.cnf /etc/mysql/conf.d/client.cnf
109 |
110 | #Copy nginx default and php-fpm.conf file
111 | #COPY default /etc/nginx/sites-available/default
112 | COPY gitpod/php-fpm.conf /etc/php/${PHP_VERSION}/fpm/php-fpm.conf
113 | COPY gitpod/sp-php-fpm.conf /etc/supervisor/conf.d/sp-php-fpm.conf
114 | RUN sudo chown -R gitpod:gitpod /etc/php
115 |
116 | COPY gitpod/nginx.conf /etc/nginx
117 |
118 | # Install Redis.
119 | RUN sudo apt-get update \
120 | && sudo apt-get install -y \
121 | redis-server \
122 | && sudo rm -rf /var/lib/apt/lists/*
123 |
124 | #n98-magerun2 tool
125 | RUN wget https://files.magerun.net/n98-magerun2.phar \
126 | && chmod +x ./n98-magerun2.phar \
127 | && sudo mv ./n98-magerun2.phar /usr/local/bin/n98-magerun2
128 |
129 | RUN sudo chown -R gitpod:gitpod /etc/php
130 | RUN sudo chown -R gitpod:gitpod /etc/nginx
131 | RUN sudo chown -R gitpod:gitpod /etc/init.d/
132 | RUN sudo echo "net.core.somaxconn=65536" | sudo tee /etc/sysctl.conf
133 |
134 | RUN sudo rm -f /usr/bin/php
135 | RUN sudo ln -s /usr/bin/php${PHP_VERSION} /usr/bin/php
136 |
137 | # Cypress testing support
138 | RUN sudo apt-get update
139 | RUN sudo apt-get install -y xvfb
140 | RUN sudo apt-get install -y xauth
141 | RUN sudo apt-get install -y libxtst6
142 | RUN sudo apt-get install -y libasound2
143 | RUN sudo apt-get install -y libxss1
144 | RUN sudo apt-get install -y libgconf-2-4
145 | RUN sudo apt-get install -y libnotify-dev
146 | RUN sudo apt-get install -y libgbm-dev
147 | RUN sudo apt-get install -y libgtk-3-0
148 | RUN sudo apt-get install -y libgtk2.0
149 |
150 | # nvm environment variables
151 | RUN sudo mkdir -p /usr/local/nvm
152 | RUN sudo chown gitpod:gitpod /usr/local/nvm
153 | ENV NVM_DIR /usr/local/nvm
154 |
155 | # Replace shell with bash so we can source files.
156 | RUN sudo rm /bin/sh && sudo ln -s /bin/bash /bin/sh
157 |
158 | # install nvm
159 | # https://github.com/creationix/nvm#install-script.
160 | RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
161 |
162 | # install node and npm, set default alias
163 | RUN source $NVM_DIR/nvm.sh \
164 | && nvm install $NODE_VERSION \
165 | && nvm alias default $NODE_VERSION \
166 | && nvm use default
167 |
168 | RUN curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz --output elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz \
169 | && tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz
170 | ENV ES_HOME="$HOME/elasticsearch-${ELASTICSEARCH_VERSION}"
171 |
172 | COPY gitpod/sp-elasticsearch.conf /etc/supervisor/conf.d/elasticsearch.conf
173 |
--------------------------------------------------------------------------------
/.gitpod.yml:
--------------------------------------------------------------------------------
1 | image:
2 | file: .gitpod.Dockerfile
3 | ports:
4 | - port: 1000-9999
5 | onOpen: ignore
6 | - port: 8002
7 | visibility: public
8 | onOpen: open-preview
9 | name: Magento - Nginx
10 | description: Magento Application
11 | - port: 15672
12 | visibility: public
13 | name: RabbitMQ
14 | description: RabbitMQ Webinterface
15 | onOpen: ignore
16 | - port: 8025
17 | visibility: private
18 | name: Mailpit
19 | description: Mailpit Webinterface
20 | onOpen: ignore
21 | - port: 49152
22 | visibility: private
23 | name: TabNine-vscode
24 | description: TabNine.tabnine-vscode
25 | onOpen: ignore
26 | - port: 9200
27 | visibility: private
28 | name: ElasticSearch
29 | description: ElasticSearch Server
30 | onOpen: ignore
31 | vscode:
32 | extensions:
33 | - TabNine.tabnine-vscode@3.4.14
34 | - felixfbecker.php-debug@1.16.0
35 | tasks:
36 | - init: >
37 | sudo composer self-update &&
38 | cd $GITPOD_REPO_ROOT &&
39 | composer config -g -a http-basic.repo.magento.com ${MAGENTO_COMPOSER_AUTH_USER} ${MAGENTO_COMPOSER_AUTH_PASS} &&
40 | composer create-project --no-interaction --no-progress --repository-url=https://repo.magento.com/ magento/project-community-edition=${MAGENTO_VERSION} magento2 &&
41 | cd magento2 && cp -avr .* $GITPOD_REPO_ROOT;
42 | cd $GITPOD_REPO_ROOT && rm -r -f magento2 && git checkout -- .gitignore;
43 | if [[ $MAGENTO_INSTALL_MAGE_CACHE_CLEANER == YES ]]; then composer require --dev mage2tv/magento-cache-clean; fi;
44 | npm install cypress --save-dev;
45 | mkdir -p .github/workflows && cp $GITPOD_REPO_ROOT/gitpod/end-2-end-test.yml .github/workflows/end-2-end-test.yml
46 | command: gp ports await 3306 &&
47 | cd $GITPOD_REPO_ROOT &&
48 | test ! -f $GITPOD_REPO_ROOT/gitpod/db-installed.flag && $GITPOD_REPO_ROOT/gitpod/m2-install.sh ;
49 | url=$(gp url | awk -F"//" {'print $2'}) && url="https://8002-"$url"/" &&
50 | php bin/magento config:set web/unsecure/base_url $url &&
51 | php bin/magento config:set web/unsecure/base_link_url $url &&
52 | php bin/magento config:set web/secure/base_url $url &&
53 | gp sync-done mage-ready
54 | - name: "Supervisor Services"
55 | command: cd $GITPOD_REPO_ROOT &&
56 | test ! -f $GITPOD_REPO_ROOT/gitpod/db-installed.flag && sudo mv /var/lib/mysql $GITPOD_REPO_ROOT/ ;
57 | sudo sed -i 's#$GITPOD_REPO_ROOT#'$GITPOD_REPO_ROOT'#g' /etc/supervisor/conf.d/sp-php-fpm.conf &&
58 | sudo sed -i 's#$PHP_VERSION#'$PHP_VERSION'#g' /etc/supervisor/conf.d/sp-php-fpm.conf &&
59 | sudo cp $GITPOD_REPO_ROOT/gitpod/sp-redis.conf /etc/supervisor/conf.d/redis.conf &&
60 | sudo sed -i 's#$ELASTICSEARCH_VERSION#'$ELASTICSEARCH_VERSION'#g' $GITPOD_REPO_ROOT/gitpod/sp-elasticsearch.conf &&
61 | sudo cp $GITPOD_REPO_ROOT/gitpod/sp-elasticsearch.conf /etc/supervisor/conf.d/elasticsearch.conf &&
62 | sudo sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf &&
63 | sed -i 's#/var/lib/mysql#'$GITPOD_REPO_ROOT'/mysql#g' /etc/mysql/conf.d/mysqld.cnf &&
64 | sudo sed -i 's#/var/lib/mysql#'$GITPOD_REPO_ROOT'/mysql#g' /etc/supervisor/conf.d/mysql.conf &&
65 | docker run -d --restart unless-stopped --name=mailpit -p 8025:8025 -p 1025:1025 axllent/mailpit ;
66 | sudo /etc/init.d/supervisor start
67 | - name: "Nginx"
68 | command: gp ports await 3306 &&
69 | sudo sed -i 's#$GITPOD_REPO_ROOT#'$GITPOD_REPO_ROOT'#g' /etc/nginx/nginx.conf &&
70 | service nginx start
71 | - name: "Mage Cache Cleaner"
72 | init: gp sync-await mage-ready
73 | command: if grep -q mage2tv/magento-cache-clean $GITPOD_REPO_ROOT/composer.json; then
74 | vendor/bin/cache-clean.js --watch;
75 | else
76 | exit;
77 | fi;
78 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Launch Magento with Xdebug",
9 | "type": "php",
10 | "request": "launch",
11 | "runtimeArgs": [
12 | "-dxdebug.mode=debug",
13 | "-dxdebug.start_with_request=yes",
14 | "-S",
15 | "localhost:0"
16 | ],
17 | "program": "",
18 | "cwd": "${workspaceRoot}/pub/",
19 | "port": 9003,
20 | "serverReadyAction": {
21 | "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
22 | "uriFormat": "http://localhost:%s",
23 | "action": "openExternally"
24 | }
25 | },
26 | {
27 | "name": "Launch currently open PHP script",
28 | "type": "php",
29 | "request": "launch",
30 | "program": "${file}",
31 | "cwd": "${fileDirname}",
32 | "port": 0,
33 | "runtimeArgs": [
34 | "-dxdebug.start_with_request=yes"
35 | ],
36 | "env": {
37 | "XDEBUG_MODE": "debug,develop",
38 | "XDEBUG_CONFIG": "client_port=${port}"
39 | }
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Gitpod Magento 2 Cloud Development Environment
2 |
3 | ## Introduction
4 | This repository serves as a springboard to launch fully-configured Magento 2 CDE Cloud Development Environments using Gitpod.
5 |
6 |
7 | ## Getting Started
8 | Register for a free Gitpod Account [https://gitpod.io](https://gitpod.io).
9 | Fork this repository and launch your Magento CDE workspace with a single click.
10 |
11 |
12 |
13 |
14 | ## Zero config required development tools
15 | **Development Toolkit:** Includes ready to go tools that make you a super powered developer.
16 |
17 | **MailPit :**
18 | email catching and debugging
19 |
20 | **Tab nine :**
21 | A.I autocomplete code tool
22 |
23 | **Cypress :**
24 | A great testing tool
25 |
26 | **Xdebug :**
27 | PHP debugger ready to go
28 |
29 | **N98-Magerun :**
30 | email catching and debugging
31 |
32 |
33 | ## How to Use
34 | **Fork the Repository:**
35 | Fork this repository to your GitHub account.
36 |
37 | **Open in Gitpod:**
38 | Click the Gitpod button on your forked repository to launch the development environment.
39 |
40 | **Start Coding:**
41 | Once the environment is ready, you can start coding immediately with Magento 2.
42 |
43 |
44 | ## Customization
45 | To tailor the environment to your needs, you can modify the provided .gitpod.yml and .gitpod.Dockerfile configuration files. Add or remove services, extensions, and configurations as necessary for your project.
46 |
47 |
48 | ## Support
49 | If you encounter any issues or have questions, please open an issue in the repository, and we'll address it as soon as possible.
50 |
51 |
52 | ## Contribution
53 | Contributions are welcome! If you have suggestions or improvements, feel free to make a pull request.
54 |
55 |
56 | Jumpstart your Magento 2 development with the efficiency and flexibility of a cloud-based environment. Try it now and experience a streamlined development workflow that lets you focus on coding, not configuration.
57 |
58 | ## Learn More
59 | [Click here to Learn more about Gitpod for Magento 2 on our Free Teachable Course](https://develo.teachable.com/p/mastering-gitpod-for-magento-2-development)
60 |
61 |
62 | ## Installing an existing database
63 | - Uncomment and complete the code [here](https://github.com/develodesign/magento-gitpod/blob/0880b246b9392d07d3655c740ba2f59376fd68f2/gitpod/m2-install.sh#L28) to have the script import an existing Magento 2 database.
64 | - Replace ```staging-domain.com``` in the file with your Magento 2 url, this will be replaced with the current gitpod workspace URL before import.
65 | - Compress your .sql file and place into the gitpod folder as ```magento-db.sql.zip```
66 | - Set INSTALL_MAGENTO = No in the [.gitpod.Dockerfile](https://github.com/develodesign/magento-gitpod/blob/main/.gitpod.Dockerfile)
67 |
68 |
69 |
70 | ## Road Map
71 | - [x] Run Magento fully installed on load
72 | - [x] Have no files marked as changed in GIT.
73 | - [x] Install Magento SQL once on first load, delete flag to reinstall
74 | - [x] Import staging SQL file replacing urls
75 | - [x] Improve config to simplify configuring the build components
76 | - [x] Add MailPit SMTP mail catcher with zero config
77 | - [x] Magento 2.4.6 and PHP8.2 support
78 | - [x] Add additional SQL and config updates, Magento config for SMTP details, Algolia indexing etc.
79 | - [x] Accept values for Magento configuration through Gitpod ENV
80 |
81 |
82 | # Credit
83 | Based on the original Gitpod config produced by https://github.com/nemke82/magento2gitpod
84 |
--------------------------------------------------------------------------------
/cypress.config.js:
--------------------------------------------------------------------------------
1 | const { defineConfig } = require('cypress')
2 |
3 | module.exports = defineConfig({
4 | e2e: {
5 | baseUrl: 'http://localhost:8002',
6 | supportFile:false
7 | }
8 | })
--------------------------------------------------------------------------------
/cypress/e2e/test/index.cy.js:
--------------------------------------------------------------------------------
1 | describe('My First Test', () => {
2 | it('Visits Homepage', () => {
3 | cy.visit('/')
4 | })
5 | })
--------------------------------------------------------------------------------
/gitpod/.my.cnf:
--------------------------------------------------------------------------------
1 | [client]
2 | user=root
3 | password=${MYSQL_ROOT_PASSWORD}
4 |
--------------------------------------------------------------------------------
/gitpod/client.cnf:
--------------------------------------------------------------------------------
1 | [client]
2 | host = localhost
3 | user = root
4 | password = ${MYSQL_ROOT_PASSWORD}
5 | socket = /var/run/mysqld/mysqld.sock
6 | [mysql_upgrade]
7 | host = localhost
8 | user = root
9 | password = ${MYSQL_ROOT_PASSWORD}
10 | socket = /var/run/mysqld/mysqld.sock
11 |
--------------------------------------------------------------------------------
/gitpod/default.vcl:
--------------------------------------------------------------------------------
1 | # VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 6
2 | vcl 4.0;
3 | import std;
4 | # The minimal Varnish version is 6.0
5 | # For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
6 | backend default {
7 | .host = "127.0.0.1";
8 | .port = "8080";
9 | .first_byte_timeout = 60m;
10 | .connect_timeout = 60m;
11 | .between_bytes_timeout = 60m;
12 | }
13 | acl purge {
14 | "10.0.0.0/8";
15 | "192.168.0.0/16";
16 | "127.0.0.1/32";
17 | }
18 | sub vcl_recv {
19 | if (req.restarts > 0) {
20 | set req.hash_always_miss = true;
21 | }
22 | if (req.method == "PURGE") {
23 | if (client.ip !~ purge) {
24 | return (synth(405, "Method not allowed"));
25 | }
26 | # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
27 | # has been added to the response in your backend server config. This is used, for example, by the
28 | # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
29 | if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
30 | return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
31 | }
32 | if (req.http.X-Magento-Tags-Pattern) {
33 | ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
34 | }
35 | if (req.http.X-Pool) {
36 | ban("obj.http.X-Pool ~ " + req.http.X-Pool);
37 | }
38 | return (synth(200, "Purged"));
39 | }
40 | if (req.method != "GET" &&
41 | req.method != "HEAD" &&
42 | req.method != "PUT" &&
43 | req.method != "POST" &&
44 | req.method != "TRACE" &&
45 | req.method != "OPTIONS" &&
46 | req.method != "DELETE") {
47 | /* Non-RFC2616 or CONNECT which is weird. */
48 | return (pipe);
49 | }
50 | # We only deal with GET and HEAD by default
51 | if (req.method != "GET" && req.method != "HEAD") {
52 | return (pass);
53 | }
54 | # Bypass shopping cart and checkout
55 | if (req.url ~ "/checkout") {
56 | return (pass);
57 | }
58 | # Bypass health check requests
59 | if (req.url ~ "/pub/health_check.php") {
60 | return (pass);
61 | }
62 | # Set initial grace period usage status
63 | set req.http.grace = "none";
64 | # normalize url in case of leading HTTP scheme and domain
65 | set req.url = regsub(req.url, "^http[s]?://", "");
66 | # collect all cookies
67 | std.collect(req.http.Cookie);
68 | # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
69 | if (req.http.Accept-Encoding) {
70 | if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
71 | # No point in compressing these
72 | unset req.http.Accept-Encoding;
73 | } elsif (req.http.Accept-Encoding ~ "gzip") {
74 | set req.http.Accept-Encoding = "gzip";
75 | } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
76 | set req.http.Accept-Encoding = "deflate";
77 | } else {
78 | # unknown algorithm
79 | unset req.http.Accept-Encoding;
80 | }
81 | }
82 | # Remove all marketing get parameters to minimize the cache objects
83 | if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") {
84 | set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
85 | set req.url = regsub(req.url, "[?|&]+$", "");
86 | }
87 | # Static files caching
88 | if (req.url ~ "^/(pub/)?(media|static)/") {
89 | # Static files should not be cached by default
90 | return (pass);
91 | # But if you use a few locales and don't use CDN you can enable caching static files by commenting previous line (#return (pass);) and uncommenting next 3 lines
92 | #unset req.http.Https;
93 | #unset req.http.X-Forwarded-Proto;
94 | #unset req.http.Cookie;
95 | }
96 | # Authenticated GraphQL requests should not be cached by default
97 | if (req.url ~ "/graphql" && req.http.Authorization ~ "^Bearer") {
98 | return (pass);
99 | }
100 | return (hash);
101 | }
102 | sub vcl_hash {
103 | if (req.http.cookie ~ "X-Magento-Vary=") {
104 | hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
105 | }
106 | # To make sure http users don't see ssl warning
107 | if (req.http.X-Forwarded-Proto) {
108 | hash_data(req.http.X-Forwarded-Proto);
109 | }
110 |
111 | if (req.url ~ "/graphql") {
112 | call process_graphql_headers;
113 | }
114 | }
115 | sub process_graphql_headers {
116 | if (req.http.Store) {
117 | hash_data(req.http.Store);
118 | }
119 | if (req.http.Content-Currency) {
120 | hash_data(req.http.Content-Currency);
121 | }
122 | }
123 | sub vcl_backend_response {
124 | set beresp.grace = 3d;
125 | if (beresp.http.content-type ~ "text") {
126 | set beresp.do_esi = true;
127 | }
128 | if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") {
129 | set beresp.do_gzip = true;
130 | }
131 | if (beresp.http.X-Magento-Debug) {
132 | set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
133 | }
134 | # cache only successfully responses and 404s
135 | if (beresp.status != 200 && beresp.status != 404) {
136 | set beresp.ttl = 0s;
137 | set beresp.uncacheable = true;
138 | return (deliver);
139 | } elsif (beresp.http.Cache-Control ~ "private") {
140 | set beresp.uncacheable = true;
141 | set beresp.ttl = 86400s;
142 | return (deliver);
143 | }
144 | # validate if we need to cache it and prevent from setting cookie
145 | if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) {
146 | unset beresp.http.set-cookie;
147 | }
148 | # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
149 | if (beresp.ttl <= 0s ||
150 | beresp.http.Surrogate-control ~ "no-store" ||
151 | (!beresp.http.Surrogate-Control &&
152 | beresp.http.Cache-Control ~ "no-cache|no-store") ||
153 | beresp.http.Vary == "*") {
154 | # Mark as Hit-For-Pass for the next 2 minutes
155 | set beresp.ttl = 120s;
156 | set beresp.uncacheable = true;
157 | }
158 | return (deliver);
159 | }
160 | sub vcl_deliver {
161 | if (resp.http.X-Magento-Debug) {
162 | if (resp.http.x-varnish ~ " ") {
163 | set resp.http.X-Magento-Cache-Debug = "HIT";
164 | set resp.http.Grace = req.http.grace;
165 | } else {
166 | set resp.http.X-Magento-Cache-Debug = "MISS";
167 | }
168 | } else {
169 | #unset resp.http.Age;
170 | }
171 | # Not letting browser to cache non-static files.
172 | if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)?(media|static)/") {
173 | # set resp.http.Pragma = "no-cache";
174 | # set resp.http.Expires = "-1";
175 | # set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
176 | set resp.http.Cache-Control = "public, no-store, max-age=86400";
177 | }
178 | unset resp.http.X-Magento-Debug;
179 | unset resp.http.X-Magento-Tags;
180 | unset resp.http.X-Powered-By;
181 | unset resp.http.Server;
182 | unset resp.http.X-Varnish;
183 | unset resp.http.Via;
184 | unset resp.http.Link;
185 | }
186 | sub vcl_hit {
187 | if (obj.ttl >= 0s) {
188 | # Hit within TTL period
189 | return (deliver);
190 | }
191 | if (std.healthy(req.backend_hint)) {
192 | if (obj.ttl + 300s > 0s) {
193 | # Hit after TTL expiration, but within grace period
194 | set req.http.grace = "normal (healthy server)";
195 | return (deliver);
196 | } else {
197 | # Hit after TTL and grace expiration
198 | return (restart);
199 | }
200 | } else {
201 | # server is not healthy, retrieve from cache
202 | set req.http.grace = "unlimited (unhealthy server)";
203 | return (deliver);
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/gitpod/end-2-end-test.yml:
--------------------------------------------------------------------------------
1 | name: MageTested.com - End 2 End Tests
2 |
3 | on:
4 | # Enable this line to run the tests on every push
5 | push:
6 | workflow_dispatch:
7 | pull_request:
8 | types:
9 | - opened
10 | - labeled
11 |
12 | jobs:
13 | # Remove flag used to trigger the e2e tests
14 | remove_flag:
15 | if: ${{ contains(github.event.*.labels.*.name, 'run_e2e_tests') }}
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: Remove run E2E tests label
19 | uses: actions/github-script@v5
20 | with:
21 | script: |
22 | github.rest.issues.removeLabel({
23 | issue_number: ${{ github.event.issue.number || github.event.number }},
24 | owner: context.repo.owner,
25 | repo: context.repo.repo,
26 | name: "run_e2e_tests"
27 | })
28 |
29 | e2e-tests:
30 | runs-on: ubuntu-latest
31 |
32 | env:
33 | WORKING_DIR: ./
34 | BIN_MAGENTO: bin/magento
35 | MAGENTO_LOCALES: en_US
36 | THEME_PATH: Magento/luma
37 |
38 | steps:
39 | - uses: actions/checkout@v3
40 | with:
41 | lfs: true
42 |
43 | - name: Generate auth.json when COMPOSER_AUTH_JSON is set
44 | env:
45 | auth_json: ${{ secrets.COMPOSER_AUTH_JSON }}
46 | if: ${{ env.auth_json != '' }}
47 | run: echo "$auth_json" > auth.json
48 |
49 | # Get the composer cache directory so we can save it so GitHub Actions cache and restore it in the next run
50 | - name: Get Composer Cache Directory
51 | id: composer-cache
52 | run: |
53 | if ! test -f "auth.json"; then
54 | echo "Warning: You don't have an auth.json in place. Either commit it to this repository, or add it as a secret to your GitHub repository as COMPOSER_AUTH_JSON."
55 | exit 1;
56 | fi
57 | composer validate --working-dir=$WORKING_DIR
58 | echo "dir=$(composer config cache-files-dir --working-dir=$WORKING_DIR)" >> $GITHUB_OUTPUT
59 |
60 | # Cache composer dependencies so the next run will be faster. Do NOT cache the vendor folder, as that would
61 | # it would not trigger the automatic creation of bin/magento and other files.
62 | - name: Cache vendor
63 | uses: actions/cache@v3
64 | with:
65 | path: |
66 | ${{ steps.composer-cache.outputs.dir }}
67 | key: vendor-${{ hashFiles('**/composer.lock') }}
68 |
69 | - name: Runs Mailcatcher
70 | run: |
71 | docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher
72 | go install github.com/mailhog/mhsendmail@latest
73 |
74 | # Start mysql. If you have a database in place you can import it here.
75 | - name: Start mysql & import database
76 | run: |
77 | sudo /etc/init.d/mysql start
78 | mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" -uroot -proot
79 | mysql -e 'CREATE DATABASE magento;' -uroot -proot
80 | mysql -e "CREATE USER 'magento'@'localhost' IDENTIFIED BY 'magento';" -uroot -proot
81 | mysql -e "GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';" -uroot -proot
82 | mysql -e "FLUSH PRIVILEGES;" -uroot -proot
83 |
84 | - name: Set up environment with secret
85 | run: |
86 | if [ -z "${{ secrets.SECRET_KEY }}" ]; then
87 | echo "USE_SECRET_KEY=DefaultSecretKeyStringThatIsLong" >> $GITHUB_ENV
88 | else
89 | echo "USE_SECRET_KEY=${{ secrets.SECRET_KEY }}" >> $GITHUB_ENV
90 | fi
91 |
92 | # Copy the env.php.end-2-end file to env.php and replace the secret key
93 | # - name: Dump env.php
94 | # run: |
95 | # #!/bin/bash
96 | # set -e
97 | # SECRET_KEY="${{ env.USE_SECRET_KEY }}"
98 | # FILE="$WORKING_DIR/app/etc/env.php"
99 | # cp "$FILE.end-2-end" $FILE
100 | # sed -i "s/{{SECRET_KEY}}/$SECRET_KEY/g" $FILE
101 |
102 | # Prepare for Elasticsearch
103 | - name: Configure sysctl limits
104 | run: |
105 | sudo swapoff -a
106 | sudo sysctl -w vm.swappiness=1
107 | sudo sysctl -w fs.file-max=262144
108 | sudo sysctl -w vm.max_map_count=262144
109 |
110 | # Start Elasticsearch
111 | - name: Runs Elasticsearch
112 | uses: elastic/elastic-github-actions/elasticsearch@master
113 | with:
114 | stack-version: 7.6.0
115 |
116 | - name: Runs Redis
117 | uses: superchargejs/redis-github-action@1.1.0
118 |
119 | # Off-course we need PHP
120 | - name: Setup PHP
121 | uses: shivammathur/setup-php@v2
122 | with:
123 | php-version: '8.1'
124 | ini-values: |
125 | error_log=${{ github.workspace }}/${{ env.WORKING_DIR }}/var/log/php-error.log,sendmail_path="/home/runner/go/bin/mhsendmail --smtp-addr='localhost:1025'"
126 |
127 | # Install node for building Hyva
128 | - uses: actions/setup-node@v3
129 | with:
130 | node-version: '16'
131 |
132 | # Run composer install
133 | - name: Run Composer Install
134 | run: |
135 | composer install --no-interaction --no-progress --working-dir=$WORKING_DIR
136 | composer require n98/magerun2-dist --dev
137 |
138 | # Enable this when applicable: Build Hyvä
139 | #- name: Build Hyvä
140 | # run: |
141 | # npm --prefix $WORKING_DIR/app/design/frontend/$THEME_PATH/web/tailwind ci
142 | # npm run --prefix $WORKING_DIR/app/design/frontend/$THEME_PATH/web/tailwind build-prod
143 |
144 | # If you don't have an database in place you can go with the default Magento install
145 | - name: Run Magento Install
146 | run: |
147 | $BIN_MAGENTO setup:install \
148 | --backend-frontname=admin \
149 | --db-host=localhost \
150 | --db-name=magento \
151 | --db-user=magento \
152 | --db-password=magento \
153 | --search-engine=opensearch \
154 | --elasticsearch-host=localhost \
155 | --elasticsearch-port=9200 \
156 | --elasticsearch-index-prefix=magento2 \
157 | --elasticsearch-enable-auth=0 \
158 | --elasticsearch-timeout=15 \
159 | --session-save=redis \
160 | --session-save-redis-host=localhost \
161 | --session-save-redis-port=6379 \
162 | --session-save-redis-db=2 \
163 | --session-save-redis-max-concurrency=20 \
164 | --cache-backend=redis \
165 | --cache-backend-redis-server=localhost \
166 | --cache-backend-redis-db=0 \
167 | --cache-backend-redis-port=6379 \
168 | --page-cache=redis \
169 | --page-cache-redis-server=localhost \
170 | --page-cache-redis-db=1 \
171 | --page-cache-redis-port=6379 \
172 | --base-url=https://localhost \
173 | --timezone=Europe/London \
174 | --currency=EUR \
175 | --admin-user=magetested \
176 | --admin-password=magetested1 \
177 | --admin-email=info@magetested.com \
178 | --admin-firstname=Magetested \
179 | --admin-lastname=Magetested \
180 | --use-rewrites=1
181 |
182 | # Run Magento Setup
183 | - name: Run Magento setup:upgrade
184 | run: |
185 | $BIN_MAGENTO indexer:reindex
186 | $BIN_MAGENTO config:set system/smtp/disable 0
187 | $BIN_MAGENTO config:set system/smtp/transport smtp
188 | $BIN_MAGENTO config:set system/smtp/port 1025
189 | # smtp/general/enabled == mageplaza smtp module
190 | # $BIN_MAGENTO config:set smtp/general/enabled 1
191 | # $BIN_MAGENTO config:set smtp/configuration_option/host localhost
192 | # $BIN_MAGENTO config:set smtp/configuration_option/port 1025
193 | # $BIN_MAGENTO config:set smtp/configuration_option/username ""
194 | # $BIN_MAGENTO config:set smtp/configuration_option/password ""
195 |
196 | - name: Run setup:static-content:deploy
197 | run: $BIN_MAGENTO setup:static-content:deploy -f --area frontend $MAGENTO_LOCALES -j 12
198 |
199 | # Start the PHP server and redirect all output to var/log/php-server.log
200 | - name: Start server
201 | run: nohup php -S 0.0.0.0:8080 -t $WORKING_DIR/pub/ $WORKING_DIR/phpserver/router.php > $WORKING_DIR/var/log/php-server.log 2>&1 &
202 |
203 | # Set the correct base url and check if the server is online
204 | - name: Check if server is online
205 | run: |
206 | $BIN_MAGENTO
207 | $BIN_MAGENTO config:set web/secure/base_url http://localhost:8080/
208 | $BIN_MAGENTO config:set web/unsecure/base_url http://localhost:8080/
209 | $BIN_MAGENTO config:set web/secure/base_link_url http://localhost:8080/
210 | $BIN_MAGENTO config:set web/unsecure/base_link_url http://localhost:8080/
211 | curl --fail-with-body -v http://localhost:8080
212 |
213 | # If no package.json is present, copy package.json.sample to package.json
214 | - name: Copy package.json.sample to package.json
215 | run: |
216 | if ! test -f "$WORKING_DIR/package.json"; then
217 | cp "$WORKING_DIR/package.json.sample" "$WORKING_DIR/package.json"
218 | npm install cypress --save-dev
219 | fi
220 |
221 | # Run Cypress tests
222 | - name: Run Cypress tests
223 | uses: cypress-io/github-action@v6
224 | with:
225 | browser: chrome
226 | config: baseUrl=http://localhost:8080,defaultCommandTimeout=10000
227 |
228 | # Upload artifacts on failure
229 | - name: Upload artifacts
230 | uses: actions/upload-artifact@v3
231 | if: failure()
232 | with:
233 | name: Cypress logs ${{ github.run_number }}
234 | path: |
235 | ${{ env.WORKING_DIR }}/cypress/videos
236 | ${{ env.WORKING_DIR }}/cypress/screenshots
237 | ${{ env.WORKING_DIR }}/var/log
238 | ${{ env.WORKING_DIR }}/var/report
239 |
--------------------------------------------------------------------------------
/gitpod/m2-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | GITPOD_DIR=$GITPOD_REPO_ROOT/gitpod/;
3 | REPO_ROOT=$GITPOD_REPO_ROOT/;
4 |
5 | echo "============ 1. Install Magento if required =========="
6 | mysql -uroot -p$MYSQL_ROOT_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS magento2;'
7 | url=$(gp url | awk -F"//" {'print $2'}) && url+="/" &&
8 | url="https://8002-"$url &&
9 | if [ "${INSTALL_MAGENTO}" = "YES" ]; then php bin/magento setup:install --db-name='magento2' --db-user='root' --db-password=$MYSQL_ROOT_PASSWORD --base-url=$url --backend-frontname='admin' --admin-user=$MAGENTO_ADMIN_USERNAME --admin-password=$MAGENTO_ADMIN_PASSWORD --admin-email=$GITPOD_GIT_USER_EMAIL --admin-firstname='Admin' --admin-lastname='User' --use-rewrites='1' --use-secure='1' --base-url-secure=$url --use-secure-admin='1' --language='en_GB' --db-host='127.0.0.1' --cleanup-database --timezone='Europe/London' --currency='GBP' --session-save='redis'; fi &&
10 | echo "----------------------------------------------"
11 |
12 | echo "================ 2. INSTALL DB ==============="
13 | ### UNCOMMENT if using an existing Magento staging DB instead of using the default blank M2 ** ###
14 | #cd $GITPOD_REPO_ROOT/gitpod && unzip magento-db.sql.zip &&
15 | #sed -i 's#staging-domain.com#'$url'#g' magento-db.sql &&
16 | #mysql -uroot -pnem4540 magento2 < magento-db.sql &&
17 | echo "----------------------------------------------"
18 |
19 | echo "======= 3. INSTALL MAGENTO ENV & CONFIG ======"
20 | ### UNCOMMENT if using an existing Magento code base ###
21 | #cd $GITPOD_DIR &&
22 | #cp "./.magento.env.php" "$GITPOD_REPO_ROOT/app/etc/env.php" &&
23 | #sed -i 's#{{GITPOD_ROOT_DOMAIN}}#'$MAGENTO_URL_FULL'#g' "$GITPOD_REPO_ROOT/app/etc/env.php" &&
24 | #cd $GITPOD_REPO_ROOT &&
25 | #php bin/magento cache:flush &&
26 | #php bin/magento setup:upgrade &&
27 | echo "-----------------------------------------------"
28 |
29 | echo "==== 4. CONFIGURATION (config:set) CHANGES ===="
30 | php bin/magento config:set system/security/max_session_size_admin 1024000 &&
31 | php bin/magento config:set admin/security/session_lifetime 31536000 &&
32 | php bin/magento config:set web/cookie/cookie_path "/" &&
33 | php bin/magento config:set web/cookie/cookie_domain ".gitpod.io" &&
34 | php bin/magento config:set system/full_page_cache/caching_application 1 &&
35 | php bin/magento deploy:mode:set developer &&
36 | php bin/magento config:set system/smtp/transport smtp &&
37 | php bin/magento config:set system/smtp/host "0.0.0.0" &&
38 | php bin/magento config:set system/smtp/port "1025" &&
39 | php bin/magento config:set system/smtp/username "magento@example.com" &&
40 | php bin/magento config:set system/smtp/password "pass" &&
41 | php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth &&
42 | #php bin/magento config:set algoliasearch_credentials/credentials/enable_backend 0 &&
43 | echo "----------------------------------------------"
44 |
45 | echo "============ 5. CLEAR CACHES ETC ============"
46 | php bin/magento cache:clean config && redis-cli flushall;
47 | php bin/magento indexer:reindex;
48 | echo "----------------------------------------------"
49 |
50 | echo "========== 6. INSTALL FLAG COMPLETE =========="
51 | touch $GITPOD_REPO_ROOT/gitpod/db-installed.flag;
52 | echo "----------------------------------------------"
53 |
--------------------------------------------------------------------------------
/gitpod/mysql.cnf:
--------------------------------------------------------------------------------
1 | [mysqld_safe]
2 | socket = /var/run/mysqld/mysqld.sock
3 | nice = 0
4 |
5 | [mysqld]
6 | user = gitpod
7 | pid-file = /var/run/mysqld/mysqld.pid
8 | socket = /var/run/mysqld/mysqld.sock
9 | port = 3306
10 | basedir = /usr
11 | datadir = /var/lib/mysql
12 | tmpdir = /tmp
13 | lc-messages-dir = /usr/share/mysql
14 | skip-external-locking
15 | bind-address = 127.0.0.1
16 |
17 | bulk_insert_buffer_size=64M
18 | expire_logs_days=1
19 | innodb_buffer_pool_instances=8
20 | innodb_buffer_pool_size=5G
21 | innodb_file_per_table=0
22 | innodb_log_file_size=256M
23 | innodb_read_io_threads=20
24 | innodb_write_io_threads=20
25 | join_buffer_size=2G
26 | key_buffer_size=512M
27 | max_allowed_packet=256M
28 | max_connect_errors=10
29 | max_connections=1000
30 | max_heap_table_size=2G
31 | open_files_limit=65535
32 | query_cache_limit=2M
33 | query_cache_size=128M
34 | query_cache_type=1
35 | slow_query_log=1
36 | sort_buffer_size=2G
37 | tmp_table_size=2G
38 | transaction-isolation=READ-COMMITTED
39 |
40 | general_log_file = $GITPOD_REPO_ROOT/var/log/mysql.log
41 | general_log = 1
42 | log_error = $GITPOD_REPO_ROOT/var/log/mysql-error.log
43 |
44 | max_binlog_size = 100M
45 |
--------------------------------------------------------------------------------
/gitpod/mysql.conf:
--------------------------------------------------------------------------------
1 | [program:mysql]
2 | command=/usr/sbin/mysqld --basedir=/var/lib/mysql --datadir=/var/lib/mysql
3 | process_name=%(program_name)s
4 | priority=1001
5 | autostart=true
6 | startretries=3
7 | autorestart=true
8 | user=root
9 |
--------------------------------------------------------------------------------
/gitpod/nginx-varnish.conf:
--------------------------------------------------------------------------------
1 | worker_processes auto;
2 | worker_rlimit_nofile 169152;
3 | worker_cpu_affinity auto;
4 | timer_resolution 1s;
5 |
6 | pid /var/run/nginx/nginx.pid;
7 | include /etc/nginx/modules-enabled/*.conf;
8 |
9 | env NGINX_DOCROOT_IN_REPO;
10 | env GITPOD_REPO_ROOT;
11 |
12 | events {
13 | worker_connections 768;
14 | # multi_accept on;
15 | }
16 |
17 | http {
18 | # Basic Settings
19 | sendfile on;
20 | tcp_nopush on;
21 | tcp_nodelay on;
22 | keepalive_timeout 65;
23 | types_hash_max_size 2048;
24 | include /etc/nginx/mime.types;
25 | default_type application/octet-stream;
26 |
27 | # Logging Settings
28 | access_log /var/log/nginx/access.log;
29 | error_log /var/log/nginx/error.log;
30 |
31 | # Gzip Settings
32 | gzip on;
33 |
34 | # Other Configs
35 | include /etc/nginx/conf.d/*.conf;
36 |
37 | upstream fastcgi_backend {
38 | server 127.0.0.1:9000;
39 | }
40 |
41 | upstream varnish {
42 | server 127.0.0.1:80;
43 | }
44 |
45 | server {
46 | set_by_lua $nginx_docroot_in_repo 'return os.getenv("NGINX_DOCROOT_IN_REPO")';
47 | set_by_lua $gitpod_repo_root 'return os.getenv("GITPOD_REPO_ROOT")';
48 |
49 | listen 0.0.0.0:8002;
50 |
51 | set $MAGE_ROOT $GITPOD_REPO_ROOT;
52 | set $MAGE_DEBUG_SHOW_ARGS 1;
53 |
54 | proxy_buffer_size 128k;
55 | proxy_buffers 4 256k;
56 | proxy_busy_buffers_size 256k;
57 |
58 | root $MAGE_ROOT/pub;
59 |
60 | index index.php;
61 | autoindex off;
62 | charset UTF-8;
63 | error_page 404 403 = /errors/404.php;
64 | #add_header "X-UA-Compatible" "IE=Edge";
65 |
66 | location /lighthouse {
67 | index index.html;
68 | }
69 |
70 | # Deny access to sensitive files
71 | location /.user.ini {
72 | deny all;
73 | }
74 |
75 | # PHP entry point for setup application
76 | location ~* ^/setup($|/) {
77 | root $MAGE_ROOT;
78 | location ~ ^/setup/index.php {
79 | fastcgi_pass fastcgi_backend;
80 |
81 | fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
82 | fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600";
83 | fastcgi_read_timeout 600s;
84 | fastcgi_connect_timeout 600s;
85 |
86 | fastcgi_index index.php;
87 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
88 | include fastcgi_params;
89 | }
90 |
91 | location ~ ^/setup/(?!pub/). {
92 | deny all;
93 | }
94 |
95 | location ~ ^/setup/pub/ {
96 | add_header X-Frame-Options "SAMEORIGIN";
97 | }
98 | }
99 |
100 | # PHP entry point for update application
101 | location ~* ^/update($|/) {
102 | root $MAGE_ROOT;
103 |
104 | location ~ ^/update/index.php {
105 | fastcgi_split_path_info ^(/update/index.php)(/.+)$;
106 | fastcgi_pass fastcgi_backend;
107 | fastcgi_index index.php;
108 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
109 | fastcgi_param PATH_INFO $fastcgi_path_info;
110 | include fastcgi_params;
111 | }
112 |
113 | # Deny everything but index.php
114 | location ~ ^/update/(?!pub/). {
115 | deny all;
116 | }
117 |
118 | location ~ ^/update/pub/ {
119 | add_header X-Frame-Options "SAMEORIGIN";
120 | }
121 | }
122 |
123 | # set Varnish variable to default
124 | set $ssl_offloaded '';
125 |
126 | if ($scheme = https) {
127 | set $ssl_offloaded on;
128 | }
129 |
130 | location / {
131 | proxy_pass http://varnish;
132 | proxy_set_header Host $http_host;
133 | proxy_set_header X-Real-IP $remote_addr;
134 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
135 | proxy_set_header X-Forwarded-Host $http_host;
136 | proxy_set_header X-SSL-offloaded $ssl_offloaded;
137 | proxy_buffer_size 128k;
138 | proxy_buffers 4 256k;
139 | proxy_busy_buffers_size 256k;
140 | }
141 |
142 | location /pub/ {
143 | location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
144 | deny all;
145 | }
146 | alias $MAGE_ROOT/pub/;
147 | add_header X-Frame-Options "SAMEORIGIN";
148 | }
149 |
150 | location /static/ {
151 | # Uncomment the following line in production mode
152 | # expires max;
153 |
154 | # Remove signature of the static files that is used to overcome the browser cache
155 | location ~ ^/static/version {
156 | rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
157 | }
158 |
159 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
160 | add_header Cache-Control "public";
161 | add_header X-Frame-Options "SAMEORIGIN";
162 | expires +1y;
163 |
164 | if (!-f $request_filename) {
165 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
166 | }
167 | }
168 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
169 | add_header Cache-Control "no-store";
170 | add_header X-Frame-Options "SAMEORIGIN";
171 | expires off;
172 |
173 | if (!-f $request_filename) {
174 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
175 | }
176 | }
177 | if (!-f $request_filename) {
178 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
179 | }
180 | add_header X-Frame-Options "SAMEORIGIN";
181 | }
182 |
183 | location /media/ {
184 | try_files $uri $uri/ /get.php$is_args$args;
185 |
186 | location ~ ^/media/theme_customization/.*\.xml {
187 | deny all;
188 | }
189 |
190 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
191 | add_header Cache-Control "public";
192 | add_header X-Frame-Options "SAMEORIGIN";
193 | expires +1y;
194 | try_files $uri $uri/ /get.php$is_args$args;
195 | }
196 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
197 | add_header Cache-Control "no-store";
198 | add_header X-Frame-Options "SAMEORIGIN";
199 | expires off;
200 | try_files $uri $uri/ /get.php$is_args$args;
201 | }
202 | add_header X-Frame-Options "SAMEORIGIN";
203 | }
204 |
205 | location /media/customer/ {
206 | deny all;
207 | }
208 |
209 | location /media/downloadable/ {
210 | deny all;
211 | }
212 |
213 | location /media/import/ {
214 | deny all;
215 | }
216 | location /errors/ {
217 | location ~* \.xml$ {
218 | deny all;
219 | }
220 | }
221 |
222 | # PHP entry point for main application
223 | location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
224 | try_files $uri =404;
225 | fastcgi_pass fastcgi_backend;
226 | fastcgi_buffers 1024 4k;
227 | fastcgi_buffer_size 256k;
228 |
229 | fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
230 | fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
231 | fastcgi_read_timeout 600s;
232 | fastcgi_connect_timeout 600s;
233 | fastcgi_param HTTPS "on";
234 | fastcgi_index index.php;
235 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
236 | include fastcgi_params;
237 | }
238 |
239 | gzip on;
240 | gzip_disable "msie6";
241 |
242 | gzip_comp_level 6;
243 | gzip_min_length 1100;
244 | gzip_buffers 16 8k;
245 | gzip_proxied any;
246 | gzip_types
247 | text/plain
248 | text/css
249 | text/js
250 | text/xml
251 | text/javascript
252 | application/javascript
253 | application/x-javascript
254 | application/json
255 | application/xml
256 | application/xml+rss
257 | image/svg+xml;
258 | gzip_vary on;
259 |
260 | # Banned locations (only reached if the earlier PHP entry point regexes don't match)
261 | location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
262 | deny all;
263 | }
264 |
265 |
266 | }
267 |
268 | server {
269 | set_by_lua $nginx_docroot_in_repo 'return os.getenv("NGINX_DOCROOT_IN_REPO")';
270 | set_by_lua $gitpod_repo_root 'return os.getenv("GITPOD_REPO_ROOT")';
271 |
272 | listen 0.0.0.0:8080;
273 |
274 | set $MAGE_ROOT $GITPOD_REPO_ROOT;
275 | set $MAGE_DEBUG_SHOW_ARGS 1;
276 |
277 | root $MAGE_ROOT/pub;
278 | index index.php;
279 | autoindex off;
280 |
281 | add_header 'X-Live-Attribute' 'true';
282 |
283 | location ~* /(\.ht|\.svn|\.git) { deny all; }
284 | location ~* ^/(app|lib|pkginfo|report/config.xml|var)/ { deny all; }
285 | location ~ ^/media/(customer|downloadable|import) { deny all; }
286 | location ~ cron\.php { deny all; }
287 |
288 |
289 | location /pub/ {
290 | location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
291 | deny all;
292 | }
293 | alias $MAGE_ROOT/pub/;
294 | add_header X-Frame-Options "SAMEORIGIN";
295 | }
296 |
297 | location ~* ^/setup($|/) {
298 | root $MAGE_ROOT;
299 | location ~ ^/setup/index.php {
300 | try_files /dummy @proxy2;
301 | }
302 |
303 | location ~ ^/setup/(?!pub/). {
304 | deny all;
305 | }
306 |
307 | location ~ ^/setup/pub/ {
308 | add_header X-Frame-Options "SAMEORIGIN";
309 | }
310 | }
311 |
312 | # PHP entry point for update application
313 | location ~* ^/update($|/) {
314 | root $MAGE_ROOT;
315 |
316 | location ~ ^/update/index.php {
317 | try_files /dummy @proxy2;
318 | }
319 |
320 | # Deny everything but index.php
321 | location ~ ^/update/(?!pub/). {
322 | deny all;
323 | }
324 |
325 | location ~ ^/update/pub/ {
326 | add_header X-Frame-Options "SAMEORIGIN";
327 | }
328 | }
329 |
330 | location /static/ {
331 | # Uncomment the following line in production mode
332 | # expires max;
333 |
334 | # Remove signature of the static files that is used to overcome the browser cache
335 | location ~ ^/static/version {
336 | rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
337 | }
338 |
339 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
340 | add_header Cache-Control "public";
341 | add_header X-Frame-Options "SAMEORIGIN";
342 | expires +1y;
343 |
344 | if (!-f $request_filename) {
345 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
346 | }
347 | }
348 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
349 | add_header Cache-Control "no-store";
350 | add_header X-Frame-Options "SAMEORIGIN";
351 | expires off;
352 |
353 | if (!-f $request_filename) {
354 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
355 | }
356 | }
357 | if (!-f $request_filename) {
358 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
359 | }
360 | add_header X-Frame-Options "SAMEORIGIN";
361 | }
362 |
363 | location /media/ {
364 | try_files $uri $uri/ /get.php$is_args$args;
365 |
366 | location ~ ^/media/theme_customization/.*\.xml {
367 | deny all;
368 | }
369 |
370 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
371 | add_header Cache-Control "public";
372 | add_header X-Frame-Options "SAMEORIGIN";
373 | expires +1y;
374 | try_files $uri $uri/ /get.php$is_args$args;
375 | }
376 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
377 | add_header Cache-Control "no-store";
378 | add_header X-Frame-Options "SAMEORIGIN";
379 | expires off;
380 | try_files $uri $uri/ /get.php$is_args$args;
381 | }
382 | add_header X-Frame-Options "SAMEORIGIN";
383 | }
384 |
385 | location ~ /static\.php {
386 | try_files $uri =404;
387 | expires off;
388 | fastcgi_pass fastcgi_backend;
389 | fastcgi_keep_conn on;
390 | fastcgi_buffer_size 128k;
391 | fastcgi_buffers 4 256k;
392 | include fastcgi_params;
393 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
394 | fastcgi_param DOCUMENT_ROOT $realpath_root;
395 | fastcgi_param UNIQUE_ID $connection.$connection_requests;
396 | fastcgi_param HTTPS $http_x_ssl_offloaded if_not_empty;
397 | }
398 |
399 | location ~ /get\.php {
400 | try_files $uri =404;
401 | expires off;
402 | fastcgi_pass fastcgi_backend;
403 | fastcgi_keep_conn on;
404 | fastcgi_buffer_size 128k;
405 | fastcgi_buffers 4 256k;
406 | include fastcgi_params;
407 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
408 | fastcgi_param DOCUMENT_ROOT $realpath_root;
409 | fastcgi_param UNIQUE_ID $connection.$connection_requests;
410 | fastcgi_param HTTPS $http_x_ssl_offloaded if_not_empty;
411 | }
412 |
413 | location / {
414 | try_files $uri $uri/ /index.php?$args;
415 | }
416 |
417 | location @proxy {
418 | expires off;
419 | fastcgi_pass fastcgi_backend;
420 | fastcgi_keep_conn on;
421 | fastcgi_buffer_size 128k;
422 | fastcgi_buffers 4 256k;
423 |
424 | include fastcgi_params;
425 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
426 | fastcgi_param DOCUMENT_ROOT $realpath_root;
427 | fastcgi_param UNIQUE_ID $connection.$connection_requests;
428 | fastcgi_param HTTPS $http_x_ssl_offloaded if_not_empty;
429 | }
430 | location @proxy2 {
431 | expires off;
432 | fastcgi_pass fastcgi_backend;
433 | fastcgi_keep_conn on;
434 | fastcgi_buffer_size 128k;
435 | fastcgi_buffers 4 256k;
436 |
437 | include fastcgi_params;
438 | fastcgi_param SCRIPT_FILENAME $MAGE_ROOT$fastcgi_script_name;
439 | }
440 |
441 | location ~ \.php$ {
442 | try_files $uri =404;
443 | expires off;
444 | fastcgi_pass fastcgi_backend;
445 | fastcgi_keep_conn on;
446 | fastcgi_buffer_size 128k;
447 | fastcgi_buffers 4 256k;
448 |
449 | include fastcgi_params;
450 | #STRAT-2086 fix for REMOTE_ADDR
451 | fastcgi_param REMOTE_ADDR $http_x_real_ip;
452 | #END STRAT-2086
453 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
454 | fastcgi_param DOCUMENT_ROOT $realpath_root;
455 | fastcgi_param UNIQUE_ID $connection.$connection_requests;
456 | fastcgi_param HTTPS $http_x_ssl_offloaded if_not_empty;
457 | }
458 |
459 | }
460 |
461 | }
462 | daemon off;
463 |
--------------------------------------------------------------------------------
/gitpod/nginx.conf:
--------------------------------------------------------------------------------
1 | worker_processes auto;
2 | worker_rlimit_nofile 169152;
3 | worker_cpu_affinity auto;
4 | timer_resolution 1s;
5 |
6 | pid /var/run/nginx/nginx.pid;
7 | include /etc/nginx/modules-enabled/*.conf;
8 |
9 | env NGINX_DOCROOT_IN_REPO;
10 | env GITPOD_REPO_ROOT;
11 |
12 | events {
13 | worker_connections 768;
14 | # multi_accept on;
15 | }
16 |
17 | http {
18 | # Basic Settings
19 | sendfile on;
20 | tcp_nopush on;
21 | tcp_nodelay on;
22 | keepalive_timeout 65;
23 | types_hash_max_size 2048;
24 | include /etc/nginx/mime.types;
25 | default_type application/octet-stream;
26 |
27 | # Logging Settings
28 | access_log /var/log/nginx/access.log;
29 | error_log /var/log/nginx/error.log;
30 |
31 | # Gzip Settings
32 | gzip on;
33 |
34 | # Other Configs
35 | include /etc/nginx/conf.d/*.conf;
36 |
37 | upstream fastcgi_backend {
38 | server 127.0.0.1:9000;
39 | }
40 |
41 | server {
42 | set_by_lua $nginx_docroot_in_repo 'return os.getenv("NGINX_DOCROOT_IN_REPO")';
43 | set_by_lua $gitpod_repo_root 'return os.getenv("GITPOD_REPO_ROOT")';
44 |
45 | listen 0.0.0.0:8002;
46 |
47 | set $MAGE_ROOT $GITPOD_REPO_ROOT;
48 | set $MAGE_DEBUG_SHOW_ARGS 1;
49 |
50 | proxy_buffer_size 128k;
51 | proxy_buffers 4 256k;
52 | proxy_busy_buffers_size 256k;
53 |
54 | root $MAGE_ROOT/pub;
55 |
56 | index index.php;
57 | autoindex off;
58 | charset UTF-8;
59 | error_page 404 403 = /errors/404.php;
60 | #add_header "X-UA-Compatible" "IE=Edge";
61 |
62 | location /lighthouse {
63 | index index.html;
64 | }
65 |
66 | # Deny access to sensitive files
67 | location /.user.ini {
68 | deny all;
69 | }
70 |
71 | # PHP entry point for setup application
72 | location ~* ^/setup($|/) {
73 | root $MAGE_ROOT;
74 | location ~ ^/setup/index.php {
75 | fastcgi_pass fastcgi_backend;
76 |
77 | fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
78 | fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600";
79 | fastcgi_read_timeout 600s;
80 | fastcgi_connect_timeout 600s;
81 |
82 | fastcgi_index index.php;
83 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
84 | include fastcgi_params;
85 | }
86 |
87 | location ~ ^/setup/(?!pub/). {
88 | deny all;
89 | }
90 |
91 | location ~ ^/setup/pub/ {
92 | add_header X-Frame-Options "SAMEORIGIN";
93 | }
94 | }
95 |
96 | # PHP entry point for update application
97 | location ~* ^/update($|/) {
98 | root $MAGE_ROOT;
99 |
100 | location ~ ^/update/index.php {
101 | fastcgi_split_path_info ^(/update/index.php)(/.+)$;
102 | fastcgi_pass fastcgi_backend;
103 | fastcgi_index index.php;
104 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
105 | fastcgi_param PATH_INFO $fastcgi_path_info;
106 | include fastcgi_params;
107 | }
108 |
109 | # Deny everything but index.php
110 | location ~ ^/update/(?!pub/). {
111 | deny all;
112 | }
113 |
114 | location ~ ^/update/pub/ {
115 | add_header X-Frame-Options "SAMEORIGIN";
116 | }
117 | }
118 |
119 | location / {
120 | try_files $uri $uri/ /index.php$is_args$args;
121 | }
122 |
123 | location /pub/ {
124 | location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
125 | deny all;
126 | }
127 | alias $MAGE_ROOT/pub/;
128 | add_header X-Frame-Options "SAMEORIGIN";
129 | }
130 |
131 | location /static/ {
132 | # Uncomment the following line in production mode
133 | # expires max;
134 |
135 | # Remove signature of the static files that is used to overcome the browser cache
136 | location ~ ^/static/version {
137 | rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
138 | }
139 |
140 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
141 | add_header Cache-Control "public";
142 | add_header X-Frame-Options "SAMEORIGIN";
143 | expires +1y;
144 |
145 | if (!-f $request_filename) {
146 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
147 | }
148 | }
149 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
150 | add_header Cache-Control "no-store";
151 | add_header X-Frame-Options "SAMEORIGIN";
152 | expires off;
153 |
154 | if (!-f $request_filename) {
155 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
156 | }
157 | }
158 | if (!-f $request_filename) {
159 | rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
160 | }
161 | add_header X-Frame-Options "SAMEORIGIN";
162 | }
163 |
164 | location /media/ {
165 | try_files $uri $uri/ /get.php$is_args$args;
166 |
167 | location ~ ^/media/theme_customization/.*\.xml {
168 | deny all;
169 | }
170 |
171 | location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
172 | add_header Cache-Control "public";
173 | add_header X-Frame-Options "SAMEORIGIN";
174 | expires +1y;
175 | try_files $uri $uri/ /get.php$is_args$args;
176 | }
177 | location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
178 | add_header Cache-Control "no-store";
179 | add_header X-Frame-Options "SAMEORIGIN";
180 | expires off;
181 | try_files $uri $uri/ /get.php$is_args$args;
182 | }
183 | add_header X-Frame-Options "SAMEORIGIN";
184 | }
185 |
186 | location /media/customer/ {
187 | deny all;
188 | }
189 |
190 | location /media/downloadable/ {
191 | deny all;
192 | }
193 |
194 | location /media/import/ {
195 | deny all;
196 | }
197 | location /errors/ {
198 | location ~* \.xml$ {
199 | deny all;
200 | }
201 | }
202 |
203 | # PHP entry point for main application
204 | location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
205 | try_files $uri =404;
206 | fastcgi_pass fastcgi_backend;
207 | fastcgi_buffers 1024 4k;
208 | fastcgi_buffer_size 256k;
209 |
210 | fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
211 | fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
212 | fastcgi_read_timeout 600s;
213 | fastcgi_connect_timeout 600s;
214 | fastcgi_param HTTPS "on";
215 |
216 | fastcgi_index index.php;
217 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
218 | include fastcgi_params;
219 | }
220 |
221 | gzip on;
222 | gzip_disable "msie6";
223 |
224 | gzip_comp_level 6;
225 | gzip_min_length 1100;
226 | gzip_buffers 16 8k;
227 | gzip_proxied any;
228 | gzip_types
229 | text/plain
230 | text/css
231 | text/js
232 | text/xml
233 | text/javascript
234 | application/javascript
235 | application/x-javascript
236 | application/json
237 | application/xml
238 | application/xml+rss
239 | image/svg+xml;
240 | gzip_vary on;
241 |
242 | # Banned locations (only reached if the earlier PHP entry point regexes don't match)
243 | location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
244 | deny all;
245 | }
246 |
247 |
248 | }
249 | }
250 | daemon off;
251 |
--------------------------------------------------------------------------------
/gitpod/php-fpm.conf:
--------------------------------------------------------------------------------
1 | ;;;;;;;;;;;;;;;;;;;;;
2 | ; FPM Configuration ;
3 | ;;;;;;;;;;;;;;;;;;;;;
4 |
5 | ; All relative paths in this configuration file are relative to PHP's install
6 | ; prefix (/usr). This prefix can be dynamically changed by using the
7 | ; '-p' argument from the command line.
8 |
9 | ;;;;;;;;;;;;;;;;;;
10 | ; Global Options ;
11 | ;;;;;;;;;;;;;;;;;;
12 |
13 | [global]
14 | ; Pid file
15 | ; Note: the default prefix is /var
16 | ; Default Value: none
17 | pid = /tmp/php${PHP_VERSION}-fpm.pid
18 |
19 | ; Error log file
20 | ; If it's set to "syslog", log is sent to syslogd instead of being written
21 | ; in a local file.
22 | ; Note: the default prefix is /var
23 | ; Default Value: log/php-fpm.log
24 | error_log = /tmp/php${PHP_VERSION}-fpm.log
25 |
26 | ; syslog_facility is used to specify what type of program is logging the
27 | ; message. This lets syslogd specify that messages from different facilities
28 | ; will be handled differently.
29 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
30 | ; Default Value: daemon
31 | ;syslog.facility = daemon
32 |
33 | ; syslog_ident is prepended to every message. If you have multiple FPM
34 | ; instances running on the same server, you can change the default value
35 | ; which must suit common needs.
36 | ; Default Value: php-fpm
37 | ;syslog.ident = php-fpm
38 |
39 | ; Log level
40 | ; Possible Values: alert, error, warning, notice, debug
41 | ; Default Value: notice
42 | log_level = error
43 |
44 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time
45 | ; interval set by emergency_restart_interval then FPM will restart. A value
46 | ; of '0' means 'Off'.
47 | ; Default Value: 0
48 | ;emergency_restart_threshold = 0
49 |
50 | ; Interval of time used by emergency_restart_interval to determine when
51 | ; a graceful restart will be initiated. This can be useful to work around
52 | ; accidental corruptions in an accelerator's shared memory.
53 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays)
54 | ; Default Unit: seconds
55 | ; Default Value: 0
56 | ;emergency_restart_interval = 0
57 |
58 | ; Time limit for child processes to wait for a reaction on signals from master.
59 | ; Available units: s(econds), m(inutes), h(ours), or d(ays)
60 | ; Default Unit: seconds
61 | ; Default Value: 0
62 | ;process_control_timeout = 0
63 |
64 | ; The maximum number of processes FPM will fork. This has been design to control
65 | ; the global number of processes when using dynamic PM within a lot of pools.
66 | ; Use it with caution.
67 | ; Note: A value of 0 indicates no limit
68 | ; Default Value: 0
69 | ; process.max = 128
70 |
71 | ; Specify the nice(2) priority to apply to the master process (only if set)
72 | ; The value can vary from -19 (highest priority) to 20 (lower priority)
73 | ; Note: - It will only work if the FPM master process is launched as root
74 | ; - The pool process will inherit the master process priority
75 | ; unless it specified otherwise
76 | ; Default Value: no set
77 | ; process.priority = -19
78 |
79 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
80 | ; Default Value: yes
81 | daemonize = no
82 |
83 | ; Set open file descriptor rlimit for the master process.
84 | ; Default Value: system defined value
85 | ;rlimit_files = 1024
86 |
87 | ; Set max core size rlimit for the master process.
88 | ; Possible Values: 'unlimited' or an integer greater or equal to 0
89 | ; Default Value: system defined value
90 | rlimit_core = 0
91 |
92 | ; Specify the event mechanism FPM will use. The following is available:
93 | ; - select (any POSIX os)
94 | ; - poll (any POSIX os)
95 | ; - epoll (linux >= 2.5.44)
96 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
97 | ; - /dev/poll (Solaris >= 7)
98 | ; - port (Solaris >= 10)
99 | ; Default Value: not set (auto detection)
100 | ;events.mechanism = epoll
101 |
102 | ; When FPM is build with systemd integration, specify the interval,
103 | ; in second, between health report notification to systemd.
104 | ; Set to 0 to disable.
105 | ; Available Units: s(econds), m(inutes), h(ours)
106 | ; Default Unit: seconds
107 | ; Default value: 10
108 | ;systemd_interval = 10
109 |
110 | ;;;;;;;;;;;;;;;;;;;;
111 | ; Pool Definitions ;
112 | ;;;;;;;;;;;;;;;;;;;;
113 |
114 | ; Multiple pools of child processes may be started with different listening
115 | ; ports and different management options. The name of the pool will be
116 | ; used in logs and stats. There is no limitation on the number of pools which
117 | ; FPM can handle. Your system will tell you anyway :)
118 |
119 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of
120 | ; files from a glob(3) pattern. This directive can be used everywhere in the
121 | ; file.
122 | ; Relative path can also be used. They will be prefixed by:
123 | ; - the global prefix if it's been set (-p argument)
124 | ; - /usr otherwise
125 |
126 | [www]
127 | listen = 127.0.0.1:9000
128 | listen.owner = gitpod
129 | listen.group = gitpod
130 |
131 | pm = dynamic
132 | pm.max_children = 20
133 | pm.start_servers = 3
134 | pm.min_spare_servers = 1
135 | pm.max_spare_servers = 10
136 |
--------------------------------------------------------------------------------
/gitpod/sp-elasticsearch.conf:
--------------------------------------------------------------------------------
1 | [program:elasticsearch]
2 | command=/bin/bash -c "/home/gitpod/elasticsearch-$ELASTICSEARCH_VERSION/bin/elasticsearch -p /home/gitpod/elasticsearch-$ELASTICSEARCH_VERSION/pid -Ediscovery.type=single-node"
3 | process_name=%(program_name)s
4 | #priority=1001
5 | autostart=true
6 | autorestart=true
7 | user=gitpod
8 | redirect_stderr=true
9 | startsecs=0
10 | numprocs=1
11 | #exitcodes = 0
12 |
--------------------------------------------------------------------------------
/gitpod/sp-php-fpm.conf:
--------------------------------------------------------------------------------
1 | [program:php-fpm]
2 | command=/usr/sbin/php-fpm$PHP_VERSION --fpm-config $GITPOD_REPO_ROOT/gitpod/php-fpm.conf
3 | process_name=%(program_name)s
4 | priority=1001
5 | autostart=true
6 | startretries=3
7 | autorestart=true
8 | user=gitpod
9 |
--------------------------------------------------------------------------------
/gitpod/sp-redis.conf:
--------------------------------------------------------------------------------
1 | [program:redis]
2 | command=/usr/bin/redis-server
3 | process_name=%(program_name)s
4 | priority=1001
5 | autostart=true
6 | startretries=3
7 | autorestart=true
8 | user=root
9 |
--------------------------------------------------------------------------------