Skip to content

Commit

Permalink
feat: s3
Browse files Browse the repository at this point in the history
  • Loading branch information
reynandaptr-ro committed Jan 13, 2025
1 parent 08e97d7 commit c8f1bfb
Show file tree
Hide file tree
Showing 6 changed files with 3,160 additions and 639 deletions.
35 changes: 12 additions & 23 deletions api/ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

The CodePush Server is configured using environment variables.

For convenience, we will also load the server environment from any '.env' file in the api directory, and the test environment from any '.test.env' file in the root directory. Use the `.env.example` file as a template for setting up your environment variables.
Currently, the following environment variables are available. For convenience, we will also load the server environment from any '.env' file in the api directory, and the test environment from any '.test.env' file in the root directory.

## Mandatory parameters

### Storage

#### Local

To emulate Azure Blob Storage locally. Azurite needs to be installed and running, more info [here](README.md#local).
- `EMULATED`: Set to 'true' in order to use the local emulator instead of a hosted instance
#### S3

#### Azure
- `AZURE_STORAGE_ACCOUNT`: The name of your hosted Azure storage instance
- `AZURE_STORAGE_ACCESS_KEY`: The key to your Azure storage instance (if KeyVault credentials are not provided)
- `AWS_BUCKET_NAME`: The name of your AWS S3 bucket
- `AWS_ACCESS_KEY_ID`: Your AWS access key ID
- `AWS_SECRET_ACCESS`: Your AWS secret access key
- `AWS_REGION`: The AWS region where your S3 bucket is located

### Authentication
### Authentication

- `SERVER_URL`: The URL of your server, for local deployment it will be either http://localhost:3000 or https://localhost:8443. For Azure it will be your Azure App URL

#### GitHub OAuth
#### GitHub OAuth

- `GITHUB_CLIENT_ID`
- `GITHUB_CLIENT_SECRET`
Expand All @@ -30,38 +30,27 @@ To emulate Azure Blob Storage locally. Azurite needs to be installed and running

- `MICROSOFT_CLIENT_ID`
- `MICROSOFT_CLIENT_SECRET`
- `MICROSOFT_TENANT_ID`: Required if application registration is single tenant.

## Optional parameters

### HTTPS

- `HTTPS`: Set to 'true' to enable HTTPS for local deployment

### Debugging

- `LOGGING`: Turn on CodePush-specific logging of API and Storage requests. If this is insufficient, Azure Storage and Express also have their own configurable logging features.
- `DEBUG_DISABLE_AUTH`: Set to 'true' to skip authentication and impersonate existing user. When set, server uses `DEBUG_USER_ID` as logged in user for all requests requiring authentication.
- `DEBUG_USER_ID`: Backend id of existing user to impersonate when `DEBUG_DISABLE_AUTH` is set to 'true'. Default value: 'default'.
- `DEBUG_DISABLE_AUTH`: Disable the OAuth autentication route, allowing you to make requests as anybody without authorizing. Do not set this without going through the proper channels (see section Disabling Auth)
- `DEBUG_USER_ID`: Backend id of user to behave as during the debugging session

### Redis

To enable the Redis caching layer, set:

- `REDIS_HOST`: The IP address where the Redis server is hosted (e.g.: codepush.redis.cache.windows.net)
- `REDIS_PORT`: The port which Redis is listening on (usually 6379 for HTTP and 6380 for HTTPS). Note that node_redis does not support HTTPS natively.
- `REDIS_KEY` (If authentication is enabled for Redis): The key used to authenticate requests to the Redis cache.

### Unit testing
To perform the unit tests against Azure storage:

- `TEST_AZURE_STORAGE`: (For unit tests) Set to 'true' in order to run API unit tests against Azure storage (instead of mocked JSON storage). Note that outside of the test environment, we will always run against Azure storage regardless.
- `AZURE_STORAGE_ACCOUNT`: (For unit tests) If TEST_AZURE_STORAGE is set to true, set to the account of the storage you would like to test on.
- `AZURE_STORAGE_ACCESS_KEY`: (For unit tests) If TEST_AZURE_STORAGE is set to true, set to the access key of the storage you would like to test on.

To perform the unit tests against an Azure server:

- `AZURE_MANAGEMENT_URL`: (For unit tests) Set to an Azure url to run management tests against that server. If the server has authentication enabled, also set the TEST_AZURE_STORAGE and AZURE_STORAGE_ACCESS_KEY to the Azure storage used by the server so that the tests can pass authentication.
- `AZURE_ACQUISITION_URL`: (For unit tests) Set to an Azure url to run acquisition tests against that server. If the server has authentication enabled, also set the TEST_AZURE_STORAGE and AZURE_STORAGE_ACCESS_KEY to the Azure storage used by the server so that the tests can pass authentication.

### Other

- `DISABLE_ACQUISITION`: Set to 'true' to disable acquisition routes
Expand Down
17 changes: 17 additions & 0 deletions api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.8"

services:
redis:
image: redis:latest
container_name: redis
ports:
- "${REDIS_PORT:-6379}:6379"
environment:
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
- REDIS_KEY=${REDIS_KEY}
volumes:
- redis-data:/data

volumes:
redis-data:
Loading

0 comments on commit c8f1bfb

Please sign in to comment.