Hello,
Thank you for reading.
I am trying to get NearBeach up and running under nomad however I keep hitting some hurdles along the way. I am currently only running nomad under a dev environment as I develop a way to get this working.
My current nomad file is setup as such
job "prod.nearbeach" {
datacenters = ["dc1"]
group "nearbeach" {
task "nearbeach" {
driver = "docker"
config {
image = "robotichead/nearbeach:latest"
port_map {
webserver = 8000
smtp = 2525
db = 3306
}
command = "/bin/bash"
args = ["-c", "python manage.py wait_for_database && ls -al && python manage.py migrate && python manage.py initadmin && python manage.py runserver 0.0.0.0:8000"]
}
env {
SECRET_KEY = "iPprijieaZs1wcZ4"
SMTP_EMAIL_HOST = "smtp.mailtrap.io"
SMTP_EMAIL_PORT = "2525"
SMTP_EMAIL_HOST_USER = "ba914cbac41ed1"
SMTP_EMAIL_HOST_PASSWORD = "cada0e56f86350"
MYSQL_DATABASE = "NearBeach"
MYSQL_USER = "nearbeach"
MYSQL_PASSWORD = "Test1234_"
MYSQL_HOST = "192.168.64.7"
ADMIN_USERNAME = "luke"
ADMIN_EMAIL = "luke@nearbeach.org"
}
resources {
cpu = 500
memory = 256
network {
mbits = 10
port "webserver" {}
port "smtp" {}
port "db" {}
}
}
service {
name = "redis-cache"
tags = ["global", "cache"]
port = "db"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
}
}
After setting up the file, I will run the command nomad job run nearbeach.nomad
and I’ll get the following results
==> Monitoring evaluation "ad8a1fb5"
Evaluation triggered by job "prod.nearbeach"
Allocation "ebeb718b" created: node "4e4db64d", group "nearbeach"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "ad8a1fb5" finished with status "complete"
The status of the job will stay pending
. However when I look at the terminal running the nomad dev environment, I spot the following error
2022/06/25 12:51:52.921134 [ERR] driver.docker: failed pulling container robotichead/nearbeach:latest: API error (500): Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io: Temporary failure in name resolution
2022/06/25 12:51:52.921678 [WARN] client: error from prestart: failed to initialize task "nearbeach" for alloc "5623d184-b1d1-afc4-48e9-cb96035fa857": Failed to pull `robotichead/nearbeach:latest`: API error (500): Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io: Temporary failure in name resolution
2022/06/25 12:51:52.921774 [INFO] client: Not restarting task: nearbeach for alloc: 5623d184-b1d1-afc4-48e9-cb96035fa857
2022/06/25 12:51:52.922438 [INFO] client.gc: marking allocation 5623d184-b1d1-afc4-48e9-cb96035fa857 for GC
I’ve been able to run NearBeach in a docker-compose container easily. With the following details
version: '3'
services:
nearbeach:
image: robotichead/nearbeach:latest
container_name: nearbeach
environment:
- SECRET_KEY=MoreSecrets
- EMAIL_HOST=smtp.mailtrap.io
- EMAIL_HOST_USER=FakeUser
- EMAIL_HOST_PASSWORD=NotARealPassword
- EMAIL_PORT=2525
- MYSQL_DATABASE=NearBeach
- MYSQL_USER=nearbeach
- MYSQL_PASSWORD=Test1234_
- MYSQL_HOST=192.168.64.7
- ADMIN_USERNAME=admin
- ADMIN_EMAIL=fake-email@nearbeach.org
volumes:
- .:/ceansuite
ports:
- 8000:8000
- 2525:2525
command: >
sh -c "python manage.py wait_for_database &&
ls -al &&
python manage.py migrate &&
python manage.py initadmin &&
python manage.py runserver 0.0.0.0:8000"
restart: unless-stopped
I’ve essentially made sure it works in docker-compose first before copying all the env variables over into the nomad file.
I’m scratching my head at what to do next.
System Detail
I am running on a VM using multipass on a MacBook Pro (13-inch, M1, 2020).
Extra Info
NearBeach docker source - GitHub - robotichead/nearbeach-docker: A simple Docker file to install NearBeach
If you require any other information, please ask