Skip to content

Commit

Permalink
Merge pull request #9 from Isawan/prepare-for-announcement
Browse files Browse the repository at this point in the history
Prepare for announcement
  • Loading branch information
Isawan authored Aug 6, 2023
2 parents fbe57f1 + 0b43807 commit 7445345
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 20 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/isawan/terrashine/rust.yml)

A terraform provider mirror implemented as a caching proxy.
Terrashine is a terraform provider mirror implementation that works by automatically caching dependencies as providers are requested.

> **Warning**
> This is still in early development
> Database schema migrations are not yet stable across versions
Use cases:

## Installation
* Avoid rate-limits when actively developing (github has a 60 request per hour rate limit)
* Faster downloads of terraform providers, particularly in CI environments.
* Ensuring that terraform providers don't disappear if the source has been deleted.

## Usage
## Documentation

## Support
Terrashine is a compiled to a standalone binary making deployments easy.
Documentation for usage, deployment and administration can be found [here](https://isawan.github.io/terrashine/).

Raise any bugs or feature requests as tickets
## Support

## Roadmap
Raise any bugs or feature requests as tickets.

## Contributing

Open to contributions!
This is quite a new project so I'm very open to contributions!

## Authors and acknowledgment

Expand Down
2 changes: 1 addition & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Summary

- [Introduction](./introduction.md)
- [External Caching](./external-caching.md)
- [Reverse proxy](./reverse-proxy.md)
- [Mirror refreshing](./mirror-refreshing.md)
- [Private Registry Authentication](./private-registry-authentication.md)
6 changes: 0 additions & 6 deletions docs/src/external-caching.md

This file was deleted.

3 changes: 2 additions & 1 deletion docs/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ The following components are required to run terrashine

* PostgreSQL
* S3-compatible object storage
* TLS terminating reverse proxy (NGINX, HAProxy etc..)

## Notes

[^1]: Terrashine implements [Provider Network Mirror Protocol](https://developer.hashicorp.com/terraform/internals/provider-network-mirror-protocol)
[^1]: Terrashine implements the [Provider Network Mirror Protocol](https://developer.hashicorp.com/terraform/internals/provider-network-mirror-protocol)
2 changes: 1 addition & 1 deletion docs/src/private-registry-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To authenticate against private registries, the auth token can be inserted into the `terraform_registry_host` postgres table.

```
``` sql
insert into "terraform_registry_host" ("hostname", "auth_token")
values ("example-private-registry.com", "xxxxxx")
```
Expand Down
55 changes: 55 additions & 0 deletions docs/src/reverse-proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Reverse proxy

The Terraform mirror [Provider Network Mirror Protocol](https://developer.hashicorp.com/terraform/internals/provider-network-mirror-protocol) requires that the API request be performed over encrypted HTTPS.
Terrashine itself does not currently perform TLS termination, a reverse proxy must always be deployed to perform this function for a working setup.

## External Caching

Caching is optional however, terrashine sets `Cache-Control` headers where possible to allow caching by external reverse proxies.
If caching is required, this should be achieved by configuring the reverse proxy to cache responses as appropriate.
Cache headers are sometimes not set in cases where caching may incorrect behavior by the terraform client.
For example: headers are not set in scenarios where caching could result in subsequent requests from the same client seeing inconsistent views of the available packages, resulting in an error when downloading packages.

## Example NGINX configuration

Here is an example NGINX configuration that provides TLS termination and caching enabled
for a locally deployed terrashine instance.

``` nginx
user nginx;
worker_processes auto;
error_log /dev/stdout notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
sendfile on;
keepalive_timeout 65;
proxy_cache_path /tmp keys_zone=mycache:10m;
server {
listen 443 ssl;
server_name localhost;
proxy_cache mycache;
ssl_certificate localhost.pem;
ssl_certificate_key localhost.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
# terrashine
proxy_pass http://localhost:9543;
}
}
}
```
5 changes: 4 additions & 1 deletion integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ fn test_end_to_end_terraform_flow(_: PoolOptions<Postgres>, db_options: PgConnec
let process = terraform
.arg(format!("-chdir={temp_folder}"))
.arg("init")
.env("TF_CLI_CONFIG_FILE", "{temp_folder}/terraform.tfrc")
.env(
"TF_CLI_CONFIG_FILE",
format!("{temp_folder}/terraform.tfrc"),
)
.kill_on_drop(true)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
Expand Down
23 changes: 22 additions & 1 deletion resources/test/terraform/random-import-stack/.terraform.lock.hcl

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

0 comments on commit 7445345

Please sign in to comment.