normally script my builds, but span up a docker ng...
# docker
d
normally script my builds, but span up a docker nginx lucee container on my local windows docker... port 80 works fine... lucee/lucee:6.1.0.230-SNAPSHOT-nginx-tomcat9.0-jdk11-temurin-jammy 1. where do i get passwords for logging into os so i can configure it? 2. cant get admin so assuming it's firewalled off... even on localhost docker?? am i missing something. (set cfadmin password through env var)
a
"passwords for logging in to OS"?
d
on the docker container... assuming ubuntu?
or am i missing something fundimental
normally when you roll ubuntu, it gives you the passwords in the console for root and then you setup your other users/server configs from there...
a
A container is just for running a process. That it needs to have an OS there to facilitate this is kinda coincidental. It's not a VM.
So... containers usually run their processes as root internally. As it is self-contained, I think this is usually fine (I am not a security engineer, that said).
d
so how to do configure the nginx websites?
isn't the container still part of an os, and the container has the 'shared' core of the os?
1. i need to enable the admin (which should be enabled from docs) 2. i need to create nginx websites and lucee config for each... so what i need for this is minimal... just not sure were to get started.
a
so how to do configure the nginx websites?
Same way you normally do, via Nginx's config files. The OS in the container has nothing to do with it, same as it has nothing to do with it on an on-metal installation.
d
how do i get to the nginx config add new sites? as more and more will be added to this over time? I know how to do this in a vm, or on bare metal
a
This repo - although PHP not Lucee - should point you in the right dir. https://github.com/adamcameron/php8/blob/main/docker/nginx/Dockerfile#L3 The image will come with a default config set up. Look at the docs for the image on Docker Hub (which are likely incomplete knowing Lucee) If if you - for example - want yer nginx.conf to have something non-std in it... stick a replacement in when you build the image. It's too late by the time you have container. The config is already done and containers are transient by design.
👍 1
I have a lucee one here, but I just use the default website as it's only for testing shit: https://github.com/adamcameron/lucee_and_mariadb/tree/main/docker
If you need to look at the file system in the container, you can attach a shell to it eg:
docker exec -it container-name bash
that helps to look at what the default configs are for stuff if they're not documented by the image creator.
👆🏻 1
You could probably do with backing up a bit and doing some "how to use docker" tutorials, before you jump into dockerising a Lucee app.
d
Thanks for that... yeah seeing a lot of that... just seems a weird way to configure it.
Yeah I did some of those... and thought 'this is why people don't use linux for a default os'... things that should be easy are complex for zero reason or benefit... I can see why many use alternatives. I might go back to scripting, just as fast and way more customisable.
I currently use a highly modified version of the foundeo script, but use a remote csv to import and automatically spin up the site configs... I think I'll stick with that. I just thought 'it cant be this hard to get a user password that is given to you on manual install'... for sure thought it would output somewhere useful or hit a webhook or something. What a PITA
If i had more than simple requirements I might push through, but it's not work the time wasted for a simple setup. I just need to create sites and configure lucee and I'm done. so can use cfconfig for lucee and use a cron job to create sites from the csv after the fact and on install.
just wish you could set a environmental var with a password and it builds the container and nukes the enviro var after install ... that way it could be known.
g
You're completely missing the starting li ne and attempting to join the process at a place that just isn't compatible. Your configuration is required before the container even starts.
d
as for lucee admin no idea why i can't see that out of the box.
@gavinbaumanis on a multi-tennant site you never know the site urls before the server is created?
domain names and sites are created dynamically as you go that point to newly created directory structures.
I guess I could create nginx files offsite and push them to a repo and then sync them into build
g
So you need to store the details somewhere else, then. Like a dB. Or a flat file... or in a config.json then as part of your new site routine you save the necessary details. And copy them external to the container. So when you start a new container the configuration is already ready.
d
Appreciate the help. is a bit of Mindshift (like using apple when you've used android)... some of the things you mention i'm already doing so maybe the jump isn't so big.
g
Start with the realisation that a running container promises you nothing other than to crash and fail... so save nothing you need to keep in the container, ever.
d
you need configuration in it, just seems they've thought of the hardest way to configure a machine and went 'that sounds great'
Thanks guys. I think I'll copy/paste these comments into a onenote notebook and look into it when I have more time and stick with current orchestration options. Just thought it 'should' be able to spin up a docker container and configure a couple of websites and access the lucee admin. seems I can't achieve either of these goals quickly today, but keen to learn if docker is better than what i'm already doing when I can test side by side and decide.
only tried this as getting boncode errors on a new win11 dev machine and needed a quick solution to keep working. #havingABadDay
a
it cant be this hard
It isn't hard. You're making it hard on yerself by not learning how the tool works and is intended to be used before declaring it's difficult. That's just a shit way of going about things. It's also no small amount of hubris on your part to declare a widely-adopted ubiquitous industry standard approach as shit cos you don't bother to understand it. The fundamental thing you are missing - willfully, really, because you're ignoring the guidance - is that one doesn't spin up a container and then configure it. One configures an image and then spin up a container based on the definition provided by the image. Containers are disposable. By design. It's the image that is the persisted (and accordingly what you configure).
p
I read about half way through this, but really its as simple as changing a flag in your docker file to be able to access the Lucee admin. As for nginx config….spin up another container configured for your other site(s) and prep the config for that. Basic fundamentals of Docker…1 container=1 app/site.
a
TBH I'd run with one container one service. Where in your scenario Nginx is the service. I'd have no worries serving multiple tenants for the same backend multi-tenant app via one Nginx service. But even that is a few steps ahead of where Chris is at, atm
💯 1
But equally it depends on how the container needs to be run. I could also completely understand running multiple Nginx services too, if they need to act independent of one another.
p
It sounded to me like he wanted it for his local dev environment and to be easily able to add various apps sitting behind an nginx server. TBH tho, I would just spin up commandboxs for whatever app/site I am working on.
and in regard to it being multi-tenant, still commandbox and configuring diff env files and spin up based on that.
a
Whether it's a commandbox-based image or the native Lucee one, the considerations are the same though aren't they? One still needs to understand how Docker works.
p
Agree completely, needs to watch a few videos and comprehend how Docker works and common best practices for using it.
a
From https://hub.docker.com/r/lucee/lucee:
The NGINX tagged Docker images are configured to deny access to the Lucee Admin by default in the default.conf.
Whilst it would be dead handy to also include exactly how to re-enable it, I presume it's obvious if one just looks at the file. I'm on my phone right now so can't really check.
p
Appears just needing to set
LUCEE_ADMIN_PASSWORD
as an env variable
But possibly have to modify that nginx
default.conf
file, not sure about that official image…dont think I have used it before.
a
I presume it's got a commented-out
location
entry pointing to it.
p
@dawesi You might want to takea. quick look at https://github.com/kukielp/Amazon-SQS-Lucee-CFML It's a little outdates but shows how you can inject into your containers nginx conf files and use docker compose for local dev. It's some early version of Lucee as I havnt updated for a logn time but I think it might still work
👍 1