Skip to content

Commit

Permalink
tools: env-generator, update instructions Deployment and Release Work…
Browse files Browse the repository at this point in the history
…flow rucio#401
  • Loading branch information
maany committed Jan 23, 2024
1 parent 4848b1b commit c2fefc2
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 61 deletions.
22 changes: 11 additions & 11 deletions tools/env-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This tool is used to generate the `.env.production` or `.env` or `.env.developme

## Usage

1. Copy the provided `.env.template` file to a base envionment file. The base file will be used to export environment variables that will ultimately be used for generating the .env files for the WEBUI.
1. For development, copy the provided `.env.template` file to a base envionment file. The base file will be used to export environment variables that will ultimately be used for generating the .env files for the WEBUI.

```bash
cp .env.template .env.base
Expand All @@ -28,15 +28,15 @@ cp .env.template .env.base
For each `VO` specified in the `VO_LIST` variable, the additional variables need to be specified. The variables should be added in the following format:
```export RUCIO_WEBUI_VO_<VO_SHORT_NAME>_<VARIABLE_NAME>=<VARIABLE_VALUE>```. An example for the default VO is shown below:

| Variable Name | Full Name | Description | Example | Default |
|-------------------------------------|--------------------------------------------------|--------------------------------------------------------------------------------|---------|---------|
| OIDC_PROVIDER_CERN_CLIENT_ID | RUCIO_WEBUI_OIDC_PROVIDER_CERN_CLIENT_ID | The client id for the webui registered on the OIDC Provider dashboard | | |
| OIDC_PROVIDER_CERN_CLIENT_SECRET | RUCIO_WEBUI_OIDC_PROVIDER_CERN_CLIENT_SECRET | The client secret for the webui obtained from the OIDC Provider | | |
| OIDC_PROVIDER_CERN_AUTHORIZATION_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_AUTHORIZATION_URL | The authorization URL for the OIDC Provider | | |
| OIDC_PROVIDER_CERN_TOKEN_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_TOKEN_URL | The token endpoint for the OIDC Provider | | |
| OIDC_PROVIDER_CERN_REFRESH_TOKEN_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_REFRESH_TOKEN_URL | The refresh token endpoint | | |
| OIDC_PROVIDER_CERN_USERINFO_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_USERINFO_URL | The URL to obtain user info from the OIDC Provider | | |
| OIDC_PROVIDER_CERN_REDIRECT_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_REDIRECT_URL | The redirection URL configured on the OIDC Provider | | |
| Variable Name | Full Name | Description | Example | Default |
| ------------------------------------ | ------------------------------------------------ | --------------------------------------------------------------------- | ------- | ------- |
| OIDC_PROVIDER_CERN_CLIENT_ID | RUCIO_WEBUI_OIDC_PROVIDER_CERN_CLIENT_ID | The client id for the webui registered on the OIDC Provider dashboard | | |
| OIDC_PROVIDER_CERN_CLIENT_SECRET | RUCIO_WEBUI_OIDC_PROVIDER_CERN_CLIENT_SECRET | The client secret for the webui obtained from the OIDC Provider | | |
| OIDC_PROVIDER_CERN_AUTHORIZATION_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_AUTHORIZATION_URL | The authorization URL for the OIDC Provider | | |
| OIDC_PROVIDER_CERN_TOKEN_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_TOKEN_URL | The token endpoint for the OIDC Provider | | |
| OIDC_PROVIDER_CERN_REFRESH_TOKEN_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_REFRESH_TOKEN_URL | The refresh token endpoint | | |
| OIDC_PROVIDER_CERN_USERINFO_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_USERINFO_URL | The URL to obtain user info from the OIDC Provider | | |
| OIDC_PROVIDER_CERN_REDIRECT_URL | RUCIO_WEBUI_OIDC_PROVIDER_CERN_REDIRECT_URL | The redirection URL configured on the OIDC Provider | | |

For each `OIDC Provider` specified in the `OIDC_PROVIDERS` variable, the additional variables need to be specified. The variables should be added in the following format:
```export RUCIO_WEBUI_OIDC_PROVIDER_<PROVIDER_NAME>_<VARIABLE_NAME>=<VARIABLE_VALUE>```. An example for the CERN OIDC provider is shown below:
Expand All @@ -47,7 +47,7 @@ For each `OIDC Provider` specified in the `OIDC_PROVIDERS` variable, the additio
npm install liquidjs
npm run build
chmod +x ./dist/generate-env.js
source .env.base; ./dist/generate-env.js make prod ./.env --write
source .env.base; ./dist/generate-env.js make dev ./.env --write
```

The script will report any errors in the `.env.base` file. If there are no errors, the `.env` file will be generated in the current directory.
Expand Down
99 changes: 55 additions & 44 deletions tools/env-generator/package-lock.json

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

7 changes: 5 additions & 2 deletions tools/env-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
"eslint": "^8.48.0",
"nodemon": "^3.0.1",
"typescript": "^5.2.2",
"watch": "^1.0.2",
"watch": "^0.13.0",
"yargs": "^17.7.2"
},
"files": [
"templates"
]
],
"dependencies": {
"liquidjs": "^10.10.0"
}
}
4 changes: 0 additions & 4 deletions tools/env-generator/src/commands/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ export const handler = async (argv: Arguments<Options>) => {
console.log(`write: ${write}`)
console.log(`defaults: ${defaults}`)

// process.env['RUCIasd O_WEBUI_R UCIO_HOs ST'] = 'https://rucio-server:443'
// process.env['RUCIO_WEBUI_RUCIO_AUTH_HOST'] = 'https://rucio-server:443'


// extract all env variables starting with RUCIO_WEBUI_
const prefix = 'RUCIO_WEBUI_'
let filteredEnv = Object.keys(process.env)
Expand Down

0 comments on commit c2fefc2

Please sign in to comment.