Skip to content

Commit

Permalink
Test the github CI to run a local ory kratos instance
Browse files Browse the repository at this point in the history
  • Loading branch information
thesocialdev committed Apr 18, 2024
1 parent 7c13b4b commit 6a9dc8b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
7 changes: 3 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,7 @@ jobs:
with:
name: aletheia-dist
path: dist
- name: List contents of aletheia-dist
run: ls -lah /home/runner/work/aletheia/aletheia
- run: git submodule update --init --recursive
- run: |
echo '{"CI_ORY_USER_PASSWORD": "${{ env.CI_ORY_USER_PASSWORD }}"}' > ./cypress.env.json
yarn install
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
4 changes: 2 additions & 2 deletions ory_infra/quickstart-aletheiafact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
kratos-migrate:
volumes:
- type: bind
source: ./config
source: /home/runner/work/aletheia/aletheia/ory_infra/config
target: /etc/config/kratos

kratos-selfservice-ui-node:
Expand All @@ -22,5 +22,5 @@ services:
target: /var/lib/sqlite
read_only: false
- type: bind
source: ./config
source: /home/runner/work/aletheia/aletheia/ory_infra/config
target: /etc/config/kratos
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"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",
"test:e2e:cy": "env-cmd --silent concurrently -p \"[{name}]\" -n \"MongoDB,Server\" \"yarn test:e2e:mongo-server\" \"wait-on tcp:127.0.0.1:35025 && yarn test:e2e:app-server\"",
"ory-kratos:cy": "docker compose -f ./ory_infra/kratos/quickstart.yml -f ./ory_infra/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
1 change: 1 addition & 0 deletions server/auth/ory/ory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Roles } from "../../auth/ability/ability.factory";

@Injectable()
export default class OryService {
private adminUrl: string;
constructor(private configService: ConfigService) {
const { admin_url, admin_endpoint } = this.configService.get("ory");

Expand Down
2 changes: 1 addition & 1 deletion src/lib/orysdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (process.env.NEXT_PUBLIC_ENVIRONMENT === "production") {
oryConfig = new Configuration({
basePath: process.env.NEXT_PUBLIC_ORY_SDK_URL,
baseOptions: {
withCredentials: false,
withCredentials: true,
},
});
}
Expand Down

0 comments on commit 6a9dc8b

Please sign in to comment.