Docker it up!
Move your FarCry application into a Docker based environment, by creating an environment project.
TLDR;
- Start with a completely blank git repo
- Copy base templates
- Update all submodules
- configure nginx
- start up environment
- configure lucee app server
- commit relevant changes
Create a Git repo in the format CLIENT-env-PROJECT
where:
- CLIENT is the 3-5 letter short code for a client, and;
- PROJECT is the name of the application or project
Set an origin for the repo at Bitbucket or Github.
Look up a recent "best practice" project and copy across the static templates as the basis for the project.
For example, copy the following files from gpml-env-prime
or chelsea-docker
:
- Vagrantfile
- Dockerfile
- ./config -- everything, except ./ssh and ./sql
- ./logs -- just the empty directories with .gitignore
- ./code/README.md
- ./code/plugins/README.md
- ./code/projects/README.md
Under the ./code
directory create the following git submodules:
- ./code/core for farcrycore/core
- ./code/plugins/pluginname for each plugin used by the project
- ./code/projects/projectname for the app project itself
TLDR;
- configure nginx server web root
- enable lucee admin
Edit the base NGINX config for your project at ./config/nginx/conf.d/default.conf
- Update web server root to the farcry project www
For example:
root /var/www/farcry/projects/gpml/www;
The Lucee admin is blocked from public access by default as a security measure. You will need to temporarily remove this block in order to configure the Lucee server for your environment.
Comment out the /lucee
location directive:
#location /lucee {
# deny all;
#}
Do not commit this change to version control, as we do not want it in production.
TLDR;
- Update admin for mappings
- copy configs into repo; lucee-web and lucee-server
Make sure everything is working at this point, and then configure Lucee admin.
$ vagrant up dockerhost
$ vagrant up lucee
$ open http://hostname:0000/lucee/admin/web.cfm
This will build the Docker images locally for the first time -- it has to transfer about 500Mb off the internet so be patient.
Login with password docker
.
Go to Lucee admin mappings. You will need to update the mapping for the webroot at /
to match the location of your project webroot.
Configure any datasources using environment ENV variables.
By default changing the Lucee admin should be updating your config/lucee/lucee-web.xml.cfm
-- this will end up being the production Lucee config. Anything that is specific to an environment other than production should be specified using environment variables; for example, the datasources.
Keep mucking around here until you have your application working.
Commit all your changes to the Git repo.
Make sure you discard the NGINX conf chunk that enables the Lucee admin; you do not want to expose the admin in production.
If you are running with the Daemon Workbench format you should be able to re-provision the virtual machine:
vagrant provision
Alternatively, you can log onto the Boot2Docker instance and interact with Docker directly.
vagrant ssh onto boot2docker and cleanup hanging containers/images:
docker rm $(docker ps -a -q) <-- remove all stopped containers
docker images -q --filter "dangling=true" | xargs docker rmi <-- remove all untagged images
Or the nuclear option:
docker rm -f $(docker ps -aq) <-- remove all containers
docker rmi -f $(docker images -q) <-- remove all images