change port to match old piston, some formatting change, add env to fix debian warning/error

This commit is contained in:
Brian Seymour 2021-03-28 14:01:46 -05:00
parent 01bc13d115
commit b31deaddbc
6 changed files with 30 additions and 26 deletions

View File

@ -64,7 +64,7 @@ jobs:
path: data/config.yaml
contents: |
log_level: DEBUG
bind_address: 0.0.0.0:6969
bind_address: 0.0.0.0:2000
data_directory: /piston
runner_uid_min: 1100
runner_uid_max: 1500
@ -91,7 +91,7 @@ jobs:
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build
docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api
echo Waiting for API to start..
docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:6969/runtimes
docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:2000/runtimes
echo Waiting for Index to start..
docker run --network container:piston_fs_repo appropriate/curl -s --retry 10 --retry-connrefused http://localhost:8000/index
@ -100,7 +100,7 @@ jobs:
sed -i 's/piston_fs_repo/localhost/g' repo/index
echo Listing Packages
PACKAGES_JSON=$(docker run --network container:api appropriate/curl -s http://localhost:6969/packages)
PACKAGES_JSON=$(docker run --network container:api appropriate/curl -s http://localhost:2000/packages)
echo $PACKAGES_JSON
echo Getting CLI ready
@ -114,7 +114,7 @@ jobs:
PKG_VERSION=$(awk -F- '{ print $2 }' <<< $package)
echo "Installing..."
docker run --network container:api appropriate/curl -sXPOST http://localhost:6969/packages/$PKG_PATH
docker run --network container:api appropriate/curl -sXPOST http://localhost:2000/packages/$PKG_PATH
TEST_SCRIPTS=packages/$PKG_PATH/test.*
echo "Tests: $TEST_SCRIPTS"

View File

@ -1,20 +1,24 @@
FROM node:15.8.0-buster-slim
RUN dpkg-reconfigure -p critical dash
RUN for i in $(seq 1001 1500); do \
groupadd -g $i runner$i && \
useradd -M runner$i -g $i -u $i ; \
done
RUN apt-get update && \
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev binutils build-essential locales libpcre3-dev libevent-dev libgmp3-dev libncurses6 libncurses5 libedit-dev && \
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev \
binutils build-essential locales libpcre3-dev libevent-dev libgmp3-dev \
libncurses6 libncurses5 libedit-dev && \
rm -rf /var/lib/apt/lists/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV NODE_ENV=production
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /piston_api
COPY ["package.json", "yarn.lock", "./"]
RUN yarn
COPY ./src ./src
CMD [ "node", "src", "-m", "-c", "/piston/config.yaml"]
EXPOSE 6969/tcp
EXPOSE 2000/tcp

View File

@ -45,7 +45,7 @@ const options = [
{
key: 'bind_address',
desc: 'Address to bind REST API on\nThank @Bones for the number',
default: '0.0.0.0:6969',
default: '0.0.0.0:2000',
validators: []
},
{

View File

@ -13,7 +13,7 @@ const axios_instance = function(argv){
require('yargs')(process.argv.slice(2))
.option('piston-url', {
alias: ['u'],
default: 'http://127.0.0.1:6969',
default: 'http://127.0.0.1:2000',
desc: 'Piston API URL',
string: true
})

View File

@ -1,19 +1,19 @@
version: '3.8'
services:
piston_api:
build: api
privileged: true
restart: always
ports:
- 6969:6969
volumes:
- ./data/piston:/piston
tmpfs:
- /piston/jobs:exec
piston_api:
build: api
privileged: true
restart: always
ports:
- 2000:2000
volumes:
- ./data/piston:/piston
tmpfs:
- /piston/jobs:exec
piston_fs_repo: # Local testing of packages
build: repo
command: ['dart-2.12.1'] # Only build dart
volumes:
- .:/piston
piston_fs_repo: # Local testing of packages
build: repo
command: ['dart-2.12.1'] # Only build dart
volumes:
- .:/piston

View File

@ -121,7 +121,7 @@ cd cli && yarn && cd -
echo "$GITHUB_TOKEN" | docker login https://docker.pkg.github.com -u "$GITHUB_USERNAME" --password-stdin
# Change out the $GITHUB_TOKEN and $GITHUB_USERNAME with appropritate values
docker run -v $PWD:'/piston' --tmpfs /piston/jobs -dit -p 6969:6969 --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api:latest
docker run -v $PWD:'/piston' --tmpfs /piston/jobs -dit -p 2000:2000 --privileged --name piston_api docker.pkg.github.com/engineer-man/piston/api:latest
```
<br>
@ -149,12 +149,12 @@ cli/index.js run python 3.9.1 test.py
If you are operating on a remote machine, add the `-u` flag like so:
```sh
cli/index.js -u http://piston.server:6969 ppman list
cli/index.js -u http://piston.server:2000 ppman list
```
### API
The container exposes an API on port 6969 by default.
The container exposes an API on port 2000 by default.
This is used by the CLI to carry out running jobs and package managment.
#### Runtimes Endpoint