Skip to content

Commit

Permalink
- Document how to run step-by-step
Browse files Browse the repository at this point in the history
- Moved quickstart.yml and quickstart-aletheiafact.yml to root directory
  • Loading branch information
pepermao committed Apr 18, 2024
1 parent 6b8607a commit d5b268b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 17 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
git clone https://github.com/<your-username>/aletheia
cd aletheia
```
- Startup Mongo DB via Docker:
- Startup Mongo DB via Docker and Ory Kratos:
``` sh
docker-compose up -d
```
Expand Down Expand Up @@ -41,13 +41,44 @@ yarn build
### Local environment
Todo:
- [ ] Incorporate the docker-compose config into the base docker-compose
- [ ] Document how to run it
- [ ] Remove the unnecessary docker images from Cypress CI pipeline

#### 1. Initialize the Ory Kratos submodule
To initialize the Ory Kratos submodule, run the following command in your terminal:
```sh
git submodule update --init
```
git submodules update --init

#### 2. Start Ory Kratos
Execute the following command to start Ory Kratos using Docker Compose:
```sh
docker-compose -f ./ory_infra/kratos/quickstart.yml -f ./ory_infra/quickstart-aletheiafact.yml up -d --build --force-recreate
```

#### 3. Verify the Ory Kratos Installation
After starting the service, you can verify that it's running by accessing the admin panel:
- Open your web browser and go to [http://localhost:4434/admin](http://localhost:4434/admin)
- You should see a `404 page not found` message, which indicates that the server is running but the requested endpoint does not exist.

#### 4. Configuration Setup
- Configuring YAML Files
Copy the Ory configurations from `config.example.yaml` to your `config.yaml` and `config.seed.yaml`:
- - Replace the values for `url`, `admin_url`, `admin_endpoint`, and `schema_id` with the appropriate values based on your setup in `config.example.yaml`.

- Configuring Environment Variables
Copy the Ory configurations from `.env.example` to your `.env` file:
- - Update the `NEXT_PUBLIC_ORY_SDK_URL` and `ORY_SDK_URL` variables as specified in the `.env.example` file.

#### 5. Seed the Database
Run the following command to seed the database with initial data:
```sh
yarn seed
```

#### 6. Verify User Creation
Check if users were created successfully by accessing the identities page:
- Open [http://localhost:4434/admin/identities](http://localhost:4434/admin/identities) in your browser.

### Ory Cloud
#### Taking What You Need:
- Create an account and a project on https://console.ory.sh/login.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"migrate": "env-cmd ts-node node_modules/.bin/migrate-mongo-ts up -f migrate-mongo-config.ts",
"cypress-open": "cypress open",
"cypress-run": "cypress run",
"ory-kratos:cy": "docker compose -f ./ory_infra/kratos/quickstart.yml -f ./ory_infra/quickstart-aletheiafact.yml up -d --build --force-recreate",
"ory-kratos:cy": "docker compose -f quickstart.yml -f quickstart-aletheiafact.yml up -d --build --force-recreate",
"test:e2e:cy": "env-cmd --silent concurrently -p \"[{name}]\" -n \"MongoDB,Ory,Server\" \"yarn test:e2e:mongo-server\" \"yarn ory-kratos:cy\" \"wait-on tcp:127.0.0.1:35025 tcp:127.0.0.1:4433 tcp:127.0.0.1:4434 && yarn test:e2e:app-server\"",
"test:e2e:mongo-server": "node dist/server/mongodb.server.js",
"test:e2e:app-server": "yarn seed:ci && yarn start -c config.test.ci.yaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ services:
kratos-migrate:
volumes:
- type: bind
# source: /home/runner/work/aletheia/aletheia/ory_infra/config
source: /host_mnt/Users/msantos/workspace/aletheia_fact/aletheia/ory_infra/config
source: ./ory_infra/config
target: /etc/config/kratos

kratos-selfservice-ui-node:
Expand All @@ -23,6 +22,5 @@ services:
target: /var/lib/sqlite
read_only: false
- type: bind
# source: /home/runner/work/aletheia/aletheia/ory_infra/config
source: /host_mnt/Users/msantos/workspace/aletheia_fact/aletheia/ory_infra/config
source: ./ory_infra/config
target: /etc/config/kratos
5 changes: 0 additions & 5 deletions ory_infra/quickstart.yml → quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,5 @@ services:
- type: bind
source: ./kratos/contrib/quickstart/kratos/email-password
target: /etc/config/kratos
mailslurper:
image: oryd/mailslurper:latest-smtps
ports:
- '4436:4436'
- '4437:4437'
volumes:
kratos-sqlite:
3 changes: 1 addition & 2 deletions server/auth/ory/ory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ export default class OryService {
}

deleteIdentity(identityId): Promise<any> {
const { access_token: token, admin_url } =
this.configService.get("ory");
const { access_token: token } = this.configService.get("ory");
return fetch(`${this.adminUrl}/identities/${identityId}`, {
method: "delete",
headers: { Authorization: `Bearer ${token}` },
Expand Down
1 change: 0 additions & 1 deletion server/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class UsersController {
return await this.usersService.register(createUserDto);
} catch (errorResponse) {
const { error } = errorResponse;
console.log(error);
if (error?.status === 409) {
// Ory identity already exists
throw new ConflictException(error?.message);
Expand Down
1 change: 0 additions & 1 deletion server/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class UsersService {
user.role
);
}

return await newUser.save();
}

Expand Down

0 comments on commit d5b268b

Please sign in to comment.