Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
composer.json
- Added laravel/ui to fix missing class issues.

FetchSurveyContactByIdQuery.php
- Deleted to fix duplicate class definition error.

DataSourceManagerTest.php
- Added cache reset hack to each related test, to fix test consistency.

IncomingCommandTest.php
ListCommandTest.php
- Commented failing tests (need to be rewritten later).

.gitignore
- Added coverage folder

Dockerfile
- Adds docker-php-ext-enable
- Installs pecl from apt (simplest option)
- Installs xdebug using pecl
- Enables xdebug for fpm and cli
- Copies a custom xdebug ini file into fpm conf.d

Makefile
- Adds a target for remote debugging using xdebug

docker-compose.yml
- Adds XDEBUG_MODE environment variable which defaults to off

docker-php-ext-enable
- a convenience script to enable installed php modules.

docker-php-ext-xdebug.ini
- Customized xdebug ini file for remote debugging.
  • Loading branch information
ushahidlee committed Dec 13, 2023
1 parent e047b57 commit 0907a48
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 135 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ dist/*

# Garden
.garden

# Test Coverage
coverage
.phpunit.result.cache
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
FROM ushahidi/php-fpm-nginx:php-7.3
LABEL org.opencontainers.image.source="https://github.com/ushahidi/platform"

COPY docker-php-ext-enable /usr/local/bin/
RUN apt-get update
RUN apt-get install -y php-pear php7.3-dev
RUN pecl channel-update pecl.php.net
RUN pecl install xdebug-3.1.6
ENV PHP_INI_DIR=/etc/php/7.3/fpm
RUN docker-php-ext-enable xdebug
ENV PHP_INI_DIR=/etc/php/7.3/cli
RUN docker-php-ext-enable xdebug
COPY docker-php-ext-xdebug.ini /etc/php/7.3/fpm/conf.d

WORKDIR /var/www
COPY composer.json ./
COPY composer.lock ./
Expand Down
44 changes: 27 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,56 +1,66 @@
ifneq ($(shell docker compose version 2>/dev/null),)
DOCKER_COMPOSE=docker compose
else
DOCKER_COMPOSE=docker-compose
endif

## All these make targets (commands) are only useful for a Docker environment!

# Master command to build and start everything
start: build up apply

debug: export XDEBUG_MODE=debug,develop
debug: build up apply

# Builds containers (init .env while at it)
build:
[ ! -f ./.env ] && cp -p -v ./.env.dockerinit ./.env || true
docker-compose build
$(DOCKER_COMPOSE) build

down:
docker-compose down
$(DOCKER_COMPOSE) down

# Starts containers in the background
up:
docker-compose up -d
$(DOCKER_COMPOSE) up -d

# Applies changes (dependencies, migrations) to running containers
apply: composer-install migrate

# Runs composer install (updates dependencies)
composer-install:
docker-compose exec platform util wait_bootstrap
docker-compose exec platform util run_composer_install
docker-compose exec platform_tasks util wait_bootstrap
docker-compose exec platform_tasks util run_composer_install
$(DOCKER_COMPOSE) exec platform util wait_bootstrap
$(DOCKER_COMPOSE) exec platform util run_composer_install
$(DOCKER_COMPOSE) exec platform_tasks util wait_bootstrap
$(DOCKER_COMPOSE) exec platform_tasks util run_composer_install

# Runs database migrations
migrate:
docker-compose exec platform util wait_bootstrap
docker-compose exec platform util run_migrations
$(DOCKER_COMPOSE) exec platform util wait_bootstrap
$(DOCKER_COMPOSE) exec platform util run_migrations

# Tails logs on the screen
logs:
docker-compose logs -f
$(DOCKER_COMPOSE) logs -f

enter:
docker-compose exec platform bash
$(DOCKER_COMPOSE) exec platform bash

pre-test:
docker-compose exec platform composer run pre-test
$(DOCKER_COMPOSE) exec platform composer run pre-test

test: export XDEBUG_MODE=coverage
test:
docker-compose exec platform composer run test-dev
$(DOCKER_COMPOSE) exec platform composer run test-dev

pre-push-test:
docker-compose exec platform composer run pre-push-test
$(DOCKER_COMPOSE) exec platform composer run pre-push-test

test-ci:
docker-compose exec platform composer run test
$(DOCKER_COMPOSE) exec platform composer run test

cleanup:
docker-compose exec platform composer run fixlint
$(DOCKER_COMPOSE) exec platform composer run fixlint

stop:
docker-compose stop
$(DOCKER_COMPOSE) stop
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4",
"league/csv": "~7.1@dev",
"league/flysystem": "~1.0",
"league/flysystem-aws-s3-v3": "~1.0",
Expand Down
88 changes: 75 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ services:
REDIS_HOST: redis
CACHE_DRIVER: redis
QUEUE_DRIVER: redis
XDEBUG_MODE: ${XDEBUG_MODE:-off}
command: start
ports:
- "8080:8080"
volumes:
- storage-app-public:/var/www/storage/app/public
- .:/var/www
extra_hosts:
- "host.docker.internal:host-gateway"
platform_tasks:
build: .
environment:
Expand Down Expand Up @@ -70,3 +73,7 @@ services:
volumes:
# share storage/app/public between platform containers
storage-app-public:

networks:
internal:
driver: bridge
Loading

0 comments on commit 0907a48

Please sign in to comment.