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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/tests/resources/functions/**/code.tar.gz
/tests/resources/functions/**/code.zip
/tests/resources/sites/**/code.tar.gz
/tests/resources/sites/**/code.zip
/tests/resources/sites/**/code.zip
23 changes: 17 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,18 @@ Next start the Docker Compose stack that includes executor server with nessessar
docker compose up -d
```

You can now use `http://localhost:9800/v1/` endpoint to communicate with Open Runtimes Executor. You can see 'Getting Started' section of README to learn about endpoints.
For development with live reload, use Docker Compose watch which automatically syncs code changes to the container:

```bash
docker compose watch
```

The `docker-compose.override.yml` file configures the development environment:
- Changes to `app/` and `src/` sync and restart the container
- Changes to `tests/` and `phpunit.xml` sync without restart
- Changes to `composer.json` or `composer.lock` trigger a full rebuild

You can now use `http://localhost:9900/v1/` endpoint to communicate with Open Runtimes Executor. You can see 'Getting Started' section of README to learn about endpoints.

## Testing

Expand All @@ -97,19 +108,19 @@ To run tests, you need to start Docker Compose stack, and then run PHPUnit:
```bash
docker compose up -d
# Wait for ~5 seconds for executor to start
docker run --rm -v $PWD:/app --network executor_runtimes -w /app phpswoole/swoole:5.1.2-php8.3-alpine sh -c \ "composer test"
docker run --rm -v $PWD:/app --network executor_runtimes -w /app phpswoole/swoole:5.1.2-php8.3-alpine sh -c \ "composer test:e2e"
```

To run linter, you need to run Pint:
To format, you can run Pint with:

```bash
composer format
```

To run static code analysis, you need to run PHPStan:
To run static code analysis, you can run PHPStan with:

```bash
composer check
composer analyze
```

## Introducing New Features
Expand Down Expand Up @@ -148,4 +159,4 @@ Submitting documentation updates, enhancements, designs, or bug fixes. Spelling

### Helping Someone

Searching for Open Runtimes, GitHub or StackOverflow and helping someone else who needs help. You can also help by teaching others how to contribute to Open Runtimes repo!
Searching for Open Runtimes, GitHub or StackOverflow and helping someone else who needs help. You can also help by teaching others how to contribute to Open Runtimes repo!
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Install PHP libraries
FROM composer:2.0 AS composer
FROM composer:2.8 AS composer

WORKDIR /usr/local/src/

COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/
COPY composer.lock composer.json ./

RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist
Expand All @@ -15,13 +14,13 @@ FROM openruntimes/base:0.1.0 AS final
ARG OPR_EXECUTOR_VERSION
ENV OPR_EXECUTOR_VERSION=$OPR_EXECUTOR_VERSION

# Source code
# Dependencies first (changes less frequently)
COPY --from=composer /usr/local/src/vendor /usr/local/vendor

# Source code last (changes more frequently)
COPY ./app /usr/local/app
COPY ./src /usr/local/src

# Extensions and libraries
COPY --from=composer /usr/local/src/vendor /usr/local/vendor

HEALTHCHECK --interval=30s --timeout=15s --start-period=60s --retries=3 CMD curl -sf http://127.0.0.1:80/v1/health

CMD [ "php", "app/http.php" ]
27 changes: 27 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Development overrides - use with `docker compose watch`
services:
openruntimes-executor:
restart: unless-stopped
env_file:
- .env
volumes:
- ./tests/resources/functions:/storage/functions:rw
- ./tests/resources/sites:/storage/sites:rw
develop:
watch:
- action: sync+restart
path: ./app
target: /usr/local/app
- action: sync+restart
path: ./src
target: /usr/local/src
- action: sync
path: ./tests
target: /usr/local/tests
- action: sync
path: ./phpunit.xml
target: /usr/local/phpunit.xml
- action: rebuild
path: ./composer.json
- action: rebuild
path: ./composer.lock
20 changes: 0 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# WARNING!
# This is a development version of the docker-compose.yml file.
# Avoid using this file in your production environment.
# We're exposing here sensitive ports and mounting code volumes for rapid development and debugging of the server stack.

x-logging: &x-logging
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"

services:
openruntimes-executor:
hostname: executor
<<: *x-logging
stop_signal: SIGINT
build:
context: .
networks:
Expand All @@ -29,15 +15,9 @@ services:
start_period: 120s
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./app:/usr/local/app:rw
- ./src:/usr/local/src:rw
- ./tests:/usr/local/tests:rw
- ./phpunit.xml:/usr/local/phpunit.xml
- openruntimes-builds:/storage/builds:rw
- openruntimes-functions:/storage/functions:rw
- /tmp:/tmp:rw
- ./tests/resources/functions:/storage/functions:rw
- ./tests/resources/sites:/storage/sites:rw
environment:
- OPR_EXECUTOR_ENV
- OPR_EXECUTOR_IMAGES
Expand Down