I can't reach the server port (8080 in my case... the default Pedestal port) in a docker container in which pedestal is running on osx, even after adding ::http/host "0.0.0.0" per https://github.com/pedestal/pedestal/issues/604... I've been working on this for several hours... I tested that an apache container running on 8080 is reachable... help.
are you exposing the port properly when running the docker container?
nvm i see you’re in another channel figuring it out
@macrobartfast Not sure if this'll be helpful, but I use the following service map to start pedestal
{::http/host "0.0.0.0"
::http/allowed-origins
{:allowed-origins (fn[_] true)
:creds true}
::http/routes #(deref #'routes)
::http/type :jetty
::http/container-options
{:context-configurator jetty-websocket-configurator
:h2c? true
:h2 true
:ssl? true
:ssl-port 8081
:keystore keystore-location
:key-password "xxxxxxxxxx"
:security-provider "Conscrypt"}
::http/port 8080}
and then the following docker command to bring up the container
docker run --name test --env-file=docker/env_file.txt -p:8081:8081 -it allocations:latest
and that works for me. I'm sure that -p8080:8080 will also work for the non https connection@christian.gonzalez I was exposing the port in the Dockerfile... I event tried running the container with -P (the capitalized version of the port flag) which tells Docker to pick a random high port, and it was still unreachable.
I switched to Tomcat from Jetty and that worked.
but we never resolved the issue.
weird, we use jetty and pedestal with set up similar to above ^
no problems
I know... bizarre.
I like the Jetty version, so would like it to work.
I have no reason I prefer Jetty, though.
are you overriding the pedestal jetty version?
sometimes dependencies will pull in different versions of jetty too
I am.... I included Tomcat in project.clj and the changed the value in the map from Jetty.
Yeah, I was wondering if I should change my versions.
Also, maybe the leiningen Pedestal template?
I couldn't find it in ~/.lein/profiles so not sure where the template is specified.
I must have a more global place I'm setting up lein with the plugin.
on osx.
lein should pull in the template remotely
ah ok.
lein new pedestal-service my-project
that's what I use.
it's freaking awesome.
I love Pedestal.
what dependencies do you have in your project?
(defproject general-pedestal-service "0.0.1-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.10.1"] [io.pedestal/pedestal.service "0.5.7"] ;; Remove this line and uncomment one of the next lines to ;; use Immutant or Tomcat instead of Jetty: ;; [io.pedestal/pedestal.jetty "0.5.7"] ;; [io.pedestal/pedestal.immutant "0.5.7"] [io.pedestal/pedestal.tomcat "0.5.7"] [ch.qos.logback/logback-classic "1.2.3" :exclusions [org.slf4j/slf4j-api]] [org.slf4j/jul-to-slf4j "1.7.26"] [org.slf4j/jcl-over-slf4j "1.7.26"] [org.slf4j/log4j-over-slf4j "1.7.26"]] :min-lein-version "2.0.0" :resource-paths ["config", "resources"] ;; If you use HTTP/2 or ALPN, use the java-agent to pull in the correct alpn-boot dependency ;:java-agents [[org.mortbay.jetty.alpn/jetty-alpn-agent "2.0.5"]] :profiles {:dev {:aliases {"run-dev" ["trampoline" "run" "-m" "general-pedestal-service.server/run-dev"]} :dependencies [[io.pedestal/pedestal.service-tools "0.5.7"]]} :uberjar {:aot [general-pedestal-service.server]}} :main ^{:skip-aot true} general-pedestal-service.server)
it's just a bare bones pedestal service to get going with pedestal in docker on kubernetes.
presumably had jetty line uncommented when you were trying that
I did have them uncommented, good thought though.
what java version?
in your dockerfile?
java version "1.8.0_92"
FROM java:8-alpine
ah okay
the latter is the docker version
not sure what the issue is really
I know, right?
maybe this is the right moment to go with Tomcat and move along.
are you running the service locally with docker or in your kube cluster?
running the service locally.
well, first was going to run the service in a container, then run the container in the cloud in a small vps, then figure out some kube workflow.
a big step for me, all that.
for sure
terrifying devops rabbithole.
with this issue, I feel like a olympic sprinter who's tripped at the start.
maybe it's a test... do I just go with Tomcat and move on, or spend a day resolving the Jetty issue when it has no material effect?
life choices.
might be good to just run with tomcat and come back to it later
make an issue in pedestal since they are providing template
down the road, you'll be one of the few Jedis who knows why Encom uses Tomcat.
might also be an issue with your local machine
I suspect it is.
might be worth sending docker container and run script to another dev and trying
brilliant idea.
and also, pull down a working pedestal service that's known to work and try it locally.
yep
we have multiple services that use pedestal, same set up more or less just on different ports
oh, one interesting thing, when I deployed to digital ocean...
it didn't work.
so I should try a node app or something and see if it works in the cloud.
sounds like I have my next steps cut out for me.
good luck
maybe someone will chime in later who knows more
thank you!
and yes. the fact that it didn't work in the cloud tells me that something is wrong with my dependencies... I'm shipping the problem up to my vps and it's occurring there.
haha well... got the Tomcat version of the Pedestal service deployed in the cloud and got an SSH error ( java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
) so maybe I dooo like Jetty more. That may have happened with Jetty, too, for all I know. https://stackoverflow.com/questions/42218237/java-lang-illegalargumentexception-invalid-character-found-in-method-name-http
oh duh. works if you request via http. I shouldn't have shared my little journey.