Skip to content

Commit

Permalink
Delete single envs from local configs (#707)
Browse files Browse the repository at this point in the history
In preparation for #532 and
to free up space for new replicated CI tests.
  • Loading branch information
sergekh2 authored Aug 10, 2024
1 parent 18d98e5 commit 7c0c7f1
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 96 deletions.
24 changes: 2 additions & 22 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,10 @@
"console": "integratedTerminal",
},
{
"name": "Jest: current file in 'packages/sdk/' (single ne)",
"name": "Jest: current file in 'packages/stress/' (multi entitlements)",
"type": "node",
"request": "launch",
"env": { "NODE_ENV": "development", "NODE_TLS_REJECT_UNAUTHORIZED": "0", "RIVER_ENV": "local_single_ne", "DEBUG": "csb:*,test:*", "DEBUG_DEPTH":"10" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"runtimeArgs": ["--experimental-vm-modules", "--experimental-wasm-modules"],
"args": ["${file}", "--config", "${workspaceFolder}/packages/sdk/jest.config.ts", "-i", "--no-cache", "--forceExit"],
"console": "integratedTerminal",
},
{
"name": "Jest: current file in 'packages/sdk/' (single entitlements)",
"type": "node",
"request": "launch",
"env": { "NODE_ENV": "development", "NODE_TLS_REJECT_UNAUTHORIZED": "0", "RIVER_ENV": "local_single", "DEBUG": "csb:*,test:*", "DEBUG_DEPTH":"1" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"runtimeArgs": ["--experimental-vm-modules", "--experimental-wasm-modules"],
"args": ["${file}", "--config", "${workspaceFolder}/packages/sdk/jest.config.ts", "-i", "--no-cache", "--forceExit"],
"console": "integratedTerminal",
},
{
"name": "Jest: current file in 'packages/stress/' (single entitlements)",
"type": "node",
"request": "launch",
"env": { "NODE_ENV": "development", "NODE_TLS_REJECT_UNAUTHORIZED": "0", "RIVER_ENV": "local_single", "DEBUG": "csb:*,test:*", "DEBUG_DEPTH":"1" },
"env": { "NODE_ENV": "development", "NODE_TLS_REJECT_UNAUTHORIZED": "0", "RIVER_ENV": "local_multi", "DEBUG": "csb:*,test:*", "DEBUG_DEPTH":"1" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"runtimeArgs": ["--experimental-vm-modules", "--experimental-wasm-modules"],
"args": ["${file}", "--config", "${workspaceFolder}/packages/stress/jest.config.ts", "-i", "--no-cache", "--forceExit"],
Expand Down
12 changes: 1 addition & 11 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
{
"label": "CasablancaConfigureNodes",
"type": "shell",
"command": "RIVER_BLOCK_TIME=1 ./scripts/configure-nodes.sh --single && RIVER_BLOCK_TIME=1 ./scripts/configure-nodes.sh --single_ne",
"command": "RIVER_BLOCK_TIME=1 ./scripts/configure-nodes.sh --multi && RIVER_BLOCK_TIME=1 ./scripts/configure-nodes.sh --multi_ne",
"isBackground": true,
"problemMatcher": [],
"presentation": {
Expand All @@ -284,16 +284,6 @@
"panel": "shared",
}
},
{
"label": "XChain-Single",
"type": "shell",
"command": "sleep 1 && RUN_ENV=single ./core/xchain/launch_multi.sh",
"isBackground": true,
"problemMatcher": [],
"presentation": {
"group": "xchain"
}
},
{
"label": "XChain-Multi",
"type": "shell",
Expand Down
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ with `ChainID=1337`

1. duplicate `.env.localhost` file in the [contracts](.) folder of the project and rename it to `.env` (this is excluded
from git via .gitignore)
2. run `export RIVER_ENV="local_single"` from your terminal
2. run `export RIVER_ENV="local_multi"` from your terminal
3. you will then run `./scripts/deploy-contracts.sh` to deploy the entire suite of contracts to your local base-anvil
and river-anvil chains.

Expand Down
4 changes: 0 additions & 4 deletions core/env/local/single/env.env

This file was deleted.

4 changes: 0 additions & 4 deletions core/env/local/single_ne/env.env

This file was deleted.

22 changes: 0 additions & 22 deletions core/node/run_single.sh

This file was deleted.

2 changes: 1 addition & 1 deletion core/scripts/start_node.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -ue
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"

../node/run_single.sh "$@"
../node/run_multi.sh "$@"
4 changes: 2 additions & 2 deletions packages/playground/src/components/dialog/env-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
const environments = [
{ id: 'gamma', name: 'Gamma', chainId: baseSepolia.id },
{ id: 'omega', name: 'Omega', chainId: base.id },
{ id: 'local_single', name: 'Local Single', chainId: foundry.id },
{ id: 'local_multi', name: 'Local Multi', chainId: foundry.id },
] as const

export type Env = (typeof environments)[number]
Expand Down Expand Up @@ -89,7 +89,7 @@ export const RiverEnvSwitcher = (props: RiverEnvSwitcherProps) => {
</Button>
</DialogClose>
))}
{currentEnv === 'local_single' && <FundWallet />}
{currentEnv === 'local_multi' && <FundWallet />}
{isConnected && (
<Button
variant="destructive"
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"lint:fix": "yarn lint --fix",
"my-jest": "yarn node -r ../../scripts/node-no-warn.js --experimental-vm-modules $(yarn bin jest) --testTimeout=300000",
"my-node": "yarn node -r ../../scripts/node-no-warn.js --loader ts-node/esm --experimental-specifier-resolution=node --experimental-vm-modules",
"test": "yarn test:ci",
"test:ci": "RIVER_ENV=local_single_ne yarn my-jest --group=main",
"test": "yarn test:ci:multi:ne",
"test:ci": "yarn test:ci:multi:ne",
"test:ci:multi:ent": "RIVER_ENV=local_multi yarn my-jest --group=with-entitilements",
"test:ci:multi:ne": "RIVER_ENV=local_multi_ne yarn my-jest --group=main",
"test:ci:with-entitlements": "RIVER_ENV=local_single yarn my-jest --group=with-entitilements",
"test:ci:with-entitlements": "yarn test:ci:multi:ent",
"watch": "tsc --watch"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/riverConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { check } from '@river-build/dlog'

function getEnvironmentId(): string {
if (typeof process === 'object') {
return process.env.RIVER_ENV || 'local_single'
return process.env.RIVER_ENV || 'local_multi'
}
return 'local_single'
return 'local_multi'
}

function getBaseRpcUrlForChain(chainId: number): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/sync-agent/entitlements/entitlements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Entitlements implements EntitlementsDelegate {
user: string,
permission: Permission,
) {
if (this.config.environmentId === 'local_single_ne') {
if (this.config.environmentId === 'local_multi_ne') {
return true
} else if (channelId && spaceId) {
return this.spaceDapp.isEntitledToChannel(spaceId, channelId, user, permission)
Expand Down
2 changes: 1 addition & 1 deletion packages/stress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"my-jest": "NODE_TLS_REJECT_UNAUTHORIZED=0 yarn node -r ../../scripts/node-no-warn.js --experimental-vm-modules $(yarn bin jest)",
"start": "node ./dist/start.cjs",
"demo": "node ./dist/demo.cjs",
"test:ci:with-entitlements": "RIVER_ENV=local_single DEBUG='stress:*,csb:enc*,csb:dec*' DEBUG_DEPTH='10' yarn my-jest"
"test:ci:with-entitlements": "RIVER_ENV=local_multi DEBUG='stress:*,csb:enc*,csb:dec*' DEBUG_DEPTH='10' yarn my-jest"
},
"dependencies": {
"@babel/node": "^7.23.9",
Expand Down
4 changes: 2 additions & 2 deletions packages/stress/scripts/localhost_chat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo "stress/scripts/localhost_chat.sh"
# stress mode=chat requires the following environment variables
# SPACE_ID
# CHANNEL_IDS
# RIVER_ENV (default=local_single)
# RIVER_ENV (default=local_multi)
# STRESS_MODE (default=chat)
# STRESS_DURATION (default=120)
#
Expand All @@ -24,7 +24,7 @@ export SPACE_ID="${SPACE_ID}"
export CHANNEL_IDS="${CHANNEL_IDS}"
export ANNOUNCE_CHANNEL_ID="${ANNOUNCE_CHANNEL_ID:-}"

export RIVER_ENV="${RIVER_ENV:-local_single}"
export RIVER_ENV="${RIVER_ENV:-local_multi}"
export STRESS_MODE="${STRESS_MODE:-chat}"
export STRESS_DURATION="${STRESS_DURATION:-360}"
export SESSION_ID="${SESSION_ID:-$(uuidgen)}"
Expand Down
2 changes: 1 addition & 1 deletion packages/stress/scripts/localhost_chat_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo "stress/scripts/localhost_setup_chat.sh"
#
# create space and channels for stress testing
#
export RIVER_ENV="${RIVER_ENV:-local_single}"
export RIVER_ENV="${RIVER_ENV:-local_multi}"
export STRESS_MODE="${STRESS_MODE:-setup_chat}"
export SESSION_ID="${SESSION_ID:-$(uuidgen)}"
export MNEMONIC="toy alien remain valid print employ age multiply claim student story aware"
Expand Down
2 changes: 1 addition & 1 deletion packages/stress/scripts/localhost_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "stress/scripts/localhost_demo.sh"
# simple test that runs in ci to ensure that the stress test can run in node against local env
#

export RIVER_ENV="${RIVER_ENV:-local_single}"
export RIVER_ENV="${RIVER_ENV:-local_multi}"
export STRESS_MODE="${STRESS_MODE:-test}"
export SESSION_ID="${SESSION_ID:-$(uuidgen)}"

Expand Down
2 changes: 1 addition & 1 deletion packages/stress/src/utils/stressClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function makeStressClient(
user: string,
permission: Permission,
) => {
if (config.environmentId === 'local_single_ne') {
if (config.environmentId === 'local_multi_ne') {
return true
} else if (channelId && spaceId) {
return spaceDapp.isEntitledToChannel(spaceId, channelId, user, permission)
Expand Down
8 changes: 1 addition & 7 deletions scripts/configure-nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ cd ..

export RIVER_BLOCK_TIME="${RIVER_BLOCK_TIME:-1}"

# check to see if the user passed a --single or --multi flag
# if not, default to --single
if [ "$1" == "--single" ]; then
./core/node/run_single.sh -c
elif [ "$1" == "--single_ne" ]; then
./core/node/run_single.sh -c --de
elif [ "$1" == "--multi" ]; then
if [ "$1" == "--multi" ]; then
./core/node/run_multi.sh -c
elif [ "$1" == "--multi_ne" ]; then
./core/node/run_multi.sh -c --de
Expand Down
2 changes: 0 additions & 2 deletions scripts/kill-all-local-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ fi

if prompt 'Stop XChain?:y/n '
then
RUN_ENV=single ./core/xchain/stop_multi.sh
RUN_ENV=single_ne ./core/xchain/stop_multi.sh
RUN_ENV=multi ./core/xchain/stop_multi.sh
RUN_ENV=multi_ne ./core/xchain/stop_multi.sh

Expand Down
9 changes: 2 additions & 7 deletions scripts/start_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ wait_for_process "$BUILD_PID" "build"
echo "STARTED ALL CHAINS AND BUILT ALL CONTRACTS"

# Now generate the core server config
./scripts/configure-nodes.sh --single
./scripts/configure-nodes.sh --single_ne
./scripts/configure-nodes.sh --multi
#./scripts/configure-nodes.sh --multi_ne
./scripts/configure-nodes.sh --multi_ne

# Continue with rest of the script
echo "Continuing with the rest of the script..."
Expand All @@ -119,11 +117,8 @@ commands=(
"watch_proto:cd packages/proto && yarn watch"
"watch_web3:cd packages/web3 && yarn watch"
"watch_go:cd protocol && yarn watch:go"
"core_single:./core/node/run_single.sh -r"
"core_single_ne:./core/node/run_single.sh -r --de"
"core_multi:./core/node/run_multi.sh -r"
#"core_multi_ne:./core/node/run_multi.sh -r --de"
"xchain_single:RUN_ENV=single ./core/xchain/launch_multi.sh"
"core_multi_ne:./core/node/run_multi.sh -r --de"
"xchain_multi:RUN_ENV=multi ./core/xchain/launch_multi.sh"
)

Expand Down
2 changes: 1 addition & 1 deletion services/fetch-image/.env.localhost
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Required.
RIVER_ENV=local_single
RIVER_ENV=local_multi
# IMPORTANT: disable tls cert validation in localhost env ONLY
# in all other environments, comment out this line.
NODE_TLS_REJECT_UNAUTHORIZED=0
Expand Down

0 comments on commit 7c0c7f1

Please sign in to comment.