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
@@ -32,21 +33,42 @@ Kong's documentation can be found at [getkong.org/docs][kong-docs-url].
32
33
33
34
# How to use this image
34
35
35
-
First, Kong requires a running Cassandra cluster before it starts. You can either use the [mashape/cassandra](https://github.com/Mashape/docker-cassandra) image, provision a test instance on [kongdb.org](http://kongdb.org)or use a cluster of your own.
36
+
First, Kong requires a running Cassandra or PostgreSQL cluster before it starts. You can either use the official Cassandra/PostgreSQL containers, or use your own.
36
37
37
-
## 1. Link Kong to a Cassandra container
38
+
## 1. Link Kong to either a Cassandra or PostgreSQL container
38
39
39
-
Start a Cassandra container by doing so:
40
+
It's up to you to decide which datastore between Cassandra or PostgreSQL you want to use, since Kong supports both.
41
+
42
+
### Cassandra
43
+
44
+
Start a Cassandra container by executing:
40
45
41
46
```shell
42
-
$ docker run -d -p 9042:9042 --name cassandra cassandra:2.2.4
47
+
$ docker run -d --name kong-database \
48
+
-p 9042:9042 \
49
+
cassandra:2.2
43
50
```
44
51
45
-
Once Cassandra is running, we can start a Kong container and link it to the Cassandra container:
52
+
### Postgres
53
+
54
+
Start a PostgreSQL container by executing:
55
+
56
+
```shell
57
+
docker run -d --name kong-database \
58
+
-p 5432:5432 \
59
+
-e "POSTGRES_USER=kong" \
60
+
-e "POSTGRES_DB=kong" \
61
+
postgres:9.4
62
+
```
63
+
64
+
### Start Kong
65
+
66
+
Once the database is running, we can start a Kong container and link it to the database container, and configuring the `DATABASE` environment variable with either `cassandra` or `postgres` depending on which database you decided to use:
46
67
47
68
```shell
48
69
$ docker run -d --name kong \
49
-
--link cassandra:cassandra \
70
+
-e "DATABASE=cassandra"\ # or "DATABASE=postgres"
71
+
--link kong-database:kong-database \
50
72
-p 8000:8000 \
51
73
-p 8443:8443 \
52
74
-p 8001:8001 \
@@ -56,11 +78,13 @@ $ docker run -d --name kong \
56
78
mashape/kong
57
79
```
58
80
59
-
If everything went well, and if you created your container with the default ports, Kong should be listening on your host's `8000` ([proxy][kong-docs-proxy-port]) and `8001` ([admin api][kong-docs-admin-api-port]) ports.
81
+
**Note:** If Docker complains that `--security-opt` is an invalid option, just remove it and re-execute the command (it was introduced in Docker 1.3).
82
+
83
+
If everything went well, and if you created your container with the default ports, Kong should be listening on your host's `8000` ([proxy][kong-docs-proxy-port]), `8443` ([proxy SSL][kong-docs-proxy-ssl-port]) and `8001` ([admin api][kong-docs-admin-api-port]) ports. Port `7946` ([cluster][kong-docs-cluster-port]) is being used only by other Kong nodes.
60
84
61
85
You can now read the docs at [getkong.org/docs][kong-docs-url] to learn more about Kong.
62
86
63
-
## 2. Use Kong with a custom configuration (and Cassandra cluster)
87
+
## 2. Use Kong with a custom configuration (and a custom Cassandra/PostgreSQL cluster)
64
88
65
89
This container stores the [Kong configuration file](http://getkong.org/docs/latest/configuration/) in a [Data Volume][docker-data-volume]. You can store this file on your host (name it `kong.yml` and place it in a directory) and mount it as a volume by doing so:
66
90
@@ -77,7 +101,7 @@ $ docker run -d \
77
101
mashape/kong
78
102
```
79
103
80
-
When attached this way you can edit your configuration file from your host machine and restart your container. You can also make the container point to a different Cassandra instance, so no need to link it to a Cassandra container.
104
+
When attached this way you can edit your configuration file from your host machine and restart your container. You can also make the container point to a different Cassandra/PostgreSQL instance, so no need to link it to a Cassandra/PostgreSQL container.
81
105
82
106
## Reload Kong in a running container
83
107
@@ -104,7 +128,9 @@ Before you start to code, we recommend discussing your plans through a [GitHub i
0 commit comments