You can use docker to set up an entire Flagsmith Feature Flag environment locally. Just clone the docker repository and run docker-compose:
git clone https://github.com/Flagsmith/self-hosted.git
Wait for the images to download and run, then visit
http://localhost:8000/. As a first step, you will need to create a
new account at http://localhost:8000/signup
As well as the Environment Variables specified in the API and Front End you can also specify the following:
GUNICORN_WORKERS: The number of Gunicorn Workers that are created
GUNICORN_THREADS: The number of Gunicorn Threads per Worker
GUNICORN_TIMEOUT: The number of seconds before the Gunicorn times out
ACCESS_LOG_LOCATION: The location to write access logs to
Our Docker images are built against the following CPU architectures:
The docker-compose file runs the following containers:
Front End Dashboard and REST API combined - Port 8000
The Web user interface allows you to create accounts and manage your flags. The front end is written in node.js and React.
The web user interface communicates via REST to the API that powers the application. The SDK clients also connect to this API. The API is written in Django and the Django REST Framework.
Once you have created an account and some flags, you can then start using the API with one of the Flagsmith Client SDKs. You will need to override the API endpoint for each SDK to point to http://localhost:8000/api/v1/.
You can access the Django Admin console to get CRUD access to some of the core tables within the API. You will need to create a super user account first with the following command:
# Make sure you are in the root directory of this repository
docker-compose run --rm --entrypoint "python manage.py createsuperuser" api
You can then access the admin dashboard at http://localhost:8000/admin/
The REST API stores all its data within a Postgres database. Schema changes will be carried out automatically when upgrading using Django Migrations.
Access Flagsmith Remotely
You will need to either open ports into your docker host or set up a reverse proxy to access the two Flagsmith services
(dashboard and API). You will also need to configure the dashboard environment variable
API_URL, which tells the
dashboard where the REST API is located.