Skip to content

Update the README #1420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 17 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,40 +83,25 @@ If you need to store big files in the repository's directory it's recommended to
put them in the `ignored/` subdirectory, which is ignored both by git and
Docker.

### Pure docker-compose

If you have trouble with the above commands, consider using `docker-compose up`,
which uses docker-compose for the web server as well.
This will not cache dependencies as well - in particular, you'll have to rebuild all 400 whenever the lockfile changes -
but makes sure that you're in a known environment so you should have fewer problems getting started.

Please file bugs for any trouble you have running docs.rs!
Running the database and S3 server outside of docker-compose is possible, but not recommended or supported.
Note that you will need docker installed no matter what, since it's used for Rustwide sandboxing.

### Running tests

Tests are only supported via cargo and do not work in docker-compose

```
cargo test
```

Most tests require access to the database. To run them, set the
`CRATESFYI_DATABASE_URL` in `.env` to the url of a PostgreSQL database,
and set the `AWS_ACCESS_KEY_ID`, `S3_ENDPOINT`, and `AWS_SECRET_ACCESS_KEY` variables.
We have some reasonable default parameters in `.env.sample`.

For example, if you are using the `docker-compose` environment to run tests against, you can launch only the database and s3 server like so:
### Pure docker-compose

```console
docker-compose up -d db s3
```
If you have trouble with the above commands, consider using `docker-compose up --build`,
which uses docker-compose for the web server as well.
This will not cache dependencies - in particular, you'll have to rebuild all 400 whenever the lockfile changes -
but makes sure that you're in a known environment so you should have fewer problems getting started.

If you don't want to use docker-compose, see the
[wiki page on developing outside docker-compose][wiki-no-compose]
for more information on how to setup this environment.
Note that either way, you will need docker installed for sandboxing with Rustwide.
Note that running tests is not supported when using pure docker-compose.

[wiki-no-compose]: https://forge.rust-lang.org/docs-rs/no-docker-compose.html
Please file bugs for any trouble you have running docs.rs!

### Docker-Compose

Expand All @@ -127,7 +112,7 @@ Three services are defined:
|------|-------------------------------------------------|----------------------------|----------------------------------------|
| web | http://localhost:3000 | N/A | A container running the docs.rs binary |
| db | postgresql://cratesfyi:password@localhost:15432 | - | Postgres database used by web |
| s3 | http://localhost:9000 | `cratesfyi` - `secret_key` | Minio (simulates AWS S3) used by web |
| s3 | http://localhost:9000 | `cratesfyi` - `secret_key` | MinIO (simulates AWS S3) used by web |

[docker-compose.yml]: ./docker-compose.yml

Expand All @@ -145,13 +130,19 @@ $ docker-compose down --volumes

#### FAQ

##### I keep getting the error `standard_init_linux.go:211: exec user process caused "no such file or directory"` when I use docker-compose.
##### I see the error `standard_init_linux.go:211: exec user process caused "no such file or directory"` when I use docker-compose.

You probably have [CRLF line endings](https://en.wikipedia.org/wiki/CRLF).
This causes the hashbang in the docker-entrypoint to be `/bin/sh\r` instead of `/bin/sh`.
This is probably because you have `git.autocrlf` set to true,
[set it to `input`](https://stackoverflow.com/questions/10418975) instead.

##### I see the error `/opt/rustwide/cargo-home/bin/cargo: cannot execute binary file: Exec format error` when running builds.

You are most likely not on a Linux platform. Currently, running builds is only supported on `x86_64-unknown-linux-gnu`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add what running builds is possible through the web container :)

( I'm happy to add it myself after this)


See [rustwide#41](https://github.com/rust-lang/rustwide/issues/41) for more details.

### CLI

See `cargo run -- --help` for a full list of commands.
Expand Down