You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: krakend/content.md
+25-18Lines changed: 25 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,15 @@ KrakenD is lightweight and straightforward as it only requires writing the confi
9
9
All features are designed to offer extraordinary performance and infinite scalability.
10
10
11
11
## How to use this image
12
+
12
13
KrakenD only needs a single configuration file to create an API Gateway, although you can have a complex setup reflecting your organization structure. The configuration file(s) can live anywhere in the container, but the default location is `/etc/krakend`.
13
14
14
15
To use the image, `COPY` your `krakend.json` file inside the container or mount it using a volume. The configuration is checked only once during the startup and never used again. Don't have a config file yet? Generate it with the [KrakenD Designer UI](https://designer.krakend.io).
15
16
16
17
⚠️ **NOTICE**: KrakenD does not use live reload when your configuration changes. Restart the container.
17
18
18
19
### Quick start
20
+
19
21
You can start an empty gateway with a health check with the following commands:
The following are several examples of running KrakenD. By default, the command `run` is executed, but you can pass
30
-
other commands and flags at the end of the run command.
31
+
32
+
The following are several examples of running KrakenD. By default, the command `run` is executed, but you can pass other commands and flags at the end of the run command.
31
33
32
34
The configuration files are taken from the current directory (`$PWD`). Therefore, all examples expect to find at least the file `krakend.json`.
33
35
34
-
#### Run with the debug enabled (flag `-d`):
36
+
#### Run with the debug enabled (flag `-d`):
37
+
35
38
This flag is **SAFE to use in production**. It's meant to enable KrakenD as a fake backend itself by enabling a [`/__debug` endpoint](https://www.krakend.io/docs/endpoints/debug-endpoint/)
36
39
37
40
```console
38
41
docker run -p 8080:8080 -v "${PWD}:/etc/krakend/" %%IMAGE%% run -d -c /etc/krakend/krakend.json
39
42
```
40
43
41
44
#### Checking the syntax of your configuration file
45
+
42
46
See the [check command](https://www.krakend.io/docs/commands/check/)
43
47
44
48
```console
45
49
docker run -it -v $PWD:/etc/krakend/ %%IMAGE%% check --config krakend.json
46
50
```
47
-
#### Show the help:
48
51
49
-
docker run -it %%IMAGE%% help
52
+
#### Show the help:
50
53
54
+
docker run -it %%IMAGE%% help
51
55
52
56
### Building your custom KrakenD image
53
57
@@ -85,22 +89,23 @@ RUN FC_ENABLE=1 \
85
89
FROM %%IMAGE%%:<version>
86
90
COPY --from=builder /tmp/krakend.json .
87
91
```
92
+
88
93
Then build with `docker build -t my_krakend .`
89
94
90
95
The configuration above assumes you have a folder structure like the following:
91
-
```
92
-
.
93
-
├── config
94
-
│ ├── partials
95
-
│ ├── settings
96
-
│ │ └── env.json
97
-
│ └── templates
98
-
│ └── some.tmpl
99
-
├── Dockerfile
100
-
└── krakend.tmpl
101
-
```
96
+
97
+
.
98
+
├── config
99
+
│ ├── partials
100
+
│ ├── settings
101
+
│ │ └── env.json
102
+
│ └── templates
103
+
│ └── some.tmpl
104
+
├── Dockerfile
105
+
└── krakend.tmpl
102
106
103
107
### Docker Compose example
108
+
104
109
Finally, a simple `docker-compose` file to start KrakenD with your API would be:
All `krakend` commands are executed as `krakend` user (uid=1000) through `su-exec`, and the rest of the commands (e.g., `sh`) are executed as root.
139
146
140
147
You can directly use sub-commands of `krakend` like `run`, `help`, `version`, `check`, `check-plugin` or `validate` as the entrypoint will add the `krakend` command automatically. For example, the following lines are equivalent:
0 commit comments