Skip to content

Commit

Permalink
fix: fix init error in runtime, add set -e for shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Feb 15, 2023
1 parent 2de068b commit 893ddcf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions deploy/scripts/install-on-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ if [ ! -x "$(command -v sealos)" ]; then
exit 1
fi

set -e

# install k8s cluster
sealos run labring/kubernetes:v1.24.9 labring/flannel:v0.19.0 labring/helm:v3.8.2 --single

Expand Down
1 change: 1 addition & 0 deletions runtimes/nodejs/init.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

# echo "****** init start ******"
set -e
node ./dist/init.js
cp -r /app/* /tmp/app
# echo "****** init end *******"
2 changes: 1 addition & 1 deletion runtimes/nodejs/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function moduleExists(mod: string) {
*/
export async function ensureCollectionIndexes(): Promise<any> {
// init.ts should not import db globally, because init.ts would be referenced in build time
const { DatabaseAgent } = require('../db')
const { DatabaseAgent } = require('./db')
await DatabaseAgent.accessor.ready
const db = DatabaseAgent.db
await db.collection(Constants.function_log_collection).createIndexes([
Expand Down

0 comments on commit 893ddcf

Please sign in to comment.