pedestal

macrobartfast 2020-01-28T04:08:52.013200Z

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.

chrisulloa 2020-01-28T06:12:59.013900Z

are you exposing the port properly when running the docker container?

chrisulloa 2020-01-28T06:17:45.015200Z

nvm i see you’re in another channel figuring it out

KJO 2020-01-28T17:49:35.016600Z

@macrobartfast Not sure if this'll be helpful, but I use the following service map to start pedestal

KJO 2020-01-28T17:52:44.018200Z

{::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

macrobartfast 2020-01-28T18:57:29.020300Z

@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.

macrobartfast 2020-01-28T18:57:55.020800Z

I switched to Tomcat from Jetty and that worked.

macrobartfast 2020-01-28T18:58:00.021100Z

but we never resolved the issue.

chrisulloa 2020-01-28T18:58:14.021600Z

weird, we use jetty and pedestal with set up similar to above ^

chrisulloa 2020-01-28T18:58:16.021800Z

no problems

macrobartfast 2020-01-28T18:58:24.022Z

I know... bizarre.

macrobartfast 2020-01-28T18:58:36.022600Z

I like the Jetty version, so would like it to work.

macrobartfast 2020-01-28T18:58:46.023100Z

I have no reason I prefer Jetty, though.

chrisulloa 2020-01-28T18:58:58.023500Z

are you overriding the pedestal jetty version?

chrisulloa 2020-01-28T18:59:34.024400Z

sometimes dependencies will pull in different versions of jetty too

macrobartfast 2020-01-28T18:59:42.024700Z

I am.... I included Tomcat in project.clj and the changed the value in the map from Jetty.

macrobartfast 2020-01-28T18:59:59.025300Z

Yeah, I was wondering if I should change my versions.

macrobartfast 2020-01-28T19:00:12.025900Z

Also, maybe the leiningen Pedestal template?

macrobartfast 2020-01-28T19:00:37.026800Z

I couldn't find it in ~/.lein/profiles so not sure where the template is specified.

macrobartfast 2020-01-28T19:01:08.027600Z

I must have a more global place I'm setting up lein with the plugin.

macrobartfast 2020-01-28T19:01:09.027900Z

on osx.

chrisulloa 2020-01-28T19:01:17.028100Z

lein should pull in the template remotely

macrobartfast 2020-01-28T19:01:25.028400Z

ah ok.

chrisulloa 2020-01-28T19:01:30.028600Z

lein new pedestal-service my-project

macrobartfast 2020-01-28T19:01:36.028800Z

that's what I use.

macrobartfast 2020-01-28T19:01:41.029100Z

it's freaking awesome.

macrobartfast 2020-01-28T19:01:55.029600Z

I love Pedestal.

chrisulloa 2020-01-28T19:02:16.030300Z

what dependencies do you have in your project?

macrobartfast 2020-01-28T19:03:42.030700Z

(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)

macrobartfast 2020-01-28T19:04:26.031600Z

it's just a bare bones pedestal service to get going with pedestal in docker on kubernetes.

chrisulloa 2020-01-28T19:04:27.031700Z

presumably had jetty line uncommented when you were trying that

macrobartfast 2020-01-28T19:04:42.032Z

I did have them uncommented, good thought though.

chrisulloa 2020-01-28T19:04:54.032200Z

what java version?

chrisulloa 2020-01-28T19:04:59.032500Z

in your dockerfile?

macrobartfast 2020-01-28T19:06:08.033Z

java version "1.8.0_92"

macrobartfast 2020-01-28T19:06:21.033500Z

FROM java:8-alpine

chrisulloa 2020-01-28T19:06:26.033800Z

ah okay

macrobartfast 2020-01-28T19:06:29.034Z

the latter is the docker version

chrisulloa 2020-01-28T19:06:31.034200Z

not sure what the issue is really

macrobartfast 2020-01-28T19:06:35.034400Z

I know, right?

macrobartfast 2020-01-28T19:06:55.035200Z

maybe this is the right moment to go with Tomcat and move along.

chrisulloa 2020-01-28T19:07:06.035600Z

are you running the service locally with docker or in your kube cluster?

macrobartfast 2020-01-28T19:07:21.036100Z

running the service locally.

macrobartfast 2020-01-28T19:08:02.037Z

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.

macrobartfast 2020-01-28T19:08:09.037200Z

a big step for me, all that.

chrisulloa 2020-01-28T19:08:15.037400Z

for sure

macrobartfast 2020-01-28T19:08:44.037900Z

terrifying devops rabbithole.

macrobartfast 2020-01-28T19:09:13.038600Z

with this issue, I feel like a olympic sprinter who's tripped at the start.

macrobartfast 2020-01-28T19:10:57.039900Z

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?

macrobartfast 2020-01-28T19:11:12.040200Z

life choices.

chrisulloa 2020-01-28T19:11:55.040800Z

might be good to just run with tomcat and come back to it later

chrisulloa 2020-01-28T19:12:15.041600Z

make an issue in pedestal since they are providing template

macrobartfast 2020-01-28T19:12:36.042100Z

down the road, you'll be one of the few Jedis who knows why Encom uses Tomcat.

chrisulloa 2020-01-28T19:13:33.043600Z

might also be an issue with your local machine

macrobartfast 2020-01-28T19:13:41.044Z

I suspect it is.

chrisulloa 2020-01-28T19:13:56.044500Z

might be worth sending docker container and run script to another dev and trying

macrobartfast 2020-01-28T19:14:08.044900Z

brilliant idea.

macrobartfast 2020-01-28T19:14:30.045400Z

and also, pull down a working pedestal service that's known to work and try it locally.

chrisulloa 2020-01-28T19:14:40.045700Z

yep

chrisulloa 2020-01-28T19:14:54.046200Z

we have multiple services that use pedestal, same set up more or less just on different ports

macrobartfast 2020-01-28T19:15:49.047100Z

oh, one interesting thing, when I deployed to digital ocean...

macrobartfast 2020-01-28T19:15:53.047300Z

it didn't work.

macrobartfast 2020-01-28T19:16:14.047800Z

so I should try a node app or something and see if it works in the cloud.

macrobartfast 2020-01-28T19:16:22.048100Z

sounds like I have my next steps cut out for me.

chrisulloa 2020-01-28T19:16:34.048300Z

good luck

chrisulloa 2020-01-28T19:16:39.048600Z

maybe someone will chime in later who knows more

macrobartfast 2020-01-28T19:16:43.048800Z

thank you!

macrobartfast 2020-01-28T19:17:29.049700Z

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.

macrobartfast 2020-01-28T20:12:45.051200Z

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

macrobartfast 2020-01-28T20:24:33.052400Z

oh duh. works if you request via http. I shouldn't have shared my little journey.

😂 2