Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Ory Kratos for development and test and deprecate use of Ory Cloud code specific #1138

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:

env:
UMAMI_SITE_ID: ${{ secrets.DEVELOPMENT_UMAMI_SITE_ID }}
ORY_SDK_URL: ${{ secrets.DEVELOPMENT_ORY_SDK_URL }}
ORY_ACCESS_TOKEN: ${{ secrets.DEVELOPMENT_ORY_ACCESS_TOKEN }}
ORY_SDK_URL: http://127.0.0.1:4433 #${{ secrets.DEVELOPMENT_ORY_SDK_URL }}
# ORY_ACCESS_TOKEN: ${{ secrets.DEVELOPMENT_ORY_ACCESS_TOKEN }}
ALETHEIA_SCHEMA_ID: ${{ secrets.DEVELOPMENT_ALETHEIA_SCHEMA_ID }}
CI_ORY_USERID: ${{ secrets.CI_ORY_USERID }}
CI_ORY_USER_PASSWORD: ${{ secrets.CI_ORY_USER_PASSWORD }}
Expand Down Expand Up @@ -96,8 +96,6 @@ jobs:
with:
name: aletheia-dist
path: dist
- name: List contents of aletheia-dist
run: ls -lah /home/runner/work/aletheia/aletheia
- run: |
echo '{"CI_ORY_USER_PASSWORD": "${{ env.CI_ORY_USER_PASSWORD }}"}' > ./cypress.env.json
yarn install
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .yarn/install-state.gz
Binary file not shown.
34 changes: 33 additions & 1 deletion 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 All @@ -38,7 +38,39 @@
yarn build
```
## Configuring Ory
### Local environment
Execute the following command to start Ory Kratos using Docker Compose:
```sh
docker-compose up kratos kratos-migrate
```

You can also use the self-service-ui-node and maisluper images to have a better experience debugging Ory.

#### 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.
- Copy the SDK Configuration url and save it.
Expand Down
2 changes: 2 additions & 0 deletions config.development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ services:
authentication_type: ory
ory:
url: ORY_SDK_URL
admin_url: ORY_SDK_URL
admin_endpoint: api/kratos/admin
access_token: ORY_ACCESS_TOKEN
schema_id: ALETHEIA_SCHEMA_ID
feature_flag:
Expand Down
2 changes: 2 additions & 0 deletions config.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ services:
authentication_type: ory
ory:
url: ORY_SDK_URL
admin_url: ORY_SDK_URL
admin_endpoint: api/kratos/admin
access_token: ORY_ACCESS_TOKEN
schema_id: ALETHEIA_SCHEMA_ID
feature_flag:
Expand Down
11 changes: 7 additions & 4 deletions config.seed.test.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
password: {env(CI_ORY_USER_PASSWORD)}
sendAuthDetails: false
isTestUser: true
oryId: {env(CI_ORY_USERID)}
# oryId: {env(CI_ORY_USERID)}
role: {
main: super-admin
}
Expand All @@ -24,9 +24,12 @@ services:
limit: 1000
authentication_type: ory
ory:
url: {env(ORY_SDK_URL)}
access_token: {env(ORY_ACCESS_TOKEN)}
schema_id: {env(ALETHEIA_SCHEMA_ID)}
url: http://localhost:4433
admin_url: http://localhost:4434
admin_endpoint: admin
# url: {env(ORY_SDK_URL)}
# access_token: {env(ORY_ACCESS_TOKEN)}
# schema_id: {env(ALETHEIA_SCHEMA_ID)}
feature_flag:
url: {env(GITLAB_FEATURE_FLAG_URL)}
appName: Staging
Expand Down
9 changes: 6 additions & 3 deletions config.test.ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ services:
limit: 1000
authentication_type: ory
ory:
url: {env(ORY_SDK_URL)}
access_token: {env(ORY_ACCESS_TOKEN)}
schema_id: {env(ALETHEIA_SCHEMA_ID)}
url: http://localhost:4433
admin_url: http://localhost:4434
admin_endpoint: admin
# url: {env(ORY_SDK_URL)}
# access_token: {env(ORY_ACCESS_TOKEN)}
# schema_id: {env(ALETHEIA_SCHEMA_ID)}
feature_flag:
url: {env(GITLAB_FEATURE_FLAG_URL)}
appName: Staging
Expand Down
62 changes: 61 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,64 @@ services:
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "./data/localstack:${DATA_DIR:-/data/localstack}"
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/docker.sock:/var/run/docker.sock"
kratos-migrate:
image: oryd/kratos:v0.13.0
environment:
- DSN=sqlite:///var/lib/sqlite/db.sqlite?_fk=true&mode=rwc
volumes:
- type: volume
source: kratos-sqlite
target: /var/lib/sqlite
read_only: false
- type: bind
source: ./ory_config
target: /etc/config/kratos
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
restart: on-failure
networks:
- intranet
kratos-selfservice-ui-node:
image: oryd/kratos-selfservice-ui-node:v0.13.0
ports:
- "4455:4455"
environment:
- PORT=4455
- SECURITY_MODE=
- KRATOS_BROWSER_URL=http://127.0.0.1:4433/
networks:
- intranet
restart: on-failure
kratos:
depends_on:
- kratos-migrate
image: oryd/kratos:v0.13.0
ports:
- '4433:4433' # public
- '4434:4434' # admin
restart: unless-stopped
environment:
- DSN=sqlite:///var/lib/sqlite/db.sqlite?_fk=true
- LOG_LEVEL=trace
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
volumes:
- type: volume
source: kratos-sqlite
target: /var/lib/sqlite
read_only: false
- type: bind
source: ./ory_config
target: /etc/config/kratos
networks:
- intranet
mailslurper:
image: oryd/mailslurper:latest-smtps
ports:
- '4436:4436'
- '4437:4437'
networks:
- intranet
networks:
intranet:
volumes:
kratos-sqlite:
Loading
Loading