CommandBox 6 Multisite Docker with MOD_CFML

Follow along in the video https://www.youtube.com/watch?v=eVmMw5TAwcc

Clone this repo: https://github.com/ortus-Solutions/docker-commandbox

git clone https://github.com/ortus-Solutions/docker-commandbox

We first need to modify the install-commandbox.sh. file located in build/util/install-commandbox.sh

On around line 25 you will see box config set server.singleServerMode=true we need to change that to false:

box config set server.singleServerMode=false

On around line 29 just after the initial box conf set server.daults... add the following:

box server set ModCFML.enable=true
box server set ModCFML.sharedKey=my-secret
box server set web.ajp.enable=true web.ajp.port=8009

NOTE: You need to make note of the sharedKey as it will be used later and I HIGHLY suggest you change this shareKey for security reasons.


The next step is to get the docker image up on dockerhub.io. You will need an account there, please sign up at https://hub.docker.com/ You can skip this step if you're familiar with Docker and know how to pull the image locally

From the terminal in the same folder as the git repo above enter the following to build the docker image.

docker build -f builds/debian/Lucee5.Dockerfile -t YOURUSERNAME/mycommandbox . --build-arg COMMANDBOX_VERSION=6.0.1

Next you will need to login to docker from the terminal using docker login, enter your credentials and now you're ready to push your image.

To push your image type in docker push YOURUSERNAME/mycommandbox

Your image should now appear on Docker Hub.

For the next steps I'm going to use a program called Portainer. Instructions for getting this installed in docker can be found at https://docs.portainer.io/start/install-ce/server/docker/linux

Copy the lucee.conf, and lucee-proxy.conf file from https://viviotech.github.io/mod_cfml/install-nginx.html into the /var/www/nginx/ directory.

You then need to create your sites config in /var/nginx/conf.d/

sample site1.com.conf file

server {
  listen 80;
  server_name site1.com;
  root /var/www/site1.com/;

  set $lucee_context "site1.com";
  include lucee.conf;
}

You need to create a new stack in portainer with the following information.

version: '3.4'    
services:
  web:
    image: nginx
    volumes:
      - /var/nginx/conf.d/:/etc/nginx/conf.d/
      - /var/nginx/lucee.conf:/etc/nginx/lucee.conf
      - /var/nginx/lucee-proxy.conf:/etc/nginx/lucee-proxy.conf
      - /var/www/:/var/www/

    ports:
      - 80:80
      - 443:443
  app:
    image: YOURUSERNAME/mycommandbox

    # Ports
    ports:
      - 8885:8080
    volumes:
      - /var/www/:/var/www/
      
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:8080/"]
      interval: 30s
      timeout: 10s
      retries: 5
#      start_period: 180s
      
      # Deployment Configuration
    deploy:
      replicas: 1
      update_config:
        parallelism: 1
        delay: 0s
        failure_action: continue
        order: start-first
      restart_policy:
        condition: on-failure
        delay: 5s

*IMPORTANT: Be sure to check your image on docker hub to make sure it's private and not public. You should also setup appropriate firewalls on DigitalOcean droplet

USE THIS AS A GUIDE ONLY. IT COMES WITHOUT WARRANTY

Coldfusion/Lucee Running on MeLE Fanless Stick PC

I started out with a MeLE PCG02 Mini PC Stick Fanless Windows 11 Pro stick computer running Windows 11.

This is a great little computer for your TV.

You can check it out in action at http://blusol.ddns.net NOTE: It may not always be running as I'm constantly playing with it bringing it offline. Also, this is running on home internet and a dynamic dns service. 

But can you imagine the possibilities? I'm thinking of a dynamic system for displaying Real Estate on a TV for local Realtors.

What will you use yours for?

How to Host Multiple Websites with Ubuntu Linux and Lucee

Note: This is configured to work with Ubuntu 16.04LTS

Step 1:

git clone https://github.com/foundeo/ubuntu-nginx-lucee

Step 2:

Set permissions on install script

cd ubuntu-nginx-lucee
chmod u+x install.sh

Step 3:

Execute the install script and answer y to any install prompts

./install.sh

Step 4:

Configure nginx for your domain

nano /etc/nginx/sites-enabled/me.example.com.conf

server {
	listen 80;
	server_name me.example.com;
	root /web/me.example.com/wwwroot/;
	access_log /var/log/nginx/me.example.com.access.log;
	error_log /var/log/nginx/me.example.com.error.log;
	include lucee.conf;
}

Create the symbolic link in sites-enabled to enable the site:

sudo ln -s /etc/nginx/sites-available/me.example.com.conf /etc/nginx/sites-enabled/

After making changes you need to restart or reload nginx:

sudo service nginx restart

Tips/Tricks & FAQ

Q: How do I access the Lucee admin?

Edit /etc/nginx/lucee.conf

location ~* /lucee/ {
    allow YOUR.EXTERNAL.DESKTOP.IP;
    deny all;
    include lucee-proxy.conf;
}

Q: What's the Lucee default password?

The password is automatically generated for you on install and is stored in /root/lucee-admin-password.txt

cat /root/lucee-admin-password.txt

References: 

https://github.com/foundeo/ubuntu-nginx-lucee

Resize gDrive Images On The Fly

Note: I have taken down the image server used for testing, however everything else here can be used as reference.

![](http://marlin.blusol.io:8080/800x/https://drive.google.com/a/southeastern360.com/uc?id=0By5I5hN7xKMacEhONDVSeUw3RWc)
![](http://marlin.blusol.io:8080/800x/https://drive.google.com/a/southeastern360.com/uc?id=0By5I5hN7xKMabjNoYzRNYXlwNVE)
![](http://marlin.blusol.io:8080/800x/https://drive.google.com/a/southeastern360.com/uc?id=0By5I5hN7xKMaTWNfY29NVnI0WWs)

Resources:

Private S3 Server with Docker+Scality S3 Server

docker run -d \
--name mys3server \
-p 8000:8000 \
-e SCALITY_ACCESS_KEY_ID=myAccessKey \
-e SCALITY_SECRET_ACCESS_KEY=mySuperSecretKey123 \
-v s3data:/usr/src/app/localData \
-v s3metaData:/usr/src/app/localMetadata \
scality/s3server

Connection Options: https://github.com/scality/S3/blob/master/README.md#command-line-tools

I prefer the s3cmd.

Once you configured ~/.s3cfg you here's some commands you can run.

#This will create the bucket webfiles
s3cmd mb s3://webfiles

#This will upload a test.txt file from the mac desktop to the  webfiles bucket.
s3cmd put ~/Desktop/test.txt  s3://webfiles

#This will List All objects (buckets, files inside buckets)
s3cmd la

#This will list all files in the webfiles bucket.
s3cmd ls s3://webfiles

Private Bitbucket Repo's with CommandBox and Mac

ssh-keygen -f ~/.ssh/privatebitbucket -C "privatebitbucket"

Edit the ~/.ssh/config file.

Host privatebitbucket
 HostName bitbucket.org
 IdentityFile ~/.ssh/privatebitbucket

Copy the new key to clipboard to add to bitbucket.

pbcopy < ~/.ssh/privatebitbucket.pub

Login to bitbucket and add the ssh key:

List the currently loaded keys:

$ ssh-add -l

If necessary, add your new key to the list:

$ ssh-add ~/.ssh/privatebitbucket

List the keys again to verify the add was successful:

$ ssh-add -l

   _____                                          _ ____             
  / ____|                                        | |  _ \            
 | |     ___  _ __ ___  _ __ ___   __ _ _ __   __| | |_) | _____  __ 
 | |    / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |  _ < / _ \ \/ / 
 | |___| (_) | | | | | | | | | | | (_| | | | | (_| | |_) | (_) >  <  
  \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|____/ \___/_/\_\   v3.7.0-SNAPSHOT+00685

Welcome to CommandBox!
Type "help" for help, or "help [command]" to be more specific.

CommandBox:you> install git+ssh://git@privatebitbucket:[BITBUCKETUSERNAME]/[privaterepo].git

Flexible and Advanced ContentBox Layouts for Custom Modules

UPDATE: Check out ColdBox CBT instead.

https://github.com/coldbox-modules/cbox-cbt

Origional Post:

I had an epiphany today trying to figure out a flexible way to re-use a ContentBox module in such a way that each view could be customized per client without the need of creating hundreds of individual "view" files.

If you have not already created a custom ContentBox Themed Module let me suggest you stop what you're doing and head over to https://www.ortussolutions.com/blog/the-12-tips-of-contentbox-christmas-day-6-themed-modules and get started.

Sample Handler:

component {

	// DI
	property name='ContactService' inject='ContactService';
	property name='MessageBox' inject='MessageBox@cbMessageBox';

	function index() {
		list( argumentCollection=arguments );
	}

	function list(event,rc,prc){
		// Query our data just like normal.
		prc.qContacts		=	contactService.list();
		
		// To use the data in ContentBox as a dynamic variable we need to flatten things out a bit.
		prc.demoName 		=	prc.qContacts.name;
		prc.demoAddress1 	=	prc.qContacts.address1;
		prc.demoCity 		=	prc.qContacts.city;
		prc.demoState 		=	prc.qContacts.state;
		prc.demoZip 		=	prc.qContacts.zip;
		cbHelper.prepareUIRequest('pagesNoHeader');
		event.setView( "home/list" );

}		

Sample View home/list.cfm

<cfoutput>
#cb.contentStore('demo-list', 'ContentStore item not found')#
</cfoutput>

The above view will look for a ContentStore item slug called demo-list.

ContentBox ContentStore demo-list

This is where you will create the layout for your data that can be edited and modified without having to edit the core view files. This concept is a work in progress, but it does work and I have a feeling it will be expanded on in the future.

<div class="row">
	<div class="col-md-8">
		<h1>$ {prc:demoName}</h1>
		$ {prc:demoAddress1}<br />
		$ {prc:demoCity},&nbsp; $ {prc:demoState} $ {prc:demoZip}<br />
	</div>
	<div class="col-md-4">
		<h4>Custom/Editable Section</h4>
		<p>This section can contain specific information outside of the module.</p>
	</div>
</div>
<div class="row">
	<div class="col-md-12">
		{ {{RenderView view='home/demoView' module='myModule' cache='false'}} }
	</div>
</div>

RenderView demoView

Renders the above view.

Live Demo

Below is an example of the finished result I've been working on:

Editor Preview

NOTE: This was put together quickly so I wouldn't forget about it, check back later for updates