mirror of
https://github.com/engineer-man/piston.git
synced 2025-10-10 20:50:02 +02:00
owner refs updated
This commit is contained in:
parent
1d55a41a2d
commit
a2b8d904a9
9 changed files with 76 additions and 22 deletions
54
.github/copilot-instructions.md
vendored
Normal file
54
.github/copilot-instructions.md
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# Copilot instructions for the piston repo — concise reference
|
||||||
|
|
||||||
|
Purpose
|
||||||
|
- Help an AI coding agent become productive quickly by calling out the repository's runtime layout, common dev workflows, and code locations to edit or inspect.
|
||||||
|
|
||||||
|
Big picture (what to know first)
|
||||||
|
- Two main dev services (see docker-compose.dev.yaml):
|
||||||
|
- api — the HTTP service (built from the `api/` directory). Exposes port 2000 (host:container = 2000:2000). Uses env PISTON_REPO_URL to locate the package index.
|
||||||
|
- repo — local package repository (built from `repo/`). The API points at `http://repo:8000/index` inside docker-compose; open `repo/` and its Dockerfile to confirm exact listen port.
|
||||||
|
- Persistent packages are stored on the host at ./data/piston/packages and mounted into the api container at /piston/packages. Changes to packages on disk are visible to the running api container.
|
||||||
|
|
||||||
|
Quick actionable workflows (exact commands)
|
||||||
|
- Start dev environment:
|
||||||
|
- docker compose -f docker-compose.dev.yaml up --build
|
||||||
|
- or to run in background: docker compose -f docker-compose.dev.yaml up --build -d
|
||||||
|
- View logs:
|
||||||
|
- docker compose -f docker-compose.dev.yaml logs -f api
|
||||||
|
- docker compose -f docker-compose.dev.yaml logs -f repo
|
||||||
|
- Rebuild just the api:
|
||||||
|
- docker compose -f docker-compose.dev.yaml up --build api
|
||||||
|
- Exec into a running container:
|
||||||
|
- docker compose -f docker-compose.dev.yaml exec api sh
|
||||||
|
- or use container names: docker exec -it infoyouth_infoyouth_piston_api sh
|
||||||
|
- Where to look for CI/test commands:
|
||||||
|
- Check top-level files: README.md, Makefile, package.json, pyproject.toml, Dockerfiles, and .github/workflows/* for project-specific test/build commands before inventing them.
|
||||||
|
|
||||||
|
Project-specific patterns and conventions
|
||||||
|
- Docker-first dev flow: each major component has its own build context (api/, repo/). Prefer making changes in the corresponding directory and rebuilding that service.
|
||||||
|
- Environment linkage: services communicate by docker-compose service name (e.g., `repo`), not hostnames. Keep PISTON_REPO_URL updated when editing compose or integration tests.
|
||||||
|
- Packages persistence: local packages live under ./data/piston/packages — use this path in integration tests or when seeding sample packages for development.
|
||||||
|
|
||||||
|
Where changed code normally belongs
|
||||||
|
- http routes, handlers, and server code → api/
|
||||||
|
- package index and repository logic → repo/
|
||||||
|
- container configuration → api/Dockerfile, repo/Dockerfile, docker-compose.dev.yaml
|
||||||
|
|
||||||
|
Examples from this repo
|
||||||
|
- docker-compose.dev.yaml:
|
||||||
|
- api service maps host port 2000 to container 2000 and sets PISTON_REPO_URL=http://repo:8000/index
|
||||||
|
- repo service runs with command ['--no-build'] and mounts the full repo (.:/piston)
|
||||||
|
|
||||||
|
What to avoid changing blindly
|
||||||
|
- The api service is run privileged: true in dev compose — confirm why before removing.
|
||||||
|
- Don’t move the packages volume (./data/piston/packages) without updating any scripts, tests, and PERSISTED paths that expect it.
|
||||||
|
|
||||||
|
Tasks an AI can do confidently
|
||||||
|
- Add or modify an API route: update code in api/, then rebuild only the api container.
|
||||||
|
- Update package repo behavior: change code in repo/, rebuild and verify with docker compose logs -f repo.
|
||||||
|
- Seed test packages: write files into ./data/piston/packages and restart api to pick them up.
|
||||||
|
|
||||||
|
When you need more info
|
||||||
|
- Search for project-specific commands and patterns in: README.md, Dockerfiles in api/ and repo/, and any .github/workflows/*. If something is missing or ambiguous, ask the maintainer which test runner or CI job to mirror.
|
||||||
|
|
||||||
|
If anything in these instructions is unclear or you need examples of a specific task (add endpoint, seed packages, run tests), tell me which area to expand.
|
4
.github/workflows/api-push.yaml
vendored
4
.github/workflows/api-push.yaml
vendored
|
@ -34,5 +34,5 @@ jobs:
|
||||||
push: true
|
push: true
|
||||||
pull: true
|
pull: true
|
||||||
tags: |
|
tags: |
|
||||||
docker.pkg.github.com/engineer-man/piston/api
|
docker.pkg.github.com/infoyouth/piston/api
|
||||||
ghcr.io/engineer-man/piston
|
ghcr.io/infoyouth/piston
|
||||||
|
|
6
.github/workflows/package-pr.yaml
vendored
6
.github/workflows/package-pr.yaml
vendored
|
@ -54,7 +54,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
|
PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
|
||||||
echo "Packages: $PACKAGES"
|
echo "Packages: $PACKAGES"
|
||||||
docker pull docker.pkg.github.com/engineer-man/piston/repo-builder:latest
|
docker pull docker.pkg.github.com/infoyouth/piston/repo-builder:latest
|
||||||
docker build -t repo-builder repo
|
docker build -t repo-builder repo
|
||||||
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
|
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
|
||||||
ls -la packages
|
ls -la packages
|
||||||
|
@ -89,8 +89,8 @@ jobs:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
ls -la
|
ls -la
|
||||||
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build
|
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/infoyouth/piston/repo-builder --no-build
|
||||||
docker pull docker.pkg.github.com/engineer-man/piston/api
|
docker pull docker.pkg.github.com/infoyouth/piston/api
|
||||||
docker build -t piston-api api
|
docker build -t piston-api api
|
||||||
docker run --privileged --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api
|
docker run --privileged --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api
|
||||||
echo Waiting for API to start..
|
echo Waiting for API to start..
|
||||||
|
|
6
.github/workflows/package-push.yaml
vendored
6
.github/workflows/package-push.yaml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
|
PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
|
||||||
echo "Packages: $PACKAGES"
|
echo "Packages: $PACKAGES"
|
||||||
docker pull docker.pkg.github.com/engineer-man/piston/repo-builder:latest
|
docker pull docker.pkg.github.com/infoyouth/piston/repo-builder:latest
|
||||||
docker build -t repo-builder repo
|
docker build -t repo-builder repo
|
||||||
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
|
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
|
||||||
ls -la packages
|
ls -la packages
|
||||||
|
@ -51,11 +51,11 @@ jobs:
|
||||||
needs: build-pkg
|
needs: build-pkg
|
||||||
steps:
|
steps:
|
||||||
- name: 'Download all release assets'
|
- name: 'Download all release assets'
|
||||||
run: curl -s https://api.github.com/repos/engineer-man/piston/releases/latest | jq '.assets[].browser_download_url' -r | xargs -L 1 curl -sLO
|
run: curl -s https://api.github.com/repos/infoyouth/piston/releases/latest | jq '.assets[].browser_download_url' -r | xargs -L 1 curl -sLO
|
||||||
- name: 'Generate index file'
|
- name: 'Generate index file'
|
||||||
run: |
|
run: |
|
||||||
echo "" > index
|
echo "" > index
|
||||||
BASEURL=https://github.com/engineer-man/piston/releases/download/pkgs/
|
BASEURL=https://github.com/infoyouth/piston/releases/download/pkgs/
|
||||||
for pkg in *.pkg.tar.gz
|
for pkg in *.pkg.tar.gz
|
||||||
do
|
do
|
||||||
PKGFILE=$(basename $pkg)
|
PKGFILE=$(basename $pkg)
|
||||||
|
|
2
.github/workflows/repo-push.yaml
vendored
2
.github/workflows/repo-push.yaml
vendored
|
@ -28,4 +28,4 @@ jobs:
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
docker.pkg.github.com/engineer-man/piston/repo-builder
|
docker.pkg.github.com/infoyouth/piston/repo-builder
|
||||||
|
|
|
@ -3,7 +3,7 @@ version: '3.2'
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
build: api
|
build: api
|
||||||
container_name: piston_api
|
container_name: infoyouth_piston_api
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -169,7 +169,7 @@ Useful for running memory-limited contests.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
key: PISTON_REPO_URL
|
key: PISTON_REPO_URL
|
||||||
default: https://github.com/engineer-man/piston/releases/download/pkgs/index
|
default: https://github.com/infoyouth/piston/releases/download/pkgs/index
|
||||||
```
|
```
|
||||||
|
|
||||||
URL for repository index, where packages will be downloaded from.
|
URL for repository index, where packages will be downloaded from.
|
||||||
|
|
2
license
2
license
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2018-2021 Brian Seymour, Thomas Hobson, EMKC Contributors
|
Copyright (c) 2018-2021 Brian Seymour, Thomas Hobson, EMKC Contributors, Youth Innovations
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
20
readme.md
20
readme.md
|
@ -1,5 +1,5 @@
|
||||||
<h1 align="center">
|
<h1 align="center">
|
||||||
<a href="https://github.com/engineer-man/piston">
|
<a href="https://github.com/infoyouth/piston">
|
||||||
<img src="var/docs/images/piston.svg" valign="middle" width="58" height="58" alt="engineer-man piston" />
|
<img src="var/docs/images/piston.svg" valign="middle" width="58" height="58" alt="engineer-man piston" />
|
||||||
</a>
|
</a>
|
||||||
<span valign="middle">
|
<span valign="middle">
|
||||||
|
@ -12,14 +12,14 @@
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/engineer-man/piston/commits/master">
|
<a href="https://github.com/infoyouth/piston/commits/master">
|
||||||
<img src="https://img.shields.io/github/last-commit/engineer-man/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
<img src="https://img.shields.io/github/last-commit/infoyouth/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
||||||
alt="GitHub last commit">
|
alt="GitHub last commit">
|
||||||
<a href="https://github.com/engineer-man/piston/issues">
|
<a href="https://github.com/infoyouth/piston/issues">
|
||||||
<img src="https://img.shields.io/github/issues/engineer-man/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
<img src="https://img.shields.io/github/issues/infoyouth/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
||||||
alt="GitHub issues">
|
alt="GitHub issues">
|
||||||
<a href="https://github.com/engineer-man/piston/pulls">
|
<a href="https://github.com/infoyouth/piston/pulls">
|
||||||
<img src="https://img.shields.io/github/issues-pr-raw/engineer-man/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
<img src="https://img.shields.io/github/issues-pr-raw/infoyouth/piston.svg?style=for-the-badge&logo=github&logoColor=white"
|
||||||
alt="GitHub pull requests">
|
alt="GitHub pull requests">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ It's used in numerous places including:
|
||||||
|
|
||||||
The following are approved and endorsed extensions/utilities to the core Piston offering.
|
The following are approved and endorsed extensions/utilities to the core Piston offering.
|
||||||
|
|
||||||
- [I Run Code](https://github.com/engineer-man/piston-bot), a Discord bot used in 4100+ servers to handle arbitrary code evaluation in Discord. To get this bot in your own server, go here: https://emkc.org/run.
|
- [I Run Code](https://github.com/infoyouth/piston-bot), a Discord bot used in 4100+ servers to handle arbitrary code evaluation in Discord. To get this bot in your own server, go here: https://emkc.org/run.
|
||||||
- [Piston CLI](https://github.com/Shivansh-007/piston-cli), a universal shell supporting code highlighting, files, and interpretation without the need to download a language.
|
- [Piston CLI](https://github.com/Shivansh-007/piston-cli), a universal shell supporting code highlighting, files, and interpretation without the need to download a language.
|
||||||
- [Node Piston Client](https://github.com/dthree/node-piston), a Node.js wrapper for accessing the Piston API.
|
- [Node Piston Client](https://github.com/dthree/node-piston), a Node.js wrapper for accessing the Piston API.
|
||||||
- [Piston4J](https://github.com/the-codeboy/Piston4J), a Java wrapper for accessing the Piston API.
|
- [Piston4J](https://github.com/the-codeboy/Piston4J), a Java wrapper for accessing the Piston API.
|
||||||
|
@ -111,7 +111,7 @@ POST https://emkc.org/api/v2/piston/execute
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# clone and enter repo
|
# clone and enter repo
|
||||||
git clone https://github.com/engineer-man/piston
|
git clone https://github.com/infoyouth/piston
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
|
@ -145,7 +145,7 @@ docker run \
|
||||||
-dit \
|
-dit \
|
||||||
-p 2000:2000 \
|
-p 2000:2000 \
|
||||||
--name piston_api \
|
--name piston_api \
|
||||||
ghcr.io/engineer-man/piston
|
ghcr.io/infoyouth/piston
|
||||||
```
|
```
|
||||||
|
|
||||||
## Piston for testing packages locally
|
## Piston for testing packages locally
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue