Quick Start
As mentioned in the previous section, some standard distributions are already provided and ready to be used. The quickest way to get started with those distributions is to use their container images, which is what we will use in this guide.
#
The ImagesAll of our images are hosted on GitHub registry. You can find a list of available images here.
#
Running DistributionsIn this example we will only run the standard-mongo distribution, which is a just a standard distribution with MongoDB drivers for persistence. To do so, for a development environment, we will need to create the following Docker Compose file
In this file we are basically just creating a MongoDB container called mongodb, and another container called my_authguard. For the AuthGuard container, we are mounting two local directories to make the server pick the configuration we have for the environment as well as JWT signing and encryption keys.
Generate key using AuthGuard CLI
The AuthGuard CLI (authg-cli) can generate the keys for you by just supplying the algorithm. It requires OpenSSL to be installed on your system.
Refer to the configuration documentation to build your own configuration. However, keep in mind that key paths must be set for the container (i.e. starting with /opt/authguard) and not for the host. For example, your JWT keys configuration should be like this
Once all of that is set up, just run docker-compose up
(or with -d
)
and you will have your test environment ready to go.
#
ProductionHow you deploy your container to a production environment is up to you. You can create a new image with the configuration and the keys. Or you can deploy the base image and mount directories like we did in the development environment example.
If you decided to package the configuration in a new image, consider reading some configuration values from environment variables. You can do so by adding "env:" followed by the name of the variable instead of supplying an actual value. For example