Docker container for DreamFactory 2.2.x
- See this table
cd ~/repos
(or wherever you want the clone of the repo to be)
git clone https://github.com/dreamfactorysoftware/df-docker.git
cd df-docker
docker pull dreamfactorysoftware/df-docker
docker run -d --name df-mysql -e "MYSQL_ROOT_PASSWORD=root" -e "MYSQL_DATABASE=dreamfactory" -e "MYSQL_USER=df_admin" -e "MYSQL_PASSWORD=df_admin" mysql
docker run -d --name df-redis redis
If your database and redis runs inside another container you can simply link it under the name db
and rd
respectively.
docker run -d --name df-web -p 127.0.0.1:80:80 -e "DB_HOST=db" -e "DB_USERNAME=df_admin" -e "DB_PASSWORD=df_admin" -e "DB_DATABASE=dreamfactory" -e "REDIS_HOST=rd" -e "REDIS_DATABASE=0" -e "REDIS_PORT=6379" --link df-mysql:db --link df-redis:rd dreamfactorysoftware/df-docker
127.0.0.1 dreamfactory.app
Go to 127.0.0.1 in your browser. It will take some time the first time. You will be asked to create your first admin user.
The easiest way to configure the DreamFactory application is to use docker-compose.
cd ~/repos
(or wherever you want the clone of the repo to be)
git clone https://github.com/dreamfactorysoftware/df-docker.git
cd df-docker
docker-compose build
docker-compose up -d
127.0.0.1 dreamfactory.app
Go to 127.0.0.1 in your browser. It will take some time the first time. You will be asked to create your first admin user.
If you don't want to use docker-compose you can build the images yourself.
cd ~/repos
(or wherever you want the clone of the repo to be)
git clone https://github.com/dreamfactorysoftware/df-docker.git
cd df-docker
docker build -t dreamfactory/v2 .
docker run -d --name df-mysql -e "MYSQL_ROOT_PASSWORD=root" -e "MYSQL_DATABASE=dreamfactory" -e "MYSQL_USER=df_admin" -e "MYSQL_PASSWORD=df_admin" mysql
docker run -d --name df-redis redis
If your database and redis runs inside another container you can simply link it under the name db
and rd
respectively.
docker run -d --name df-web -p 127.0.0.1:80:80 -e "DB_HOST=db" -e "DB_USERNAME=df_admin" -e "DB_PASSWORD=df_admin" -e "DB_DATABASE=dreamfactory" -e "REDIS_HOST=rd" -e "REDIS_DATABASE=0" -e "REDIS_PORT=6379" --link df-mysql:db --link df-redis:rd dreamfactory/v2
127.0.0.1 dreamfactory.app
Go to 127.0.0.1 in your browser. It will take some time the first time. You will be asked to create your first admin user.
- You may have to use
sudo
for Docker commands depending on your setup. - By default, the container only sends apache error logs to STDOUT. If you also want to have dreamfactory.log, e.g. for forwarding via docker logging driver
you can set environment variable
LOG_TO_STDOUT=true
IBM Bluemix has a complete set of instructions available at https://console.ng.bluemix.net/docs/containers/container_cli_ov.html#container_cli_cfic
cf login
cf ic login
cd ~/repos
(or wherever you want the clone of the repo to be)
git clone https://github.com/dreamfactorysoftware/df-docker.git
cd df-docker
In the Dockerfile, you will find comments indicating which lines need to be commented out and which ones need to be commented.
cf ic build -t dreamfactory/v2 .
Once the image has been built, the cf ic
command will push the image to your private container repository on Bluemix.
5) On the container configuration page, give your container a name, such as 'DF2', select a size (2GB Memory minimum recommended)
6) Select an already existing Public IP address or choose the 'Request and Bind Public IP' option from the dropdown
-
Based on extensive testing, it has been found that on Bluemix, the container works best using the Redis Cloud and ElephantSQL services. For the Redis Cloud service, select the 30MB or higher plan, and for Elephant SQL, select 'Pretty Panda' or higher. The 'Tiny Turtle' service plan is not sufficient.
-
Extensive testing has shown that the free ClearDB MySQL Database service is not sufficient to run DreamFactory 2.0.
-
The MySQL or Postgres service must support a minimum of 10 concurrent connections for the proper operation of DreamFactory 2.0.
-
At this time, the PostgreSQL by Composer and Redis by Compose can not be bound to a container. This is an issue with Bluemix.
-
At this time, a
user-provided
external service can not be bound to a container at this time. This is an issue with Bluemix. -
If you use a service other than ElephantSQL, when starting the image, in step 7, you will have to add the environment variable
BM_DB_SERVICE_KEY
and set it to the value present in the VCAP_SERVICES environment variable provided to the container. Unfortunately, the only practical way to find this out is to create the container, bind the services and then open a shell on the container once it's running. To do this, get the CONTAINER ID by runningcf ic ps
and then runcf ic exec -it "CONTAINERID" bash
, replacing CONTAINERID with the CONTAINER ID gotten from thecf ic ps
command. Once you are at a command prompt, runecho $VCAP_SERVICES
which will display something like{"rediscloud": [{"name": "df2-redis", "entity": {"service_instance_url": "https://api.ng.bluemix.net/v2/service_instances/3811bc12-d42c-4a4a-9255-d5c1d42b4849"}, "plan": "30mb", "credentials": {"password": "mINogWGFMpTJC9g0", "hostname": "pub-redis-13942.dal-05.1.sl.garantiadata.com", "port": "13942"}, "label": "rediscloud", "metadata": {"url": "https://api.ng.bluemix.net/v2/service_keys/b323438b-470e-4c7b-a877-a33268c27072"}}], "elephantsql": [{"name": "df2-db", "entity": {"service_instance_url": "https://api.ng.bluemix.net/v2/service_instances/677f57e1-a637-4022-8b50-730f4372091b"}, "plan": "panda", "credentials": {"uri": "postgres:https://mcfmjlcl:[email protected]:5432/mcfmjlcl", "max_conns": "20"}, "label": "elephantsql", "metadata": {"url": "https://api.ng.bluemix.net/v2/service_keys/985b6785-9cbd-4f6c-bdb8-21e56d1e9d5f"}}]}
In this particular example, the service keys are
rediscloud
andelephantsql
which are the defaults. -
If you use a service other than Redis Cloud, when starting the image, in step 7, you will have to add the environment variable
BM_REDIS_SERVICE_KEY
and set it to the value present in VCAP_SERVICES environment variable provided to the container. See the previous entry on how to view the values in VCAP SERVICES.
Option | Description | required? | default |
---|---|---|---|
SERVERNAME | Domain for DF | no | dreamfactory.app |
DB_HOST | Database Host | no | localhost |
DB_USERNAME | Database User | no | df_admin |
DB_PASSWORD | Database Password | no | df_admin |
DB_DATABASE | Database Name | no | dreamfactory |
REDIS_HOST | Redis Cache Host | no | uses file caching |
REDIS_DATABASE | Redis DB | only if REDIS_HOST set | |
REDIS_PORT | Redis Port | no | 6379 |
REDIS_PASSWORD | Redis Password | no | none used |
APP_KEY | Application Key | yes for immutability | generates a key |
JWT_TTL | Login Token TTL | no | 60 |
JWT_REFRESH_TTL | Login Token Refresh TTL | no | 20160 |
ALLOW_FOREVER_SESSIONS | Allow refresh forever | no | false |
LOG_TO_STDOUT | Forward log to STDOUT | no | not forwarded |
SSMTP_mailhub | MX for mailing | yes if DF should mail | no mailing capabilities |
SSMTP_XXXX | prefix options with SSMTP_ | no | see the man page |