Skip to main content

Docksal Setup

Thoughts on running CI with Docksal.

Initial setup is easy

composer create-project codeigniter4/appstarter myproject && \ 
cd myproject
fin init
#dockroot public

Don't remember there being more to it. Now it's just fin project start

Stack assumptions

fin init starts a lamp stack. CodeIgniter project requires changing database settings in .env.
However it turns out this is managed by CI, so the settings in the file are picked up without having to make changes!

Missing spark add-on

Like Laravel's artisan, CodeIgniter has a helper utility called spark. There is no add-on, but it's easy to make.
Currently this means you type commands a bit more verbosely, for example fin exec php spark whatevs.

Run the spark dev server

I'm not sure if this is needed really (as discussed under Stack assumptions), however if you have a need (let me know), then the dev server can be exposed as follows:

Create .docksal/docksal-local.yml with the following contents:

version: "2.1"

services:
  cli:
    ports:
      - '8080:8080'

Apply using fin start. Run using fin exec php spark serve -host 0.0.0.0 then open https://myproject.docksal.site:8080.