Skip to content

Commit

Permalink
Merge pull request #1159 from AletheiaFact/stage
Browse files Browse the repository at this point in the history
Production Release: 1.0.1
  • Loading branch information
thesocialdev authored May 1, 2024
2 parents 27db648 + 9975ee3 commit c7d7d94
Show file tree
Hide file tree
Showing 208 changed files with 2,082 additions and 1,573 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SMTP_REFRESH_TOKEN=

# FEATURE FLAG #######
GITLAB_FEATURE_FLAG_URL=
ENV=
ENV=local
GITLAB_FEATURE_FLAG_INSTANCE_ID=
# AWS
AWS_SDK_BUCKET=aletheia
Expand Down
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# misc
.DS_Store
/**/*/._.DS_Store
.env.local
.env.development.local
.env.test.local
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
yarn lint-staged
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 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 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 removed .yarn/cache/bl-npm-1.2.3-49c4213ca5-123f097989.zip
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 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 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 removed .yarn/cache/glob-npm-6.0.4-dbb227ba4a-c4946c3d01.zip
Binary file not shown.
Binary file removed .yarn/cache/hat-npm-0.0.3-7000159181-810409c8a5.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ini-npm-1.3.8-fb5040b4c0-dfd98b0ca3.zip
Binary file not shown.
Binary file removed .yarn/cache/ip-npm-1.1.8-abea558b72-a2ade53eb3.zip
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ip-npm-2.0.0-204facb3cc-cfcfac6b87.zip
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 not shown.
Binary file removed .yarn/cache/ms-npm-0.7.3-6b71881a2c-d125c8c24a.zip
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/mv-npm-2.1.1-4c2aca3831-59d4b5ebff.zip
Binary file not shown.
Binary file removed .yarn/cache/ncp-npm-2.0.0-2121969339-ea9b19221d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/nopt-npm-4.0.3-b35e68a869-66cd3b6021.zip
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 removed .yarn/cache/rc-npm-1.2.8-d6768ac936-2e26e052f8.zip
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 removed .yarn/cache/tar-npm-4.4.19-5f8e81b87e-423c8259b1.zip
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 not shown.
Binary file removed .yarn/cache/y18n-npm-4.0.3-ced95acdbc-014dfcd9b5.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .yarn/install-state.gz
Binary file not shown.
36 changes: 34 additions & 2 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 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 Expand Up @@ -82,7 +114,7 @@ yarn build
"type": "string"
},
"role": {
"type": "string"
"type": "object"
}
},
"required": [
Expand Down
33 changes: 2 additions & 31 deletions config.development.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
# Number of worker processes to spawn.
# Set to 0 to run everything in a single process without clustering.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 2

# Number of workers to start in parallel after the first worker.
# The first worker is always started independently. After it has completed
# its start-up, this number controls the number of workers to start in
# parallel until `num_workers` have been started. Note that setting this
# number to a too high a value might lead to high resource consumption
# (especially of CPU) during the start-up process.
startup_concurrency: 1

# Log error messages and gracefully restart a worker if v8 reports that it
# uses more heap (note: not RSS) than this many mb.
worker_heap_limit_mb: 750

# The maximum interval in ms that can pass between two beat messages
# sent by each worker to the master before it is killed
worker_heartbeat_timeout: 15000

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: service-aletheia
# path relative to the __dirname variable
module: dist/server/main.js
conf:
port: 3000
cors: '*'
Expand All @@ -53,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
23 changes: 5 additions & 18 deletions config.example.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
# Number of worker processes to spawn.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 1

# Log error messages and gracefully restart a worker if v8 reports that it
# uses more heap (note: not RSS) than this many mb.
# worker_heap_limit_mb: 250

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: service-aletheia
# path relative to the __dirname variable
module: dist/server/main.js
conf:
port: 3000
cors: '*'
debug: true
websocketUrl: ws://localhost:5001
agentsUrl: http://localhost:8000
#override_public_routes: true
recaptcha_secret: RECAPTCHA_SECRET
recaptcha_sitekey: 6Lc2BtYUAAAAAOUBI-9r1sDJUIfG2nt6C43noOXh
Expand All @@ -38,6 +22,9 @@ services:
authentication_type: ory
ory:
url: ORY_SDK_URL
# Use "admin" as the endpoint when running locally.
# When using the cloud, the endpoint should be "api/kratos/admin".
admin_endpoint:
access_token: ORY_ACCESS_TOKEN
schema_id: ALETHEIA_SCHEMA_ID
feature_flag:
Expand Down
33 changes: 2 additions & 31 deletions config.production.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
# Number of worker processes to spawn.
# Set to 0 to run everything in a single process without clustering.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 2

# Number of workers to start in parallel after the first worker.
# The first worker is always started independently. After it has completed
# its start-up, this number controls the number of workers to start in
# parallel until `num_workers` have been started. Note that setting this
# number to a too high a value might lead to high resource consumption
# (especially of CPU) during the start-up process.
startup_concurrency: 1

# Log error messages and gracefully restart a worker if v8 reports that it
# uses more heap (note: not RSS) than this many mb.
worker_heap_limit_mb: 750

# The maximum interval in ms that can pass between two beat messages
# sent by each worker to the master before it is killed
worker_heartbeat_timeout: 15000

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: service-aletheia
# path relative to the __dirname variable
module: dist/server/main.js
conf:
port: 3000
cors: '*'
Expand All @@ -51,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
19 changes: 4 additions & 15 deletions config.seed.example.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
# Number of worker processes to spawn.
# Set to 0 to run everything in a single process without clustering.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 1

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: service-aletheia
# path relative to the __dirname variable
module: dist/server/seed.js
conf:
web_url: https://test.aletheiafact.org
smtp_host: {env(SMTP_CLIENT_HOST)}
Expand Down Expand Up @@ -42,5 +27,9 @@ services:
authentication_type: ory
ory:
url: ORY_SDK_URL
admin_url: ORY_SDK_URL
# Use "admin" as the endpoint when running locally.
# When using the cloud, the endpoint should be "api/kratos/admin".
admin_endpoint:
access_token: ORY_ACCESS_TOKEN
schema_id: ALETHEIA_SCHEMA_ID
26 changes: 7 additions & 19 deletions config.seed.test.ci.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
# Number of worker processes to spawn.
# Set to 0 to run everything in a single process without clustering.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 0

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: ci-seed-command
# path relative to the __dirname variable
module: dist/server/seed.js
conf:
disable_smtp: true
db:
Expand All @@ -30,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 @@ -39,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
32 changes: 6 additions & 26 deletions config.test.ci.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
# Number of worker processes to spawn.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 0

# Log error messages and gracefully restart a worker if v8 reports that it
# uses more heap (note: not RSS) than this many mb.
# worker_heap_limit_mb: 250

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: ci-websocket-aletheia
module: dist/server/websocket.js
conf:
port: 5001

- name: ci-aletheia-server
# path relative to the __dirname variable
module: dist/server/main.js
conf:
port: 3000
cors: '*'
Expand All @@ -42,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
18 changes: 0 additions & 18 deletions config.websocket.development.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
# Number of worker processes to spawn.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 0

# Log error messages and gracefully restart a worker if v8 reports that it
# uses more heap (note: not RSS) than this many mb.
# worker_heap_limit_mb: 250

# Logger info
logging:
level: trace
streams:
- type: stdout # log to stdout
named_levels: true # emit log level name instead of index. e.g. INFO vs 30

# Using config.yaml with wikimedia service-runner pattern
services:
- name: websocket-aletheia-development
# path relative to the __dirname variable
module: dist/server/websocket.js
conf:
port: 5051
Loading

0 comments on commit c7d7d94

Please sign in to comment.