minor:add improvements to external s3 guide

This commit is contained in:
mngshm
2024-12-13 16:58:20 +05:30
parent e3d3f3b1f4
commit 4150e607eb
2 changed files with 34 additions and 17 deletions

View File

@@ -258,7 +258,7 @@ export const sidebar = [
link: "/self-hosting/guides/configuring-s3",
},
{
text: "Using external S3",
text: "Hosting Ente with external S3 (Community)",
link: "/self-hosting/guides/external-s3",
},
{

View File

@@ -7,6 +7,14 @@ description:
# Hosting server and web app using external S3
> [!NOTE]
>
> This is a community contributed guide, and some of these steps might be out of
> sync with the upstream documentation. If something is not working correctly,
> please also see the latest
> [READMEs](https://github.com/ente-io/ente/blob/main/server/README.md) in the
> repository and/or other guides in [self-hosting](/self-hosting/).
This guide is for self hosting the server and the web application of Ente Photos
using docker compose and an external S3 bucket. So we assume that you already
have the keys and secrets for the S3 bucket. The plan is as follows:
@@ -17,14 +25,6 @@ have the keys and secrets for the S3 bucket. The plan is as follows:
4. Create an account and increase storage quota
5. Fix potential CORS issue with your bucket
> [!NOTE]
>
> This is a community contributed guide, and some of these steps might be out of
> sync with the upstream documentation. If something is not working correctly,
> please also see the latest
> [READMEs](https://github.com/ente-io/ente/blob/main/server/README.md) in the
> repository and/or other guides in [self-hosting](/self-hosting/).
## 1. Create a `compose.yaml` file
After cloning the main repository with
@@ -40,7 +40,6 @@ Create a `compose.yaml` file at the root of the project with the following
content (there is nothing to change here):
```yaml
version: "3"
services:
museum:
build:
@@ -236,9 +235,10 @@ background).
## 4. Create an account and increase storage quota
Open `http://localhost:8081` (or the url of your server) in your browser and
create an account. Choose 123456 as the value for the one-time token if your
email has the correct domain as defined in the `.credentials.env` file.
Open `http://localhost:8080` or whatever Endpoint you mentioned for the web app and create an account.
If your SMTP related configurations are all set and right, you will receive an email with
your OTT in it. There are two work arounds to retrieve the OTP,
checkout [this document](https://help.ente.io/self-hosting/faq/otp) for getting your OTT's..
If you successfully log in, select any plan and increase the storage quota with
the following command:
@@ -251,6 +251,9 @@ After few reloads, you should see 1 To of quota.
## 5. Fix potential CORS issue with your bucket
### For AWS S3
If you cannot upload a photo due to a CORS issue, you need to fix the CORS
configuration of your bucket.
@@ -272,14 +275,28 @@ Create a `cors.json` file with the following content:
You may want to change the `AllowedOrigins` to a more restrictive value.
Then run the following command with the aws command to update the CORS
configuration of your bucket:
If you are using AWS for S3, you can execute the below command to get rid of CORS. Make sure to enter the right path for the `cors.json` file.
```bash
aws s3api put-bucket-cors --bucket YOUR_S3_BUCKET --cors-configuration file://cors.json
aws s3api put-bucket-cors --bucket YOUR_S3_BUCKET --cors-configuration /path/to/cors.json
```
Upload should now work.
### For Self-hosted Minio Instance
> Important: MinIO does not take JSON CORS file as the input, instead you will have to build a CORS.xml file or just convert the above `cors.json` to XML.
A minor requirement here is the tool `mc` for managing buckets via command line interface. Checkout the `mc set alias` document to configure alias for your instance and bucket.
After this you will be prompted for your AccessKey and Secret, which is your username and password, go ahead and enter that.
```sh
mc cors set <your-minio>/<your-bucket-name /path/to/cors.xml
```
or, if you just want to just set the `AllowedOrigins` Header, you can use the following command to do so.
```sh
mc admin config set <your-minio>/<your-bucket-name> set "cors_allowed_origin=*"
```
You can create also `.csv` file and dump the list of origins you would like to allow and replace the `*` with `path` to the CSV file.
Now, uploads should be working fine.
## Related