Skip to content
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@ telepresence.log

.DS_Store

docker-magento/magento2
docker-magento/magento2

tmp/
27 changes: 23 additions & 4 deletions DEV.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Development using Mac Silicon

**TLDR**

- use Docker setup to easily dev

## 1. Machine Setup

1. Use Mac with Silicon
2. Install `php@8.4`
1. Run `brew install php@8.4`
Expand All @@ -11,7 +14,9 @@
1. Why? because `webdevops/php-apache-dev:8.4` doesn't work on ARM64 because of its apached ssl failing. [see this issue](https://github.com/webdevops/Dockerfile/issues/433). Weirdly, testing in orbstack works.
2. Run `brew install orbstack`
3. Run `Orbstack` in Application

## 2. Local Magento2.4 Setup w/ Xendit Module

1. Clone `magento2` in `./docker-magento/`
1. Run `git clone https://github.com/magento/magento2.git`
2. `git checkout 2.4.8`
Expand Down Expand Up @@ -48,7 +53,7 @@
4. `php bin/magento cache:flush`
5. `php bin/magento setup:static-content:deploy -f`
4. **To check**
1. Open `https://magento.local` in your browser
1. Open `https://magento24.local` in your browser
1. Important to use `https` as `http` might direct you to your Mac's local apache httpd
7. Add Sample Data
1. **Note**: this is so your store have products. useful for dev
Expand All @@ -62,7 +67,7 @@
1. (optional) If you encounter `curl error 28 while downloading https://repo.packagist.org/packages.json: Failed to connect to repo.packagist.org port 443 after 10007 ms: Timeout was reached` when downloading from composer, you may need to run this command first before retrying `composer config -g repo.packagist composer https://packagist.org`
4. Run `php bin/magento setup:upgrade`
5. Run `rm -rf generated && php bin/magento setup:upgrade && php bin/magento cache:clean`
6. Visit `https://magento.local` to see the products of sample data
6. Visit `https://magento24.local` to see the products of sample data
8. Check if Magento us running and Have xendit
1. Open `https://magento24.local/admin/`
2. Login username: `admin` password: `abcd1234`
Expand All @@ -71,6 +76,7 @@
5. See [image](./docs/imgs/magento-admin-xendit.png)

## 3. Testing Paying Locally

1. Generate Xendit Public and Private Key
1. Have a xendit test account
2. Go to `Xendit Dashboard > Settings` create Private API Key
Expand All @@ -88,38 +94,46 @@
5. In Magento Admin, go to `Stores > Configuration > Sales > Payment Methods > Xendit`
6. Set the "Custom Callback URL" field to your ngrok URL (e.g., `https://abc123.ngrok.io`)
7. Now xendit payment links webhooks will be sent to your local development environment
3.5 (Optional) Change `Xendit Callback URL`
8. If you plan to connect to xendit's staging environment, you have to change this. Ask Xendit Engineers on TPI Gateway Staging URL
4. Do test payment
1. Open `https://magento.local`
1. Open `https://magento24.local`
2. Buy anything. Add to Cart. Fill up shipping.
3. Pick `mandiri va` and you will get redirect to Xendit Payment Link
4. Click `Simulate Payment in the banner`
5. After you will get redirected back, and should see a success.

## Tips

1. Run `./bin/sync-plugin.sh` to sync changes when developing
2. When you have changes on config files (e.g. xml)
1. Run `php bin/magento cache:flush && php bin/magento setup:upgrade` then refresh browser to see changes

## TroubleShoot

### Error during setup default website

```
In WebsiteRepository.php line 159:

The default website isn't defined. Set the web
site and try again.
```

- this probably happens if u recreate the docker container

#### Fix

- delete all cache and env generated by previous setup

```
docker exec web bash -c "cd app && rm -rf app/etc/env.php app/etc/config.php var/cache/* var/page_cache/* var/session/* var/di/* var/generation/* var/view_preprocessed/* pub/static/* generated/*"
```

## Appendix

### Magento Installation Command

```
php bin/magento setup:install \
--cleanup-database \
Expand Down Expand Up @@ -149,6 +163,7 @@ php bin/magento setup:install \
```

### Seeding Data with no Auth

### Alternative (Non auth)

You can also get the sample data by adding several package from composer, add this package into your `composer.json` installation
Expand Down Expand Up @@ -187,8 +202,8 @@ composer update
Local Host setup
`sudo -- sh -c "echo '127.0.0.1 magento23.local' >> /etc/hosts"`


Installation Command

```
php bin/magento setup:install \
--admin-firstname=Admin \
Expand All @@ -214,12 +229,15 @@ php bin/magento setup:install \
```

### Magento 2.3 Setup problems

If you encounter this problem when trying to install Magento inside docker

```
Fatal error: Uncaught Error: Call to undefined function xdebug_disable()
```

Go to this directory (after finished installing dependencies)

```
vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/_bootstrap.php
```
Expand All @@ -228,6 +246,7 @@ Replace this line
`xdebug_disable();`

Into

```
if (function_exists('xdebug_disable')) {
xdebug_disable();
Expand Down