Skip to content

Commit

Permalink
feat(server): implement instance manage in server (#494)
Browse files Browse the repository at this point in the history
* fix(core): fix app db user role missing

Signed-off-by: maslow <wangfugen@126.com>

* feat(server): implement instance manage in server

Signed-off-by: maslow <wangfugen@126.com>
  • Loading branch information
maslow authored Dec 7, 2022
1 parent 71e3a93 commit 7cf8694
Show file tree
Hide file tree
Showing 24 changed files with 1,014 additions and 490 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"fullname",
"ghaction",
"gonanoid",
"healthz",
"hostpath",
"Kube",
"kubebuilder",
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/database/dbm/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (m *MongoManager) CreateDatabase(databaseName string, username string, pass
command := bson.D{
{Key: "createUser", Value: username},
{Key: "pwd", Value: password},
{Key: "roles", Value: []bson.M{{"role": "readWrite", "db": databaseName}}}}
{Key: "roles", Value: []bson.M{{"role": "readWrite", "db": databaseName}, {"role": "dbAdmin", "db": databaseName}}}}

err := m.client.Database(databaseName).RunCommand(m.context, command).Decode(&result)
if err != nil {
Expand Down
6 changes: 0 additions & 6 deletions deploy/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ sh install-k8s.sh

# setup laf core
sh install-laf-core.sh

# apply laf cluster resources
kubectl apply -f init-laf/
```

## Create development environment on MacOS
Expand All @@ -40,9 +37,6 @@ sh init-vm.sh

# setup laf core
multipass exec laf-dev -- sudo -u root sh /laf/deploy/scripts/install-laf-core.sh

# apply laf cluster resource
multipass exec laf-dev -- sudo -u root kubectl apply -f /laf/deploy/scripts/init-laf/
```

3. Start laf server
Expand Down
3 changes: 3 additions & 0 deletions deploy/scripts/install-laf-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ helm install apisix \
--namespace laf \
$CHARTS_DIR/apisix


# init laf resources
kubectl apply -f $SCRIPT_DIR/init-laf/
2 changes: 1 addition & 1 deletion runtimes/nodejs/Dockerfile.init
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ RUN chown node:node /app/package.json
RUN chown node:node /app/package-lock.json

USER node
CMD [ "node", "./dist/init.js" ]
CMD [ "sh", "/app/init.sh" ]
5 changes: 5 additions & 0 deletions runtimes/nodejs/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# echo "****** init start ******"
exec node ./dist/init.js
# echo "****** init end *******"
Loading

0 comments on commit 7cf8694

Please sign in to comment.