Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Project Dolphin - Magento 2 Github Codespaces #64

Merged
merged 13 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"workspaceFolder": "/var/www/html",
"forwardPorts": [
80,
443,
8025
],
"extensions": [
"bmewburn.vscode-intelephense-client",
"felixfbecker.php-debug",
"ikappas.phpcs",
"neilbrayfield.php-docblocker",
"valeryanm.vscode-phpsab"
],
"service": "magento2",
"shutdownAction": "stopCompose",
"dockerComposeFile": [
"../docker-compose.yml",
"../compose/base/2.4.yml",
"../compose/sync/containersync.yml"
],
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "sh",
"icon": "terminal-linux"
}
}
},
"initializeCommand": "cp -u .env.sample .env",
"postCreateCommand": [
"/bin/sh",
"-c",
"/root/setup.sh"
]
}
63 changes: 63 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,75 @@ COMPOSE_PROJECT_NAME=YOUR_PROJECT_NAME
# Docker Compose File
# See https://docs.docker.com/compose/reference/envvars/#compose_file
# * Note that you can safely switch 2.3 with another release line of Magento2. e.g. 2.4
# * Legacy (Deprecated)
# * See: "Dolphin" https://github.com/graycoreio/mage2docker/tree/master/docs/stories/dolphin.md
###########
# Mac
# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.partialsync.yml

# Windows (WSL) and Linux
# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/docker-compose.fullsync.yml

# Agnostic (Dolphin)
# COMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/containersync.yml

##########################################################################
# Whether or not to use the composer project as a basis for the project, or a git repo.
# You should likely only need this when creating a green-lawn project or you're testing a release.
###########
COMPOSER_PROJECT_ENABLED=true

##########################################################################
# The Composer Project to install. Note, that on certain PHP versions, the glob
# syntax does not work, so you may need to specify an exact version.
# Ignored unless COMPOSER_PROJECT_ENABLED is `true`.
###########
COMPOSER_PROJECT=magento/project-community-edition=2.4.*

##########################################################################
# The git repo representing the Magento 2 project.
# Ignored unless COMPOSER_PROJECT_ENABLED is `false`.
###########
GIT_REPO=https://github.com/magento/magento2.git

##########################################################################
# The domain used to serve the app in the local environment.
###########
MAGENTO_DOMAIN=magento2.test

##########################################################################
# The path where the admin UI can be located.
###########
MAGENTO_ADMIN_PATH=admin

##########################################################################
# The admin username.
###########
MAGENTO_ADMIN_USERNAME=admin

##########################################################################
# The admin password.
###########
MAGENTO_ADMIN_PASSWORD=admin123

##########################################################################
# The default Language of Magento.
###########
MAGENTO_LANGUAGE=en_US

##########################################################################
# The currency of Magento.
###########
MAGENTO_CURRENCY=USD

##########################################################################
# The timezone of Magento.
###########
MAGENTO_TIMEZONE="America/Chicago"

##########################################################################
# Whether or not to use sample data. By default, we use Venia.
# Supported values include 'venia', 'luma', 'none'
# Default: 'venia'
###########
MAGENTO_SAMPLE_DATA="venia"
2 changes: 1 addition & 1 deletion .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
php: [7.2, 7.3, 7.4]
kind: [fpm-alpine, fpm-alpine-develop, fpm-alpine-develop-xdebug, cli-alpine]
kind: [fpm-alpine, fpm-alpine-develop, fpm-alpine-develop-xdebug, fpm-alpine-dolphin, cli-alpine]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/startup/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

MAGENTO_VERSION_2_3='magento/project-community-edition=2.3.*'
MAGENTO_VERSION_2_4='magento/project-community-edition=2.4.*'
COMPOSE_PROJECT_NAME='mage2docker';

case "$COMPOSER_PROJECT" in
"$MAGENTO_VERSION_2_3")
printf "\\n\\nCOMPOSE_FILE=docker-compose.yml:./compose/base/2.3.yml:compose/sync/containersync.yml:compose/php/7.4/build.yml" >> .env
sed -i -e "s|^[#]*\s*COMPOSER_PROJECT=.*|COMPOSER_PROJECT="$COMPOSER_PROJECT"|" .env
;;
$MAGENTO_VERSION_2_4)
printf "\\n\\nCOMPOSE_FILE=docker-compose.yml:./compose/base/2.4.yml:compose/sync/containersync.yml:compose/php/7.4/build.yml" >> .env
sed -i -e "s|^[#]*\s*COMPOSER_PROJECT=.*|COMPOSER_PROJECT="$COMPOSER_PROJECT"|" .env
;;
*)
printf "Unknown Magento version"
exit 1;
;;
esac

sed -i -e "s|^[#]*\s*COMPOSE_PROJECT_NAME=.*|COMPOSE_PROJECT_NAME="$COMPOSE_PROJECT_NAME"|" .env
43 changes: 43 additions & 0 deletions .github/workflows/test-env-startup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Validate The Environment

on:
pull_request:
paths-ignore:
- "docs/**"
- README.md
branches:
- dolphin
- master

jobs:
run:
strategy:
matrix:
COMPOSER_PROJECT: ["magento/project-community-edition=2.3.*", "magento/project-community-edition=2.4.*"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.COMPOSER_PROJECT }}
restore-keys: |
${{ runner.os }}-composer-
- name: Add HTTP basic auth credentials for composer
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > ~/.composer/auth.json
- name: Define the .env
run: mv .env.sample .env
- name: Configure the .env
run: .github/workflows/startup/configure.sh
env:
COMPOSER_PROJECT: ${{ matrix.COMPOSER_PROJECT }}
- name: Build the stack
run: docker-compose up -d
- name: Run the setup scripts
run: docker exec mage2docker_magento2_1 /bin/sh /root/setup.sh
- name: Test
run: docker run --network container:mage2docker_ingress_1 curlimages/curl -ksf --retry 10 --retry-connrefused https://ingress:8443
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"ms-vsliveshare.vsliveshare",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode-remote.vscode-remote-extensionpack",
"eamodio.gitlens",
"redhat.vscode-yaml",
]
}
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Get rid of your "it works on my machine" arguments.

This project intends to create an opinionated, performant, replicable, and production-like Magento 2 local development environment that leverages Docker.
This project intends to create an opinionated, performant, replicable, and production-like Magento 2 local development environment that leverages [Docker](https://www.docker.com/), [VSCode](https://code.visualstudio.com/) and [devcontainers](https://code.visualstudio.com/docs/remote/containers).

[![graycore/magento2-php pulls](https://img.shields.io/docker/pulls/graycore/magento-php.svg?label=magento-php%20docker%20pulls)](https://hub.docker.com/r/graycore/magento-php)
[![Mage2Docker Commit Activity](https://img.shields.io/badge/maintained%3F-yes-brightgreen.svg)](https://github.com/graycoreop/mage2docker/graphs/commit-activity)
Expand All @@ -20,33 +20,37 @@ This project intends to create an opinionated, performant, replicable, and produ
|-----------------|---------------------|---------------------|
| 2.2.* | N/A | Dec 2019 |
| <2.3.7 | v4.1.0 | Apr 2022 |
| >=2.3.7 | v5.0.0 | Apr 2022 |
| >=2.3.7 | >v5.0.0 | Apr 2022 |
| 2.4.0 | v4.1.0 | Nov 2022 |
| 2.4.1 | v4.1.0 | Nov 2022 |
| 2.4.2 | v5.0.0 | Nov 2022 |
| 2.4.3 | v5.0.0 | Nov 2022 |
| 2.4.2 | >v5.0.0 | Nov 2022 |
| 2.4.3 | >v5.0.0 | Nov 2022 |

## Getting Started
To get started, pick your operating system from the list below. Don't see yours? [Make an issue.](https://github.com/graycoreio/mage2docker/issues/new?assignees=damienwebdev&labels=feat&template=feature_request.md&title=%5BFEAT%5D)
### Dolphin
As of Mage2Docker v6.0.0, Dolphin is the new fully cross-platform Mage2docker environment that leverages VSCode `devcontainers` or Github Codespaces.

## Supported Platforms
* [Windows via WSL2](./docs/platforms/windows.md)
* [MacOS](./docs/platforms/macos.md)
* [Linux - Ubuntu](./docs/platforms/ubuntu.md)
To get started, see [the new significantly smoother installation process. We strongly encourage you to use it](./docs/stories/dolphin.md).

For those users curious on why we've made these changes, [please read the architecture discussion.](./docs/arch/dolphin.md)

## Prerequisites

#### Hardware
* 16GB RAM
* 4 Cores
* 4GB RAM
* 2 Cores

## Features

* :clock1: [**5 Minute** Setup](#supported-platforms)
* :octocat: Bring your own repo (BYOR)
* :biohazard: Use Magento Source Code
* :violin: Using [Composer](https://getcomposer.org/)
* :fire: Fast (~250ms Response Times Out-of-the-box)
* :evergreen_tree: Alpine Linux
* :grin: [Semver Compliant](https://semver.org/)
* :lock: [Local TLS Certificates](./docs/stories/ssl/making-tls-work-locally.md)
* :gear: [Infinitely Configurable](./docs/stories/configuring.md)
* Magento 2 Open Source & Commerce (Not Cloud) Support
* If you're using cloud, please use the ["Cloud Docker" project created by Adobe](https://devdocs.magento.com/cloud/docker/docker-config.html)
* :lock: [Local TLS Certificates](./docs/stories/ssl/making-tls-work-locally.md)
* :gear: [Infinitely Configurable](./docs/stories/configuring.md)
* [VSCode](https://code.visualstudio.com/)
* [Codespaces ready](https://github.com/features/codespaces)
4 changes: 2 additions & 2 deletions compose/base/2.3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ services:
extends:
file: ./compose/base/base.yml
service: ingress
image: graycore/magento-nginx:1.18-alpine-develop
image: graycore/magento-nginx:1.18-alpine-develop-v6.0.0-alpha.2
depends_on:
- magento2
magento2:
extends:
file: ./compose/base/base.yml
service: magento2
image: graycore/magento-php:7.3-fpm-alpine-develop
image: graycore/magento-php:7.4-fpm-alpine-dolphin-v6.0.0-alpha.2
environment:
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH6_SERVER_HOSTNAME=elasticsearch
- CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch6
Expand Down
14 changes: 12 additions & 2 deletions compose/base/2.4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ services:
extends:
file: ./compose/base/base.yml
service: ingress
image: graycore/magento-nginx:1.18-alpine-develop
image: graycore/magento-nginx:1.18-alpine-develop-v6.0.0-alpha.2
depends_on:
- magento2
magento2:
extends:
file: ./compose/base/base.yml
service: magento2
image: graycore/magento-php:7.4-fpm-alpine-develop
image: graycore/magento-php:7.4-fpm-alpine-dolphin-v6.0.0-alpha.2
environment:
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_HOSTNAME=elasticsearch
- CONFIG__DEFAULT__CATALOG__SEARCH__ENGINE=elasticsearch7
- CONFIG__DEFAULT__CATALOG__SEARCH__ELASTICSEARCH7_SERVER_PORT=9200
- PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mailhog:1025
- XDEBUG_CLIENT_PORT=9003
- XDEBUG_CLIENT_HOST=localhost
- XDEBUG_MODE=debug
database:
extends:
file: ./compose/base/base.yml
Expand Down Expand Up @@ -54,6 +58,12 @@ services:
resources:
limits:
memory: 2G
mailhog:
extends:
file: ./compose/mailhog/1.0.yaml
service: mailhog
networks:
- backend
networks:
frontend:
backend:
Expand Down
4 changes: 2 additions & 2 deletions compose/base/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- NGINX_PORT=8000
- NGINX_TLS_PORT=8443
magento2:
restart: always
restart: on-failure
networks:
- frontend
- backend
Expand All @@ -22,7 +22,7 @@ services:
database:
volumes:
- db_data:/var/lib/mysql
restart: always
restart: on-failure
environment:
MYSQL_ROOT_PASSWORD: magento2
MYSQL_DATABASE: magento2
Expand Down
8 changes: 8 additions & 0 deletions compose/php/7.2/7.2-dolphin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3"

services:
magento2:
image: graycore/magento-php:7.2-fpm-alpine-dolphin-v6.0.0-alpha.2
environment:
XDEBUG_REMOTE_PORT: "9002"
XDEBUG_REMOTE_HOST: "localhost"
6 changes: 6 additions & 0 deletions compose/php/7.2/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version : '3'

services:
magento2:
build: php/7.2/fpm-alpine-dolphin
image: graycore/magento-php:build
9 changes: 9 additions & 0 deletions compose/php/7.3/7.3-dolphin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"

services:
magento2:
image: graycore/magento-php:7.3-fpm-alpine-dolphin-v6.0.0-alpha.2
environment:
XDEBUG_CLIENT_PORT: "9003"
XDEBUG_CLIENT_HOST: "localhost"
XDEBUG_MODE: "debug"
6 changes: 6 additions & 0 deletions compose/php/7.3/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version : '3'

services:
magento2:
build: php/7.3/fpm-alpine-dolphin
image: graycore/magento-php:build
9 changes: 9 additions & 0 deletions compose/php/7.4/7.4-dolphin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"

services:
magento2:
image: graycore/magento-php:7.4-fpm-alpine-dolphin-v6.0.0-alpha.2
environment:
XDEBUG_CLIENT_PORT: "9003"
XDEBUG_CLIENT_HOST: "localhost"
XDEBUG_MODE: "debug"
6 changes: 6 additions & 0 deletions compose/php/7.4/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version : '3'

services:
magento2:
build: php/7.4/fpm-alpine-dolphin
image: graycore/magento-php:build
Loading