Skip to content

Commit

Permalink
Merge branch 'main' into conditional-build-2
Browse files Browse the repository at this point in the history
  • Loading branch information
goastler committed Jul 19, 2024
2 parents 3176630 + 8df7948 commit 8f8d2e3
Show file tree
Hide file tree
Showing 103 changed files with 4,563 additions and 10,618 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/provider_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
# create the provider image for AMD64
- name: Build the Provider Container
id: build_docker_provider_amd64
continue-on-error: true
continue-on-error: false
uses: docker/build-push-action@v5
with:
context: ${{github.workspace}}
Expand All @@ -130,7 +130,7 @@ jobs:
# create the provider image for ARM64
- name: Build the Provider Container
id: build_docker_provider_arm64
continue-on-error: true
continue-on-error: false
uses: docker/build-push-action@v5
with:
context: ${{github.workspace}}
Expand All @@ -157,3 +157,36 @@ jobs:
docker logs $CONTAINER >& provider.log
echo $(cat provider.log)
grep -oE "Version: \".*\"" provider.log || (echo $(cat provider.log) && exit 1)
- name: Build the provider-mock package
id: build_provider_mock_package
run: |
echo "Building the provider-mock package..."
npm run -w @prosopo/provider-mock build
# create the provider mock image for AMD64
- name: Build the Provider Mock Container
id: build_docker_provider_mock_amd64
continue-on-error: false
uses: docker/build-push-action@v5
with:
context: ${{github.workspace}}
file: ${{github.workspace}}/docker/images/provider.mock.dockerfile
platforms: linux/amd64
push: false
tags: prosopo/provider-mock:dev
outputs: type=docker,dest=provider-mock-amd64.tar

# load the provider-mock AMD64 image
- name: Load the Provider Container
run: docker load -i provider-mock-amd64.tar

# Check that the version command works when running the bundle in the provider image
- name: Check provider mock container runs
run: |
CONTAINER=$(docker run -d -p 9229:9229 prosopo/provider-mock:dev)
sleep 10s
docker logs $CONTAINER >& provider-mock.log
echo $(cat provider-mock.log)
RESPONSE=$(curl --location 'http://localhost:9229/v1/prosopo/provider/image/dapp/verify' --header 'Content-Type: application/json' --data '{"token": "0x0000c03543346872666a7739446a585a547a56334d777a727241723950314d4a685372765747577169316553757955706e684dc03547727776614546357a58623236467a397263517044575335374374455248704e6568584350634e6f48474b75745159010000000000", "dappUserSignature":"0x8656e1566313c6b707c41cdf333789b138509c1202a245f42d7d6652878c54030a8d660e04580bb565d5738c6578f5e69a066ecf8847856da3ba83dfd5701a8f"}' | jq --raw-output '.status')
if [ "$RESPONSE" = "User verified" ]; then exit 0; else exit 1; fi
20 changes: 19 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ jobs:
echo "Installing @prosopo/flux..."
npm i -g @prosopo/flux
echo "Soft redeploying flux docker js_server."
npx flux redeploy --app ProcaptchaJavascriptServer
npx flux redeploy ProcaptchaJavascriptServer
else
echo "Skipping flux redeploy."
fi
Expand Down Expand Up @@ -570,6 +570,24 @@ jobs:
push: true
tags: prosopo/provider:${{ steps.next_version.outputs.version }},prosopo/provider:latest

- name: Build the provider-mock package
id: build_provider_mock_package
run: |
echo "Building the provider-mock package..."
npm run -w @prosopo/provider-mock build
- name: Build and push the Provider Mock Container
if: steps.check_version_docker_js_server.outputs.bump == 'true'
id: publish_docker_provider_mock
continue-on-error: true
uses: docker/build-push-action@v5
with:
context: ${{github.workspace}}
file: ${{github.workspace}}/docker/images/provider.mock.dockerfile
platforms: linux/amd64
push: true
tags: prosopo/provider:${{ steps.next_version.outputs.version }},prosopo/provider-mock:latest

- name: Docker provider release notification
if: always()
run: |
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"version": "1.0.0",
"configurations": [
{
"name": "TS-Node",
"name": "tsx",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-node",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/tsx",
"runtimeArgs": ["--transpile-only", "--esm"],
"program": "${workspaceRoot}/dev/scripts/src/cli/index.ts",
"args": ["version"],
Expand Down
2 changes: 1 addition & 1 deletion contracts/captcha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"build": "tsc --build --verbose",
"build:cjs": "npx vite --config vite.cjs.config.ts build",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "tsc --build --clean",
"build": "tsc --build --verbose",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "tsc --build --clean",
"build": "tsc --build --verbose",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/client-bundle-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "vite serve ./src --port 9232 --config vite.config.ts",
"clean": "echo 'nothing to clean'",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/client-example-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"bundle:dev": "vite build --mode=development --config ./vite.config.ts",
"clean": "tsc --build --clean",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/client-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"bundle:dev": "vite build --mode=development --config vite.config.ts --outDir dist --emptyOutDir",
"clean": "tsc --build --clean",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/client-frictionless-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"bundle:dev": "vite build --mode=development --config vite.config.ts --outDir dist --emptyOutDir",
"clean": "tsc --build --clean",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/client-pow-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"bundle:dev": "vite build --mode=development --config vite.config.ts --outDir dist --emptyOutDir",
"clean": "tsc --build --clean",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/cypress-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"cypress:open:client-bundle-example:js_server": "CYPRESS_BASE_URL='http://localhost:9232' cypress open --env default_page='/jsBundleTest.html'",
"cypress:run:client-bundle-example:js_server": "CYPRESS_BASE_URL='http://localhost:9232' cypress run --env default_page='/jsBundleTest.html' --spec 'cypress/e2e/captcha.cy.ts'",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion demos/provider-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clean": "tsc --build --clean",
"build": "tsc --build --verbose tsconfig.json",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
2 changes: 1 addition & 1 deletion dev/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build": "tsc --build --verbose",
"build:cjs": "vite build --config vite.cjs.config.ts",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand Down
44 changes: 34 additions & 10 deletions dev/flux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ the app you are working with and login with the login phrase and signature.

```bash
# authenticate with the network for a specific app
npx flux auth --app <app_name>
npx flux auth <app_name>
{
nodeAPIURL: URL {
# You can now visit this (using port 16126) to login with the login phrase and signature
Expand All @@ -52,7 +52,7 @@ Use to generate the authentication for a Flux node for a specific app on a speci

```bash
# authenticate with the network for a specific app at a specific ip
npx flux auth --app <app_name> --ip <node_ip=x.x.x.x:port>
npx flux auth <app_name> --ip <node_ip=x.x.x.x:port>
```

### Get Dapp Details
Expand All @@ -74,7 +74,7 @@ Use this command to get the full details of a dapp running on the network.

```bash
# get details of a specific dapp
npx flux getDapp --app <app_name>
npx flux getDapp <app_name>
```

#### Nodes only
Expand All @@ -83,7 +83,7 @@ Use this command to get the IP addresses of the nodes that are running the app.

```bash
# get details of a specific dapp and show only the nodes
npx flux getDapp --app <app_name> --nodes
npx flux getDapp <app_name> --nodes
```

### Redeploy
Expand All @@ -94,7 +94,7 @@ Restart the app on all nodes that are running the app.

```bash
# redeploy the app
npx flux redeploy --app <app_name>
npx flux redeploy <app_name>
...
ℹ apiUrl: http://x.x.x.x:16127/id/verifylogin deploy.js 15:00:42
ℹ { status: 'success', deploy.js 15:00:42
Expand All @@ -107,7 +107,7 @@ Remove the container and restart the app on all nodes that are running the app.
```bash
# hard redeploy the app
npx flux redeploy --app <app_name> --hard
npx flux redeploy <app_name> --hard
...
ℹ apiUrl: http://x.x.x.x:16127/id/verifylogin deploy.js 15:00:42
ℹ { status: 'success', deploy.js 15:00:42
Expand All @@ -122,7 +122,7 @@ Use this command to get the logs of the app for all nodes.
```bash
# get logs of a specific dapp
npx flux getLogs --app <app_name>
npx flux getLogs <app_name>

┌─────────┬─────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (index) │ url │ logs │
Expand All @@ -148,7 +148,7 @@ Use this command to get the logs of the app from a specific node.
```bash
# get logs of a specific dapp at a specific ip
npx flux getLogs --app <app_name> --ip <node_ip=x.x.x.x:port>
npx flux getLogs <app_name> --ip <node_ip=x.x.x.x:port>
```
#### Save the logs to a file
Expand All @@ -157,7 +157,7 @@ Use this command to get the logs of the app from a specific node.
```bash
# get logs of a specific dapp and save them to a file. The log format will be `host | log` with the logs separated by a newline
npx flux getLogs --app <app_name> --file <file_name>
npx flux getLogs <app_name> --file <file_name>
```
#### Sign a Message
Expand All @@ -166,5 +166,29 @@ Use this command to sign a message with the private key of the node.
```bash
# sign a message
npx flux sign --msg <message>
> npx flux sign <msg>
CLI:info {
_: [ 'sign' ],
'$0': 'node_modules/.bin/flux',
msg: '<msg>'
}
CLI:info Public Key: 15...b
CLI:info Base64 Signature: H...=
```
### Format an env file
Use this command to format an env file in the array format needed for updating in FluxOS. The output will be printed to the terminal.
```bash
# format the env file
> npx flux formatenv .env
CLI:info ["FOO=bar","BAR=BLAH"]
```
You can write the output to a file by using the `--write` flag.
```bash
# format the env file and write the output to a file
> npx flux formatenv .env --write <file_name>
```
3 changes: 2 additions & 1 deletion dev/flux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:cjs": "npx vite --config vite.cjs.config.ts build",
"cli": "node dist/index.js",
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "npm run eslint -- --fix --quiet",
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
"prettier:fix": "npm run prettier -- --write",
"lint": "npm run eslint && npm run prettier",
Expand All @@ -36,6 +36,7 @@
"consola": "^3.2.3",
"dotenv": "^16.0.3",
"glob": "^10.0.0",
"openpgp": "^5.11.1",
"qs": "^6.11.2",
"socket.io-client": "^4.7.4",
"varuint-bitcoin": "^1.1.2",
Expand Down
4 changes: 2 additions & 2 deletions dev/flux/src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default (cmdArgs?: { logger?: Logger }) => {
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, 'flux.cli.auth')

return {
command: 'auth',
command: 'auth <app>',
describe: 'Authenticate with a Flux Node',
builder: (yargs: Argv) =>
yargs
.option('app', {
.positional('app', {
type: 'string' as const,
demandOption: false,
desc: 'Name of the app to authenticate with. Authentication is done with api.runonflux.io by default.',
Expand Down
Loading

0 comments on commit 8f8d2e3

Please sign in to comment.