Skip to content

Commit

Permalink
docs: update gateway-mt docs on testing
Browse files Browse the repository at this point in the history
docker-local no longer exists, and we don't need to repeat the
integration step docs, but rather link to development docs.

Change-Id: Ib049a673c6880685936e87053f8e38b6a1eb11d0
  • Loading branch information
halkyon authored and Storj Robot committed Aug 3, 2022
1 parent 3ee6a42 commit b81d134
Showing 1 changed file with 3 additions and 102 deletions.
105 changes: 3 additions & 102 deletions docs/gateway-mt.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ aws s3 ls --endpoint https://gateway.local:20011 --no-verify-ssl --debug
The request should succeed and the debug output should contain lines like
`MainThread - botocore.utils - DEBUG - Using S3 virtual host style addressing.`

# S3 API Compatibility using Docker
# S3 API Compatibility

We support all essential API actions, like

Expand Down Expand Up @@ -169,107 +169,8 @@ as well as (Get/Put/Delete)ObjectTagging actions.
For more details on gateway's S3 compatibility, please refer to [Compatibility
Table](https://github.com/storj/gateway-st/blob/main/docs/s3-compatibility.md).

We run a fork of the minio/mint repository at [storj/gateway-mint](https://github.com/storj/gateway-mint/)
used to test correctness of the gateway.

To run the tests:

```
docker run --rm \
-e SERVER_ENDPOINT=endpoint_address \
-e ACCESS_KEY=myaccesskey \
-e SECRET_KEY=mysecretkey \
-e ENABLE_HTTPS=0 \
storjlabs/gateway-mint
```

# Using docker-compose for local development

For convenience in local testing, a docker-compose file can be found in
`docker-local/docker-compose.yml`. This section explains how to use this
properly for local testing.

## Set environment variables

The compose script requires two environment variables to run correctly:

- `STORJ_SRC_DIR`: This is the path to your storj.io/storj source code.
- `GATEWAY_SRC_DIR`: This is the path to your storj.io/gateway-mt source code.

Example:

`STORJ_SRC_DIR=$HOME/storj.io/storj GATEWAY_SRC_DIR=$HOME/storj.io/gateway-mt docker-compose up`

This is only an example, the correct paths for your machine must be provided.

## Start the docker containers

Navigate to the `docker-local` folder and run `docker-compose up`.

The first time it runs it will pull docker containers and build all the source
code and pull external go modules. This will all be cached.

When the processes finishes, the `gateway-mt` container will output the
following (an example):

```
gateway-mt_1 | ===================================================================
gateway-mt_1 | Access 1NfEEWDxPUob3Qib9EhjP4rdCw4GnnwT81aNwV2txywscPHDpBsTmT6VjrhLGBmJjULdNZA8TnvYC5vSYvxgSfDW2h5P9D9cow6gmHoqaNeGT5DcWH7L9FinpBgjM3S1cinHSQwufsRLzFtYd3CohW4QDohcASreWqPB8HxwAi5M1UQMPUgSftXZzGKPCkvRDjkCkySyfR93gkfxqStn873ScKnYwvXSXjjk9KiFSZ2KbAf1do1a3sJsT
gateway-mt_1 | ===================================================================
gateway-mt_1 | ========== CREDENTIALS ===================================================================
gateway-mt_1 | Access Key ID: jxjlhpevlqi6wg5y4lqj3kg5gu3a
gateway-mt_1 | Secret Key : jzzqymrvhwxos7hfynucwnr4sn2zphxfxyq52k7guicuarmhc5gta
gateway-mt_1 | Endpoint : http://localhost:20010
gateway-mt_1 | ===================================================================
```

The access is the access for storj-sim, in case you want to use it for something
else. (See NOTE below.)

The gateway-mt registers this access with the authservice for you, and the
access key and secret key are printed out also.

You now should be able to connect to the gateway-mt at `http://localhost:20010`
using those credentials.

NOTE: The satellite address embedded in the access is strange: something like
`1RztXfxeGrQMku8SRfFeLbVwdqq1XbMm59Gjapck3SCmfXB6WR@storjsim:10000`. This
`storjsim` address is due to docker's internal networking. If you need to use
this access locally, you need to make your computer resolve `storjsim` to
`localhost`.

## Development workflow

After it is running, if you make code changes and wish to test them, simply do
the following:

- Stop the containers with `docker-compose down`
- Start the containers again with `docker-compose up`

This will build the code again, but should only build code that has changed, and
will provide you with new credentials.

# Gateway MT + storj-sim + Minio Mint test workflow
Gateway MT is designed to becompatible with the Minio Mint's Docker-based test suite. If you'd like to use storj-sim to test local changes to Mint, run these commands:

```
storj-sim network setup
storj-sim network run
```

```
authservice run --auth-token "super-secret" --allowed-satellites="$(storj-sim network env SATELLITE_0_ID)@" --endpoint=http://localhost:20010 --kv-backend="memory://"
```

```
gateway-mt run --auth.token="super-secret" --auth.base-url=http://localhost:20000 --domain-name=localhost
```

```
export $(uplink access register $(storj-sim network env GATEWAY_0_ACCESS) --auth-service http://localhost:20000 --format env)
docker run -e SERVER_ENDPOINT=host.docker.internal:20010 -e ACCESS_KEY=$AWS_ACCESS_KEY_ID -e SECRET_KEY=$AWS_SECRET_ACCESS_KEY -e ENABLE_HTTPS=0 storjlabs/gateway-mint
```
Note that Linux users may need alter the above commmand to `SERVER_ENDPOINT=localhost:20010` to use or the `--add-host=host.docker.internal:host-gateway` flag.
See the [testing section of the developing documentation](../DEVELOPING.md#testing)
for how to run integration tests to verify correctness.

# License

Expand Down

0 comments on commit b81d134

Please sign in to comment.