Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3b2a15b
Init
eldadfux Jan 31, 2022
527daf0
feat: initial commit
christyjacob4 Feb 15, 2022
f32bb9c
Remove ignored files
christyjacob4 Feb 15, 2022
d2a6047
feat: updated env variables
christyjacob4 Feb 15, 2022
d0193e5
feat: added first set of tests
christyjacob4 Feb 15, 2022
554632a
feat: added first set of tests
christyjacob4 Feb 15, 2022
66c0d60
feat: added more tests ..
christyjacob4 Feb 15, 2022
b71d6c9
feat: fix some bugs
christyjacob4 Feb 15, 2022
e83c0fe
Update dependencies, rename Docker pull variables
Meldiron Oct 26, 2022
c15454c
Copy executor from functions proxy appwite PR, add templates from OPR…
Meldiron Nov 2, 2022
829ec7d
Improve structure of executor decoupling it from Appwrite
Meldiron Nov 3, 2022
b1378a1
Update env vars, fix CI/CD
Meldiron Nov 3, 2022
0f9e258
Fix linter
Meldiron Nov 3, 2022
b0396a4
Addressing code analysis errors
Meldiron Nov 3, 2022
725f8bd
Fix code analysis errors, remove Client, add release CI/CD
Meldiron Nov 4, 2022
69b6ebe
Update TODOs
Meldiron Nov 4, 2022
4f3ac1f
Refactor into coroutine-style http server
Meldiron Nov 4, 2022
53c7611
Fix CI/CD tasks
Meldiron Nov 4, 2022
0509ce4
Re-add shutdown logic
Meldiron Nov 4, 2022
a4014c2
Linter, code analysis fix
Meldiron Nov 4, 2022
2b3db84
Improve docs, prepare test release CI/CD
Meldiron Nov 4, 2022
560f1a7
Rename CI/CD task
Meldiron Nov 4, 2022
b32b1e0
Improve docs after QA
Meldiron Nov 4, 2022
f5f9fd0
feat: add support for new DSN string
christyjacob4 Nov 5, 2022
3ff9b6e
Update README.md
christyjacob4 Nov 5, 2022
0e5df89
Update README.md
christyjacob4 Nov 5, 2022
57be4d1
Update app/http.php
christyjacob4 Nov 5, 2022
3dd4b27
feat: fix errors
christyjacob4 Nov 5, 2022
520aedd
fix: linter
christyjacob4 Nov 5, 2022
18c5089
Update app/http.php
Meldiron Nov 5, 2022
f761bca
Update app/http.php
Meldiron Nov 5, 2022
5623c4f
Update app/http.php
Meldiron Nov 5, 2022
cf8474d
Update README.md
Meldiron Nov 5, 2022
cada991
Update .devcontainer/devcontainer.json
Meldiron Nov 5, 2022
a2c936a
Update .gitpod.yml
Meldiron Nov 5, 2022
7bc30e6
PR review changes
Meldiron Nov 5, 2022
6e7554a
Merge branch 'dev' of https://github.com/open-runtimes/executor into dev
Meldiron Nov 5, 2022
c69b73a
Fix failing tests
Meldiron Nov 5, 2022
9cd80a7
Remove duplicte code.
Meldiron Nov 5, 2022
5258e67
Improve tests logs
Meldiron Nov 5, 2022
5e6e3bf
Improve CI/CD speed by pulling PHP only
Meldiron Nov 5, 2022
7cb74a1
Merge remote-tracking branch 'origin/dev' into add-dsn-support
Meldiron Nov 5, 2022
e73fbf4
feat: review comments
christyjacob4 Nov 5, 2022
65de91f
Merge pull request #2 from open-runtimes/add-dsn-support
Meldiron Nov 5, 2022
8d428cd
Update app/http.php
Meldiron Nov 6, 2022
ad3c2cc
Improve resources maintanance, remove logs, improve networking, PR re…
Meldiron Nov 6, 2022
2e0dfe5
Merge conflict fix
Meldiron Nov 6, 2022
cfb6c46
Add TODOs from discussions
Meldiron Nov 6, 2022
5847a8b
Improve pool usage, rename env vars, replace limit vars with param
Meldiron Nov 7, 2022
98222ff
Fix pool, deprecate swap setting, introduce cpu&memoery as params
Meldiron Nov 7, 2022
9237d8c
format&cq fixes
Meldiron Nov 7, 2022
021b4c0
Fix tests by upgrading lib version
Meldiron Nov 7, 2022
88794ca
Improve health endpoint structure
Meldiron Nov 7, 2022
7c77299
Merge pull request #3 from open-runtimes/feat-improve-health-structure
Meldiron Nov 7, 2022
43b9f22
Remove temp build files once not needed
Meldiron Nov 7, 2022
3578b93
Updated libraries
Meldiron Nov 7, 2022
995fc4b
Fix linter & CQ
Meldiron Nov 7, 2022
d7e4cf3
Update params on execution to copy create runtime
Meldiron Nov 8, 2022
ce16323
Rename ENV var
Meldiron Nov 8, 2022
e97c399
Fix cleanup bux
Meldiron Nov 8, 2022
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
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "open-runtimes/executor",
"onCreateCommand": "composer install --ignore-platform-reqs",
"extensions": [
"ms-azuretools.vscode-docker",
"zobo.php-intellisense"
]
}
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
OPR_EXECUTOR_ENV=development
OPR_EXECUTOR_RUNTIMES=php-8.0
OPR_EXECUTOR_CONNECTION_STORAGE=file://localhost
OPR_EXECUTOR_INACTIVE_TRESHOLD=60
OPR_EXECUTOR_NETWORK=openruntimes-runtimes
OPR_EXECUTOR_SECRET=executor-secret-key
OPR_EXECUTOR_LOGGING_PROVIDER=
OPR_EXECUTOR_LOGGING_CONFIG=
OPR_EXECUTOR_DOCKER_HUB_USERNAME=
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
16 changes: 16 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "CodeQL"

on: [pull_request]
jobs:
lint:
name: CodeQL
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Run CodeQL
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer check"
16 changes: 16 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Linter"

on: [pull_request]
jobs:
lint:
name: Linter
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Run Linter
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer lint"
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Release"

on:
release:
types: [published]

env:
IMAGE_NAME: openruntimes/executor
TAG: ${{ github.event.release.tag_name }}
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
build-args: |
OPR_EXECUTOR_VERSION=${{ env.TAG }}
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ env.TAG }}
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Tests"

on: [pull_request]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Start Test Stack
run: |
export COMPOSE_INTERACTIVE_NO_CLI
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
export BUILDKIT_PROGRESS=plain
docker pull composer:2.0
docker compose build
docker compose up -d
sleep 15

- name: Doctor
run: |
docker ps
docker network ls

- name: Run Tests
run: |
docker run --rm -v $PWD:/app --network openruntimes-runtimes -w /app phpswoole/swoole:4.8.12-php8.0-alpine sh -c \
"composer install --profile --ignore-platform-reqs && composer test"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor/
/.idea/
.phpunit.result.cache
/tests/resources/functions/**/code.tar.gz
10 changes: 10 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tasks:
- name: open-runtimes/executor
init: |
docker compose pull
docker compose build
composer install --ignore-platform-reqs
vscode:
extensions:
- ms-azuretools.vscode-docker
- zobo.php-intellisense
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity, expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at team@appwrite.io. All complaints will
be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. The project team is obligated
to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
151 changes: 151 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Contributing

We would ❤️ for you to contribute to Open Runtimes and help make it better! We want contributing to Open Runtmies to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, new docs as well as updates and tweaks, blog posts, workshops, and more.

## How to Start?

If you are worried or don’t know where to start, check out our next section explaining what kind of help we could use and where can you get involved. You can reach out with questions to [Eldad Fux (@eldadfux)](https://twitter.com/eldadfux) or anyone from the [Open Runtimes team on Discord](https://discord.gg/mkZcevnxuf). You can also submit an issue, and a maintainer can guide you!

## Code of Conduct

Help us keep Open Runtimes open and inclusive. Please read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md).

## Submit a Pull Request 🚀

Branch naming convention is as following

`TYPE-ISSUE_ID-DESCRIPTION`

example:

```
doc-548-submit-a-pull-request-section-to-contribution-guide
```

When `TYPE` can be:

- **feat** - is a new feature
- **doc** - documentation only changes
- **cicd** - changes related to CI/CD system
- **fix** - a bug fix
- **refactor** - code change that neither fixes a bug nor adds a feature

**All PRs must include a commit message with the changes description!**

For the initial start, fork the project and use git clone command to download the repository to your computer. A standard procedure for working on an issue would be to:

1. `git pull`, before creating a new branch, pull the changes from upstream. Your master needs to be up to date.

```
$ git pull
```

2. Create new branch from `master` like: `doc-548-submit-a-pull-request-section-to-contribution-guide`<br/>

```
$ git checkout -b [name_of_your_new_branch]
```

3. Work - commit - repeat ( be sure to be in your branch )

4. Push changes to GitHub

```
$ git push origin [name_of_your_new_branch]
```

5. Submit your changes for review
If you go to your repository on GitHub, you'll see a `Compare & pull request` button. Click on that button.
6. Start a Pull Request
Now submit the pull request and click on `Create pull request`.
7. Get a code review approval/reject
8. After approval, merge your PR
9. GitHub will automatically delete the branch after the merge is done. (they can still be restored).

## Running

To run Open Runtimes Executor, make sure to install PHP dependencies:

```bash
docker run --rm --interactive --tty --volume $PWD:/app composer composer install --profile --ignore-platform-reqs
```

Next start the Docker Compose stack that includes executor server with nessessary networks and volumes:

```bash
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.

## Testing

We use PHP framework PHPUnit to test Open Runtimes. Every PR is automatically tested by Travis CI, and tests run for all runtimes. Since this is PHP source code, we also run [Pint](https://github.com/laravel/pint) linter and [PHPStan](https://phpstan.org/) code analysis.

Before running the tests, make sure to install all required PHP libraries:

```bash
composer install --profile --ignore-platform-reqs
```

> We run tests in separate Swoole container to ensure unit tests have all nessessary extensions ready.

Once ready, you can test executor.

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 openruntimes-runtimes -w /app phpswoole/swoole:4.8.12-php8.0-alpine sh -c \ "composer test"
```

To run linter, you need to run Pint:

```bash
composer format
```

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

```bash
composer check
```

## Introducing New Features

We would 💖 you to contribute to Open Runtimes, but we would also like to make sure Open Runtimes is as great as possible and loyal to its vision and mission statement 🙏.

For us to find the right balance, please open an issue explaining your ideas before introducing a new pull request.

This will allow the Open Runtimes community to have sufficient discussion about the new feature value and how it fits in the product roadmap and vision.

This is also important for the Open Runtimes lead developers to be able to give technical input and different emphasis regarding the feature design and architecture. Some bigger features might need to go through our [RFC process](https://github.com/appwrite/rfc).

## Other Ways to Help

Pull requests are great, but there are many other areas where you can help Open Runtimes.

### Blogging & Speaking

Blogging, speaking about, or creating tutorials about one of Open Runtimes many features is great way to contribute and help our project grow.

### Presenting at Meetups

Presenting at meetups and conferences about your Open Runtimes projects. Your unique challenges and successes in building things with Open Runtimes can provide great speaking material. We’d love to review your talk abstract/CFP, so get in touch with us if you’d like some help!

### Sending Feedbacks & Reporting Bugs

Sending feedback is a great way for us to understand your different use cases of Open Runtimes better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/mkZcevnxuf).

### Submitting New Ideas

If you think Open Runtimes could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature.

### Improving Documentation

Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated.

### 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!
Loading