-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker containers to run magento store for tests
- Loading branch information
1 parent
dbcc057
commit 32fb11c
Showing
11 changed files
with
200 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#RVVUP_PLUGIN_VERSION=dev-main | ||
RVVUP_HYVA_CHECKOUT_VERSION=dev-main | ||
RVVUP_API_KEY=replace.this.jwt | ||
# Access to Magento Repository: https://experienceleague.adobe.com/en/docs/commerce-operations/installation-guide/prerequisites/authentication-keys | ||
MAGENTO_REPO_PUBLIC_KEY=replacethis | ||
MAGENTO_REPO_PRIVATE_KEY=replacethis | ||
# Remove Magento Version line if you want to use the latest version | ||
MAGENTO_VERSION=2.4.5 | ||
HYVA_SSH_PRIVATE_KEY=replacethis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ARG MAGENTO_VERSION=2 | ||
FROM docker.io/bitnami/magento:${MAGENTO_VERSION} | ||
COPY ./docker/scripts /rvvup/scripts | ||
RUN apt-get update && apt-get install -y \ | ||
unzip \ | ||
git \ | ||
vim \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && apt-get install -y nodejs | ||
|
||
ENTRYPOINT ["/rvvup/scripts/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
services: | ||
mariadb: | ||
image: docker.io/bitnami/mariadb:10.4 | ||
environment: | ||
# ALLOW_EMPTY_PASSWORD is recommended only for development. | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- MARIADB_USER=bn_magento | ||
- MARIADB_DATABASE=bitnami_magento | ||
volumes: | ||
- 'data_mariadb:/bitnami/mariadb' | ||
magento: | ||
ports: | ||
- '80:8080' | ||
- '443:8443' | ||
environment: | ||
- BITNAMI_DEBUG=true | ||
- MAGENTO_HOST=localhost | ||
- MAGENTO_DATABASE_HOST=mariadb | ||
- MAGENTO_DATABASE_PORT_NUMBER=3306 | ||
- MAGENTO_DATABASE_USER=bn_magento | ||
- MAGENTO_DATABASE_NAME=bitnami_magento | ||
- ELASTICSEARCH_HOST=elasticsearch | ||
- ELASTICSEARCH_PORT_NUMBER=9200 | ||
# ALLOW_EMPTY_PASSWORD is recommended only for development. | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- MAGENTO_HOST=local.dev.rvvuptech.com | ||
- MAGENTO_USERNAME=admin | ||
- MAGENTO_PASSWORD=password1 | ||
- [email protected] | ||
- RVVUP_API_KEY=$RVVUP_API_KEY | ||
- RVVUP_PLUGIN_VERSION=$RVVUP_PLUGIN_VERSION | ||
- RVVUP_HYVA_CHECKOUT_VERSION=$RVVUP_HYVA_CHECKOUT_VERSION | ||
- MAGENTO_REPO_PUBLIC_KEY=$MAGENTO_REPO_PUBLIC_KEY | ||
- MAGENTO_REPO_PRIVATE_KEY=$MAGENTO_REPO_PRIVATE_KEY | ||
- HYVA_SSH_PRIVATE_KEY=$HYVA_SSH_PRIVATE_KEY | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
MAGENTO_VERSION: $MAGENTO_VERSION | ||
depends_on: | ||
- mariadb | ||
- elasticsearch | ||
elasticsearch: | ||
image: docker.io/bitnami/elasticsearch:7 | ||
volumes: | ||
- 'elasticsearch_data:/bitnami/elasticsearch/data' | ||
volumes: | ||
data_mariadb: | ||
driver: local | ||
magento_data: | ||
driver: local | ||
elasticsearch_data: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
echo "Running configure-base-store.sh" | ||
|
||
cd /bitnami/magento | ||
composer config repositories.magento composer https://repo.magento.com/ | ||
composer config http-basic.repo.magento.com $MAGENTO_REPO_PUBLIC_KEY $MAGENTO_REPO_PRIVATE_KEY | ||
bin/magento config:set currency/options/allow GBP,USD | ||
bin/magento config:set currency/options/base GBP | ||
bin/magento config:set currency/options/default GBP | ||
bin/magento config:set general/locale/timezone Europe/London | ||
bin/magento config:set general/locale/code en_GB | ||
bin/magento sampledata:deploy | ||
composer require n98/magerun2-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
echo "Running configure-hyva.sh" | ||
|
||
mkdir -p /root/.ssh/ && echo "$HYVA_SSH_PRIVATE_KEY" > /root/.ssh/id_ed25519 | ||
chmod 700 /root/.ssh && chmod 600 /root/.ssh/id_ed25519 | ||
ssh-keyscan -t rsa gitlab.hyva.io >> /root/.ssh/known_hosts | ||
cd /bitnami/magento | ||
|
||
composer config repositories.hyva-themes/magento2-theme-module git [email protected]:hyva-themes/magento2-theme-module.git | ||
composer config repositories.hyva-themes/magento2-reset-theme git [email protected]:hyva-themes/magento2-reset-theme.git | ||
composer config repositories.hyva-themes/magento2-email-module git [email protected]:hyva-themes/magento2-email-module.git | ||
composer config repositories.hyva-themes/magento2-default-theme git [email protected]:hyva-themes/magento2-default-theme.git | ||
composer config repositories.hyva-themes/magento2-compat-module-fallback git [email protected]:hyva-themes/magento2-compat-module-fallback.git | ||
composer config repositories.hyva-themes/magento2-order-cancellation-webapi git [email protected]:hyva-themes/magento2-order-cancellation-webapi.git | ||
composer config repositories.hyva-themes/hyva-checkout git [email protected]:hyva-checkout/checkout.git | ||
composer require --prefer-source hyva-themes/magento2-default-theme | ||
composer require --prefer-source hyva-themes/magento2-hyva-checkout:^1.1 | ||
bin/magento setup:upgrade | ||
bin/magento config:set dev/template/minify_html 0 | ||
vendor/bin/n98-magerun2 config:store:set design/theme/theme_id 5 --scope=stores --scope-id=1 | ||
bin/magento config:set hyva_themes_checkout/general/checkout default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
echo "Running configure-rvvup.sh" | ||
|
||
cd /bitnami/magento | ||
#composer require rvvup/module-magento-payments:$RVVUP_PLUGIN_VERSION | ||
composer require rvvup/module-magento-payments-hyva-checkout:$RVVUP_HYVA_CHECKOUT_VERSION | ||
|
||
rm -rf generated/ | ||
bin/magento setup:upgrade | ||
bin/magento setup:di:compile | ||
bin/magento setup:static-content:deploy -f | ||
bin/magento cache:flush | ||
|
||
bin/magento config:set payment/rvvup/jwt $RVVUP_API_KEY | ||
bin/magento config:set payment/rvvup/active 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
echo "Running entrypoint.sh" | ||
#Start of Bitnami's Entrypoint script | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
# set -o xtrace # Uncomment this line for debugging purposes | ||
|
||
# Load Magento environment | ||
. /opt/bitnami/scripts/magento-env.sh | ||
|
||
# Load libraries | ||
. /opt/bitnami/scripts/libbitnami.sh | ||
. /opt/bitnami/scripts/liblog.sh | ||
. /opt/bitnami/scripts/libwebserver.sh | ||
|
||
print_welcome_page | ||
|
||
info "** Starting Magento setup **" | ||
/opt/bitnami/scripts/"$(web_server_type)"/setup.sh | ||
/opt/bitnami/scripts/php/setup.sh | ||
/opt/bitnami/scripts/mysql-client/setup.sh | ||
/opt/bitnami/scripts/magento/setup.sh | ||
/post-init.sh | ||
info "** Magento setup finished! **" | ||
# End of Bitnami's Entrypoint script, now we can add rvvup's setup | ||
/rvvup/scripts/setup.sh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cd /bitnami/magento | ||
mkdir -p var/cache | ||
mkdir -p var/log | ||
find var vendor pub/static pub/media app/etc generated var/log var/cache \( -type f -or -type d \) -exec chmod u+w {} +; | ||
chown -R daemon:daemon ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
echo "Running setup.sh" | ||
/rvvup/scripts/configure-base-store.sh; | ||
/rvvup/scripts/configure-hyva.sh; | ||
/rvvup/scripts/configure-rvvup.sh; | ||
/rvvup/scripts/fix-perms.sh; | ||
/opt/bitnami/scripts/magento/run.sh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
start=$(date +%s) | ||
docker compose up -d --build | ||
attempt=1 | ||
while true; do | ||
http_status=$(curl -o /dev/null -s -w "%{http_code}\n" -I "http://local.dev.rvvuptech.com/magento_version") | ||
|
||
if [ "$http_status" -eq 200 ]; then | ||
echo -e "\rServer responded with 200 OK / Time taken: $(($(date +%s) - start)) seconds, continuing..." | ||
break | ||
else | ||
echo -ne "\rAttempt $attempt: Waiting for server to be up (Might take a couple of minutes). Current status code: $http_status / Time taken: $(($(date +%s) - start)) seconds" | ||
attempt=$((attempt + 1)) | ||
sleep 2 | ||
fi | ||
done | ||
|
||
if [ "$1" == "--ui" ]; then | ||
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com npx playwright test --ui | ||
else | ||
ENV TEST_BASE_URL=http://local.dev.rvvuptech.com npx playwright test | ||
fi |