Unleash React - Running the Server

This post is part of a series on adding feature flagging to a React application using Unleash.

Unleash React - What is Feature Flagging?
Feature flags are a powerful tool in the developer’s toolbox. Instead of releasing code in large features and risky deployment operations, new features can be developing incrementally and turned on and off in production by toggling a flag, selecting certain users, or other similar strategies. This m…

In this post, we'll learn how to get Unleash server running in docker.

To use Unleash in your application, you must have an Unleash server running. Unleash provides hosted plans, but for this series we will be running it ourselves using the docker image. This post assumes you have a docker host available and have a working understanding of docker-compose.

Unleash uses PostgreSQL as its database. For this example, we will be running it in docker as well. The easiest way to run both together is to use docker-compose.

Save the yaml below into a file named docker-compose.yml then run docker-compose up. This will start two containers, one for PostgreSQL and one for the Unleash server. The Unleash server can reach the database on a virtualized network by using its service name db in the DATABASE_URL environment variable.

version: "3.4"
    image: postgres:10-alpine
      POSTGRES_DB: "db"
      - 5432
    image: unleashorg/unleash-server
      - "4242:4242"
      DATABASE_URL: "postgres://postgres:[email protected]/postgres"
      DATABASE_SSL: "false"
      - db

Once your docker-compose command completes, you will have an Unleash server running on port 4242 on your docker host. Navigate to http://[docker_host_ip]:4242 in your browser and you will see the Unleash server login page. Login with username admin and password unleash4all.

At this point you can play around with the features of Unleash server, but we will continue on to configuring Unleash Proxy.