Docker container for DreamFactory 2.0.
The Docker image we provide does not include PHP drivers for MS SQL. If you need this functionality add the following to the 'apt-get install' line in the Dockerfile and build yourself a new image using the steps below.
php5-sybase php5-odbc freetds-common
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
4) Start the dreamfactorysoftware/df-docker container with linked MySQL server or with external MySQL server
If your database runs inside another container you can simply link it under the name db
.
docker run -d -p 127.0.0.1:80:80 --link df-mysql:db 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
If your database runs inside another container you can simply link it under the name db
.
docker run -d -p 127.0.0.1:80:80 --link df-mysql:db dreamfactory/v2
or
docker run -d -p 127.0.0.1:80:80 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.
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://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.