Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sourcefuse/loopback4-microservice…
Browse files Browse the repository at this point in the history
…-catalog into search
  • Loading branch information
akshatdubeysf committed Oct 21, 2021
2 parents f5e2eb6 + 9fb40e3 commit e1acb8b
Show file tree
Hide file tree
Showing 181 changed files with 83,438 additions and 1,710 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
.env
lerna-debug.log
**/*.bak
**/*.DS_Store
**/.DS_Store
11 changes: 10 additions & 1 deletion packages/core/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,14 @@
"Pubnub returned with error ! {\"name\"": "\"PubNubError\",\"status\":{\"message\":\"Missing Channel\",\"type\":\"validationError\",\"error\":true}}",
"AWS SES Config missing !": "AWS SES Config missing !",
"invalid input syntax for type uuid": " \"{\"to\":[{\"id\":\"14335492-38b6-2520-f1ab-b1b73aa5214c\",\"name\":\"Admin User\",\"type\":0}]}\"",
"EntityNotFound": "EntityNotFound"
"EntityNotFound": "EntityNotFound",
"Invalid Credentials": "Invalid Credentials",
"Token Invalid": "Token Invalid",
"User not found !": "User not found !",
"Required parameter token is missing!": "Required parameter token is missing!",
"Token Expired": "Token Expired",
"Not Found": "Not Found",
"WorkflowVersionNotFound": "WorkflowVersionNotFound",
"[{\"instancePath\"": "\"/valueB\",\"schemaPath\":\"#/properties/valueB/type\",\"keyword\":\"type\",\"params\":{\"type\":\"string\"},\"message\":\"must be string\"}]",
"WorkflowNotFound": "WorkflowNotFound"
}
6 changes: 3 additions & 3 deletions packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
entity.createdBy = currentUser.id;
entity.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.createdBy = uid;
entity.modifiedBy = uid;
return super.create(entity, options);
}

Expand All @@ -146,9 +147,10 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
const uid = currentUser?.userTenantId ?? currentUser?.id;
entities.forEach(entity => {
entity.createdBy = currentUser ? currentUser.id : '';
entity.modifiedBy = currentUser ? currentUser.id : '';
entity.createdBy = uid ?? '';
entity.modifiedBy = uid ?? '';
});
return super.createAll(entities, options);
}
Expand All @@ -158,7 +160,8 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
entity.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.modifiedBy = uid;
return super.save(entity, options);
}

Expand All @@ -167,7 +170,8 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
entity.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
entity.modifiedBy = uid;
return super.update(entity, options);
}

Expand All @@ -181,7 +185,8 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
data.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.updateAll(data, where, options);
}

Expand All @@ -195,7 +200,8 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
data.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.updateById(id, data, options);
}
async replaceById(
Expand All @@ -207,7 +213,8 @@ export abstract class DefaultTransactionalUserModifyRepository<
if (!currentUser) {
throw new HttpErrors.Forbidden(AuthErrorKeys.InvalidCredentials);
}
data.modifiedBy = currentUser.id;
const uid = currentUser?.userTenantId ?? currentUser?.id;
data.modifiedBy = uid;
return super.replaceById(id, data, options);
}

Expand Down
20 changes: 18 additions & 2 deletions packages/user-onboarding/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
{
"name": "@sourceloop/user-onboarding-client",
"version": "0.2.1",
"description": "Library for providing a smooth user onboarding",
"keywords": [
"angular-library"
],

"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "echo \"No tests available !\"",
"lint": "ng lint",
"e2e": "ng e2e",
"userOnboardingbuild": "ng build userOnboardingLib"
"userOnboardingbuild": "ng build userOnboardingLib",
"prepublishOnly": "ng-packagr -p projects/user-onboarding-lib/package.json"
},
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/sourcefuse/loopback4-microservice-catalog.git"
},
"author": "Sourcefuse",
"license": "MIT",
"private": false,
"dependencies": {
"@angular/animations": "~11.2.3",
"@angular/common": "~11.2.3",
Expand Down Expand Up @@ -49,5 +61,9 @@
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@
},
"devDependencies": {
"@types/core-js": "^2.5.4"
},
"ngPackage": {
"lib": {
"entryFile": "src/public-api.ts"
},
"dest": "../../dist/user-onboarding-lib"
}
}
95 changes: 54 additions & 41 deletions sandbox/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
# Sandbox Examples
The sandbox examples have been pre-configured with a `docker-compose` file for easy setup. Please examine the environment variables in the file prior to running and change the variables where appropriate. For example, if you want to test the Keycloak integration, plugin your configuration values to the `docker-compose.yml` file.

The sandbox examples have been pre-configured with a `docker-compose` file for easy setup. Please examine the environment variables in the file prior to running and change the variables where appropriate. For example, if you want to test the Keycloak integration, plugin your configuration values to the `docker-compose.yml` file.

## Basic Setup

You must have `docker-compose` installed locally. This is not a production grade setup.

To start the services, simply run from this directory.

```shell
docker-compose up --build
```

If you would like the services to run in detached mode, supply the `-d` parameter.

The services are now running under the following:
* [audit-ms-example](http://localhost:3032/explorer)
* [notification-example](http://localhost:3030/explorer)
* [auth-multitenant-example](http://localhost:3000/explorer)
* [in-mail-example](http://localhost:3033/explorer)
* [notification-socket-example](http://localhost:3030/explorer)
* [scheduler-example](http://localhost:3034/explorer)
* [video-conferencing-ms-example](http://localhost:3040/explorer)
* [workflow-ms-example](http://localhost:3031/explorer)
* [Camunda](http://localhost:8080)
* [pgAdmin](http://localhost:5050)
* PostgreSQL - localhost:5432
* Redis - localhost:6739

- [audit-ms-example](http://localhost:3032/explorer)
- [notification-example](http://localhost:3030/explorer)
- [auth-multitenant-example](http://localhost:3000/explorer)
- [in-mail-example](http://localhost:3033/explorer)
- [notification-socket-example](http://localhost:3030/explorer)
- [scheduler-example](http://localhost:3034/explorer)
- [video-conferencing-ms-example](http://localhost:3040/explorer)
- [workflow-ms-example](http://localhost:3031/explorer)
- [chat-notification-pubnub-example](http://localhost:3050/explorer)
- [Camunda](http://localhost:8080)
- [pgAdmin](http://localhost:5050)
- PostgreSQL - localhost:5432
- Redis - localhost:6739

Credentials for the database and pgAdmin are in the `docker-compose` file or can be overridden with environment variables. An orchestration container creates all of the databases and another runs the service DB migrations for you.

Expand Down Expand Up @@ -149,9 +154,10 @@ istio-system job.batch/istio-security-post-install-1.5.1 1/1 82s
istio-system job.batch/istio-grafana-post-install-1.5.1 1/1 82s 25d

```

</details>

Change your working directory to `./sandbox`
Change your working directory to `./sandbox`

Run the build script

Expand All @@ -161,8 +167,8 @@ chmod +x ./build.sh
./build.sh
```

Now create the `sourceloop-sandbox` namespace.
:exclamation: Skip this step if you plan on using `terrform` to deploy. :exclamation:
Now create the `sourceloop-sandbox` namespace.
:exclamation: Skip this step if you plan on using `terrform` to deploy. :exclamation:

```sh
$ microk8s kubectl apply -f k8s/manifests/namespaces/
Expand All @@ -186,7 +192,7 @@ Switched to context "sourceloop-sandbox".
```

Now create the rest of the resources:
:exclamation: Skip this step if you plan on using `terrform` to deploy. :exclamation:
:exclamation: Skip this step if you plan on using `terrform` to deploy. :exclamation:

```sh
microk8s kubectl apply -f k8s/manifests/ --recursive
Expand All @@ -205,16 +211,17 @@ To avoid adding a host header to every request, add the following entries to you
127.0.0.1 camunda.sourceloop.local
```

You're local setup is now up and running.
You're local setup is now up and running.

To view the dashboard, run

```sh
$ microk8s dashboard-proxy
```

### MicroK8s
If you run into issue, these are the commands you may need to run locally, manually.
### MicroK8s

If you run into issue, these are the commands you may need to run locally, manually.

The contents of this function can be found in the `ci_build.sh` file located in `sandbox/ci_build.sh`

Expand All @@ -235,49 +242,55 @@ install_microk8s() {

If you prefer to use the Terraform module, follow the steps below. Terraform `1.0.3` + is required.

Perform the same steps above to:
* Enable `microk8s` services
* Running the container build script
* Set the context
* Adding host header entries
Perform the same steps above to:

- Enable `microk8s` services
- Running the container build script
- Set the context
- Adding host header entries

Once the above steps are complete, you can proceed to run the following:

Once the above steps are complete, you can proceed to run the following:
```sh
cd k8s/tf-sourceloop-sandbox
terraform init
terraform apply
```

:warning: **Issues**:
* <details open="true">

- <details open="true">
<summary>connection refused</summary>
If you get an error similar the following, it shows you are unable to connect to the resources:
```

If you get an error similar the following, it shows you are unable to connect to the resources:

```
kubernetes_namespace.sourceloop_sandbox: Creating...
│ Error: Post "http://localhost/api/v1/namespaces": dial tcp 127.0.0.1:80: connect: connection refused
│ with kubernetes_namespace.sourceloop_sandbox,
│ on namespace.tf line 1, in resource "kubernetes_namespace" "sourceloop_sandbox":
│ 1: resource "kubernetes_namespace" "sourceloop_sandbox" {
```

You will need to execute the following in order to copy the kube config to the `.kube` folder: `microk8s config > $HOME/.kube/config`

---
If you downloaded MicroK8s using snap, and you get an error like the following:


***

If you downloaded MicroK8s using snap, and you get an error like the following:

```
/snap/microk8s/2346/bin/sed: couldn't flush stdout: Permission denied
```
You will can run `microk8s config` and manually copy the console output to `~/.kube/config`.

You will can run `microk8s config` and manually copy the console output to `~/.kube/config`.

</details>
* Terraform apply failed on resource creation.
* Give it about five minutes then re-run `terraform apply`, all resources should now properly apply.

See the [readme](./k8s/tf-sourceloop-sandbox/README.md) for more information on the Terraform module.
- Terraform apply failed on resource creation.
- Give it about five minutes then re-run `terraform apply`, all resources should now properly apply.

See the [readme](./k8s/tf-sourceloop-sandbox/README.md) for more information on the Terraform module.
Loading

0 comments on commit e1acb8b

Please sign in to comment.