Skip to content

Commit ce3097f

Browse files
committed
Bump version
1 parent 0882748 commit ce3097f

31 files changed

+4701
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description: Learn about imgproxy's processing pipeline
3+
---
4+
5+
# About the processing pipeline
6+
7+
imgproxy has a specific processing pipeline tuned for maximum performance. When you process an image with imgproxy, it does the following:
8+
9+
* If the source image format allows shrink-on-load, imgproxy uses it to quickly resize the image to the size that is closest to desired.
10+
* If it is needed to resize an image with an alpha-channel, imgproxy premultiplies one to handle alpha correctly.
11+
* imgproxy resizes the image to the desired size.
12+
* If the image colorspace need to be fixed, imgproxy fixes it.
13+
* imgproxy rotates/flip the image according to EXIF metadata.
14+
* imgproxy crops the image using the specified gravity.
15+
* imgproxy fills the image background if the background color was specified.
16+
* imgproxy applies filters.
17+
* imgproxy adds a watermark if one was specified.
18+
* And finally, imgproxy saves the image to the desired format.
19+
20+
This pipeline, using sequential access to source image data, allows for significantly reduced memory and CPU usage — one of the reasons imgproxy is so performant.
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
description: Learn about how you can load environment variables from various sources with imgproxy
3+
---
4+
5+
# Loading environment variables
6+
7+
imgproxy can load environment variables from various sources such as:
8+
9+
* [Local file](#local-file)
10+
* [AWS Secrets Manager](#aws-secrets-manager)
11+
* [AWS Systems Manager Parameter Store](#aws-systems-manager-parameter-store)
12+
* [Google Cloud Secret Manager](#google-cloud-secret-manager)
13+
14+
## Local file
15+
16+
You can create an [environment file](#environment-file-syntax) and configure imgproxy to read environment variables from it.
17+
18+
* `IMGPROXY_ENV_LOCAL_FILE_PATH`: the path of the environment file to load
19+
20+
## AWS Secrets Manager
21+
22+
You can store the content of an [environment file](#environment-file-syntax) as an AWS Secrets Manager secret and configure imgproxy to read environment variables from it.
23+
24+
* `IMGPROXY_ENV_AWS_SECRET_ID`: the ARN or name of the secret to load
25+
* `IMGPROXY_ENV_AWS_SECRET_VERSION_ID`: _(optional)_ the unique identifier of the version of the secret to load
26+
* `IMGPROXY_ENV_AWS_SECRET_VERSION_STAGE`: _(optional)_ the staging label of the version of the secret to load
27+
* `IMGPROXY_ENV_AWS_SECRET_REGION`: _(optional)_ the region of the secret to load
28+
29+
:::info
30+
If both `IMGPROXY_ENV_AWS_SECRET_VERSION_ID` and `IMGPROXY_ENV_AWS_SECRET_VERSION_STAGE` are set, `IMGPROXY_ENV_AWS_SECRET_VERSION_STAGE` will be ignored
31+
:::
32+
33+
### Set up AWS Secrets Manager credentials
34+
35+
There are three ways to specify your AWS credentials. The credentials policy should allow performing the `secretsmanager:GetSecretValue` and `secretsmanager:ListSecretVersionIds` actions with the specified secret:
36+
37+
#### IAM Roles
38+
39+
If you're running imgproxy on an Amazon Web Services platform, you can use IAM roles to to get the security credentials to retrieve the secret.
40+
41+
* **Elastic Container Service (ECS):** Assign an [IAM role to a task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html).
42+
* **Elastic Kubernetes Service (EKS):** Assign a [service account to a pod](https://docs.aws.amazon.com/eks/latest/userguide/pod-configuration.html).
43+
* **Elastic Beanstalk:** Assign an [IAM role to an instance](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html).
44+
45+
#### Environment variables
46+
47+
You can specify an AWS Access Key ID and a Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
48+
49+
``` bash
50+
AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
51+
52+
# same for Docker
53+
docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it ghcr.io/imgproxy/imgproxy
54+
```
55+
56+
#### Shared credentials file
57+
58+
Alternatively, you can create the `.aws/credentials` file in your home directory with the following content:
59+
60+
```ini
61+
[default]
62+
aws_access_key_id = %access_key_id
63+
aws_secret_access_key = %secret_access_key
64+
```
65+
66+
## AWS Systems Manager Parameter Store
67+
68+
You can store multiple AWS Systems Manager Parameter Store entries and configure imgproxy to load their values to separate environment variables.
69+
70+
* `IMGPROXY_ENV_AWS_SSM_PARAMETERS_PATH`: the [path](#aws-systems-manager-path) of the parameters to load
71+
* `IMGPROXY_ENV_AWS_SSM_PARAMETERS_REGION`: _(optional)_ the region of the parameters to load
72+
73+
### AWS Systems Manager path
74+
75+
Let's assume that you created the following AWS Systems Manager parameters:
76+
77+
* `/imgproxy/prod/IMGPROXY_KEY`
78+
* `/imgproxy/prod/IMGPROXY_SALT`
79+
* `/imgproxy/prod/IMGPROXY_CLOUD_WATCH/SERVICE_NAME`
80+
* `/imgproxy/prod/IMGPROXY_CLOUD_WATCH/NAMESPACE`
81+
* `/imgproxy/staging/IMGPROXY_KEY`
82+
83+
If you set `IMGPROXY_ENV_AWS_SSM_PARAMETERS_PATH` to `/imgproxy/prod`, imgproxy will load these parameters the following way:
84+
85+
* `/imgproxy/prod/IMGPROXY_KEY` value will be loaded to `IMGPROXY_KEY`
86+
* `/imgproxy/prod/IMGPROXY_SALT` value will be loaded to `IMGPROXY_SALT`
87+
* `/imgproxy/prod/IMGPROXY_CLOUD_WATCH/SERVICE_NAME` value will be loaded to `IMGPROXY_CLOUD_WATCH_SERVICE_NAME`
88+
* `/imgproxy/prod/IMGPROXY_CLOUD_WATCH/NAMESPACE` value will be loaded to `IMGPROXY_CLOUD_WATCH_NAMESPACE`
89+
* `/imgproxy/staging/IMGPROXY_KEY` will be ignored since its path is not `/imgproxy/prod`
90+
91+
### Set up AWS Systems Manager credentials
92+
93+
There are three ways to specify your AWS credentials. The credentials policy should allow performing the `ssm:GetParametersByPath` action with the specified parameters:
94+
95+
#### IAM Roles
96+
97+
If you're running imgproxy on an Amazon Web Services platform, you can use IAM roles to to get the security credentials to retrieve the secret.
98+
99+
* **Elastic Container Service (ECS):** Assign an [IAM role to a task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html).
100+
* **Elastic Kubernetes Service (EKS):** Assign a [service account to a pod](https://docs.aws.amazon.com/eks/latest/userguide/pod-configuration.html).
101+
* **Elastic Beanstalk:** Assign an [IAM role to an instance](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html).
102+
103+
#### Environment variables
104+
105+
You can specify an AWS Access Key ID and a Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
106+
107+
``` bash
108+
AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
109+
110+
# same for Docker
111+
docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it ghcr.io/imgproxy/imgproxy
112+
```
113+
114+
#### Shared credentials file
115+
116+
Alternatively, you can create the `.aws/credentials` file in your home directory with the following content:
117+
118+
```ini
119+
[default]
120+
aws_access_key_id = %access_key_id
121+
aws_secret_access_key = %secret_access_key
122+
```
123+
124+
## Google Cloud Secret Manager
125+
126+
You can store the content of an [environment file](#environment-file-syntax) in Google Cloud Secret Manager secret and configure imgproxy to read environment variables from it.
127+
128+
* `IMGPROXY_ENV_GCP_SECRET_ID`: the name of the secret to load
129+
* `IMGPROXY_ENV_GCP_SECRET_VERSION_ID`: _(optional)_ the unique identifier of the version of the secret to load
130+
* `IMGPROXY_ENV_GCP_SECRET_PROJECT_ID`: the name or ID of the Google Cloud project that contains the secret
131+
132+
### Setup credentials
133+
134+
If you run imgproxy inside Google Cloud infrastructure (Compute Engine, Kubernetes Engine, App Engine, Cloud Functions, etc), and you have granted access to the specified secret to the service account, you probably don't need to do anything here. imgproxy will try to use the credentials provided by Google.
135+
136+
Otherwise, set `IMGPROXY_ENV_GCP_KEY` environment variable to the content of Google Cloud JSON key. Get more info about JSON keys: [https://cloud.google.com/iam/docs/creating-managing-service-account-keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys).
137+
138+
## Environment file syntax
139+
140+
The following syntax rules apply to environment files:
141+
142+
* Blank lines are ignored
143+
* Lines beginning with `#` are processed as comments and ignored
144+
* Each line represents a key-value pair. Values can optionally be quoted:
145+
* `VAR=VAL` -> `VAL`
146+
* `VAR="VAL"` -> `VAL`
147+
* `VAR='VAL'` -> `VAL`
148+
* Unquoted and double-quoted (`"`) values have variable substitution applied:
149+
* `VAR=${OTHER_VAR}` -> value of `OTHER_VAR`
150+
* `VAR=$OTHER_VAR` -> value of `OTHER_VAR`
151+
* `VAR="$OTHER_VAR"` -> value of `OTHER_VAR`
152+
* `VAR="${OTHER_VAR}"` -> value of `OTHER_VAR`
153+
* Single-quoted (`'`) values are used literally:
154+
* `VAR='$OTHER_VAR'` -> `$OTHER_VAR`
155+
* `VAR='${OTHER_VAR}'` -> `${OTHER_VAR}`
156+
* Double quotes in double-quoted (`"`) values can be escaped with `\`:
157+
* `VAR="{\"hello\": \"json\"}"` -> `{"hello": "json"}`
158+
* Slash (`\`) in double-quoted values can be escaped with another slash:
159+
* `VAR="some\\value"` -> `some\value`
160+
* A new line can be added to double-quoted values using `\n`:
161+
* `VAR="some\nvalue"` ->
162+
163+
```
164+
some
165+
value
166+
```
167+

0 commit comments

Comments
 (0)