Skip to content

Commit

Permalink
Updated documentation to include more installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Isawan committed Feb 6, 2024
1 parent 0231bf0 commit bc1db55
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 10 deletions.
4 changes: 3 additions & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- [Introduction](./introduction.md)
- [Reverse proxy](./reverse-proxy.md)
- [Database migrations](./database-migrations.md)
- [S3 compatible object storage](./s3-compatible-object-storage.md)
- [PostgreSQL](./postgresql.md)
- [Starting terrashine](./starting-terrashine.md)
- [Private Registry Authentication](./private-registry-authentication.md)
- [Mirror refreshing](./mirror-refreshing.md)
9 changes: 0 additions & 9 deletions docs/src/database-migrations.md

This file was deleted.

18 changes: 18 additions & 0 deletions docs/src/postgresql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# PostgreSQL

Terrashine requires postgreSQL to store metadata associated with upstream registries and downloaded terraform providers.
Terrashine does not store any terraform providers inside of postgreSQL itself so the requirements are typically fairly light.

Please see postgreSQL's [excellent documentation](https://www.postgresql.org/docs/16/admin.html) to set up the database.

## Database migrations

When upgrading or starting up terrashine for the first time, we need to run database migrations against the database.
For this, you'll need the [sqlx](https://github.com/launchbadge/sqlx) migration tool.
We can perform the migration with the following command.

``` bash
sqlx migrate run --database-url postgres://postgres:password@localhost/
```

This command should be executed from a checkout of the git repository associated with the version.
17 changes: 17 additions & 0 deletions docs/src/s3-compatible-object-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Setting up S3-compatible object storage

Terrashine requires an S3 compatible storage to cache terraform providers.
It is currently tested against AWS S3 and Minio.
To set up AWS S3, please follow the AWS instruction to [create a bucket and obtain a set of credentials](https://docs.aws.amazon.com/AmazonS3/latest/userguide/GetStartedWithS3.html).

Terrashine requires a bucket to be created and a set of credentials to be available.
The AWS Rust SDK is used to authenticate to S3 so the credentials can be provided to the binary using any supported credential provider.
Most commonly, this can be provided using the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY_ID` environment variables.

Terrashine requires the following actions in the IAM policy:

* GetObject
* PutObject

For a non-AWS S3 compatible object storage, see the `docker-compose.yml` in the repository where an example minio integration is used.
In this case, a CLI flag `--s3-endpoint` can be used to point terrashine at an alternative URL.
20 changes: 20 additions & 0 deletions docs/src/starting-terrashine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Starting terrashine

At this point, its expected that you now have a postgres database provisioned, an S3 endpoint for object storage and a reverse proxy for TLS termination.

Terrashine is configured via CLI flags and environment variables.
For a complete list of environment variables see:

```
terrashine --help
```

## Example

Here is an example of starting up terrashine using an S3 bucket named `terrashine-example-test-1111`, with credentials provided as environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
A TLS terminating reverse proxy hosted is on `example.com` in this setup.
Note that the `/mirror/v1/` path is required in the URL to allow the backend server to serve up redirects correctly.

```
AWS_REGION=eu-west-1 AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=xxx RUST_LOG=info ./terrashine --s3-bucket-name terrashine-example-test-1111 --http-redirect-url https://example.com/mirror/v1/
```

0 comments on commit bc1db55

Please sign in to comment.