I have integrated a legacy app with ColdBox - how do I deploy it?

This is clearly a newbie question. I watched a ton of cfcasts videos, including the two on getting my legacy app into ColdBox. I have things working great on my desktop with an embedded CF2021 server on port 127.0.0.1:8080.

I’m ready to get this running on one of our linux servers. I can’t figure out this is supposed to be done.

All of the app’s software is in a single directory (/kgs). Do I just install CommandBox on the server and repeat everything I’ve done? Or could I just move the /kgs directory to the server and do a bunch of configuration?

I’m coming up empty researching this simple question. If someone does help me out, I’m sure I’m going to feel pretty stupid.

Once I do get it running on the linux server, will I still need to run Apache in front of it to deal with the < 1024 ports (80, 443)?

Kurt

There’s a lot of “right” answers here. If you already have CF running on your production server, then you just need to move the code into the web root of that server. A note not on that-- ColdBox’s rewrites do care if they are in a sub folder or not so if you’ve been developing with ColdBox in the web root, but plan to have it in a folder on production, you’ll likely need to adjust a few things to account for that. (I recommend making your dev setup match production)

If this is a brand new server that doesn’t have any CF engine installed and you were hoping to use CommandBox, that’s perfectly fine, but to be clear ColdBox in no way requires CommandBox at all. To run CommandBox on production, you’ll want to look into

  • Server profiles to ensure everything is locked down
  • Our paid CommandBox Service Manager module to help you setup a OS-level service that auto-starts on boot
  • Extracting out any sensitive or tier-specific data from your configuration and using a .env file or actual env vars.

Not necessarily. You can run CommandBox as root so it can bind to those ports, or you can setup port forwarding in Linux pass them to the actual ports CommandBox is listening on. CommandBox’s built-in server is fast, secure, and powerful.

I am facing the same issue and my expectations were a bit diferent.
I wanted to create a Pipeline in Github actions and then simply commit/push to my Repo and have that Pipeline use FTP to deploy.

However this brought up more questions that answers.

  1. Do i need to install git in local commandbox or use it separate? (I do see many Git files in my setup so this is blowing my mind specially as I see no GIt commands nor adequate libraries in Forgebox).
  2. If I finally achieve this, which file should I gitIgnore and If I do, then how can I ensure that Coldbox dependency is deployed… Does this involve manually installing Commandbox and scripting through actions?

It is actually a very good topic. Currently everything seems to be geared towards containers/dockers and cloud… But what about simple apps that need to run in VPS/shared environments that already have CF installed.

What is the best practice? how to install? how to deploy? how to configure? how to sync, Not so trivial at all and very little documentation around this… I’m also a 2 week newbie flying throug cfcasts but one thing leads me to the other. @bdw429s you’re the man! help please… If you can please share a step by step It would be great…

I even added my own blog about this… I’ve managed to create the pipeline with a “homegrown” app… But I’m completely baffled on how to do it with commandbox/coldbox as there are too many moving pieces and I’m not even sure the fulll scope that commandbox has “out of the box”… Seems like git/ftp is not one of them.

[GIT y FTP - Pipelines para Publicar y controlar código](https://My Post on CI/GIT/FTP Pipeline)

@Juan_Carlos_Cardoso: Yes, you can use GitHub Actions to deploy your code via FTP. You can go about this in many ways, and none of them are necessarily the correct way.

About your specific questions.

  1. Do I need to install Git in local CommandBox or use it separate? This question is a bit confusing. CommandBox is used to launch CFML servers, install packages from ForgeBox, and other super-handy developer stuff but it’s not version control - they are separate things.

Let’s think of it this way:

  • CommandBox is a CLI tool that helps you launch CFML servers and install packages (dependencies ) via ForgeBox
  • Git is a version control tool that keeps an organized backup of your code and all code changes
  • GitHub Actions is a service that allows you to perform various steps when you push up code changes with Git.
    • One of those steps can be deploying code via FTP or many other methods.
    • Another step can also be installing CommandBox, and then using CommandBox to install any dependencies BEFORE deploying your code to your server.

You can do all kinds of stuff with GitHub Actions. Here’s an example of how we use CommandBox in our GitHub Actions when we build our CBWIRE module. https://github.com/coldbox-modules/cbwire/blob/development/.github/workflows/ci.yml

My suggestion would be to also check out the GitHub Actions Marketplace GitHub Marketplace · Actions to improve your workflow · GitHub and search for FTP actions already available.

  1. Which file should I gitIgnore and If I do, then how can I ensure that Coldbox dependency is deployed What you place in your gitignore file will not be stored in your Git repository, and it really just depends on your app. Typically third-party dependencies ( code that isn’t yours ) will be added to .gitnore. This includes things like your ColdBox, TestBox, and ./modules folders. This creates a problem though. If you are not including your dependencies in Git, then how do you deploy them? The answer is that you use CommandBox as part of your GitHub Actions build to install your dependencies, and then you deploy your code.

Hope this helps.

Thank you G!..
yeah… I was confused too because I saw multiple .git files inside the project that were created by cb. I sorted this by simply installing git on the parent folder and doing all my git add/commits/push from there… It does respect the gitignore which is what I was worried about. This made it easy to establish my github actions.

There shouldn’t be any files called .git in an app scaffolded out with the coldbox create app command. In fact, I’ve never heard of a file called .git before. Can you show a screenshot of this .git file you’re seeing? Once you initialize a Git repository in a folder, there is a .git folder created, but again CommandBox should not be creating any such folder. And we do suggest some files such as .gitignore or .gitattributes, but those do nothing unless you decide to use that project with Git source control.

You don’t “install” Git into a folder. That doesn’t make any sense. Do you mean to say that you initialized a repository in the parent folder?

When you say “it” are you referring to Git itself, or some command inside of CommandBox?

.gitattributes, .gitignore

You will see there are multiple .gitXXX files that I believe were scaffolded when I created the Coldbox App from Commandbox. These are the files that I am refering to (which led me to believe that CB had integrated GIT features).

You are correct. I should be more precise…

@Juan_Carlos_Cardoso Yep, those files are added automatically when you scaffold out a new ColdBox app and those files get committed to your repo. They are just there to get you up and running with Git quickly.

.gitignore - Which files to NOT commit to the repo
.gitattributes - Rules for syntax highlighting when doing code DIFFs. I rarely touch this file.