corso/website/docs/setup/configuration.md
Abin Simon 01d8d085e8
Write logs to disk by default (#2082)
## Description

This changes the behavior of logs and writes it to disk instead of `stdout` by default. It also adds a new flag `--log-file` to specify the filename for the log file.

## Does this PR need a docs update or release note?

- [x]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ]  No 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* fixes https://github.com/alcionai/corso/issues/2076

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
2023-01-13 07:44:55 +00:00

4.4 KiB

Configuration

import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import {Version} from '@site/src/corsoEnv';

Two things are needed to configure Corso:

  • Environment variables containing configuration information
  • A directory for Corso to store its configuration file

Environment variables

Three distinct pieces of configuration are required by Corso:

  • S3 object storage configuration to store backups. See AWS Credentials Setup for alternate ways to pass AWS credentials.

    • AWS_ACCESS_KEY_ID: Access key for an IAM user or role for accessing an S3 bucket
    • AWS_SECRET_ACCESS_KEY: Secret key associated with the access key
    • (Optional) AWS_SESSION_TOKEN: Session token required when using temporary credentials
  • Microsoft 365 Configuration

    • AZURE_CLIENT_ID: Client ID for your Azure AD application used to access your M365 tenant
    • AZURE_TENANT_ID: ID for the M365 tenant where the Azure AD application is registered
    • AZURE_CLIENT_SECRET: Azure secret for your Azure AD application used to access your M365 tenant
  • Corso Security Passphrase

    • CORSO_PASSPHRASE: Passphrase to protect encrypted repository contents

Ensure that all of the above environment variables are defined in your Powershell environment.

$Env:AWS_ACCESS_KEY_ID = "..."
$Env:AWS_SECRET_ACCESS_KEY = "..."
$Env:AWS_SESSION_TOKEN = ""

$Env:AZURE_CLIENT_ID = "..."
$Env:AZURE_TENANT_ID = "..."
$Env:AZURE_CLIENT_SECRET = "..."

$Env:CORSO_PASSPHRASE = "CHANGE-ME-THIS-IS-INSECURE"

Ensure that all of the above environment variables are defined in your shell environment.

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...

export AZURE_CLIENT_ID=...
export AZURE_TENANT_ID=...
export AZURE_CLIENT_SECRET=...

export CORSO_PASSPHRASE=CHANGE-ME-THIS-IS-INSECURE

For ease of use with Docker, we recommend adding the names of the required environment variables (but not their values!) to a Docker environment variables file. To create the environment variables file, you can run the following command:

# Create an environment variables file
mkdir -p $HOME/.corso
cat <<EOF > $HOME/.corso/corso.env
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
AZURE_CLIENT_ID
AZURE_TENANT_ID
AZURE_CLIENT_SECRET
CORSO_PASSPHRASE
EOF

# Export required variables
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...

export AZURE_CLIENT_ID=...
export AZURE_TENANT_ID=...
export AZURE_CLIENT_SECRET=...

export CORSO_PASSPHRASE=CHANGE-ME-THIS-IS-INSECURE

Configuration File

By default, Corso stores its configuration file (.corso.toml) in the user's home directory. The location of the configuration file can be specified using the --config-file option.

By default, Corso stores its configuration file (.corso.toml) in the user's home directory. The location of the configuration file can be specified using the --config-file option.

To preserve configuration across container runs, Corso requires access to a directory outside of its Docker container to read or create its configuration file (.corso.toml). This directory must be mapped, by Docker, to the /app/corso directory within the container.

{ docker run --env-file $HOME/.corso/corso.env \\ --volume $HOME/.corso:/app/corso ghcr.io/alcionai/corso:${Version()} \\ <command> <command options> }

Log Files

The location of log files varies by operating system:

  • On Linux - ~/.cache/corso/logs/<timestamp>.log
  • On macOS - ~/Library/Logs/corso/logs/<timestamp>.log
  • On Windows - %LocalAppData%\corso/logs/<timestamp>.log

Log file location can be overridden by setting the --log-file flag.

:::info You can use stdout or stderr as the --log-file location to redirect the logs to "stdout" and "stderr" respectively. :::