Bukdu.jl icon indicating copy to clipboard operation
Bukdu.jl copied to clipboard

Deploying Bukdu in Docker container

Open AlbertoHdezCerezo opened this issue 6 years ago • 6 comments

Hi,

Recently I started working with Julia developing microservices. I am using Bukdu to mount a server. Locally it works, but when trying to deploy it in Docker, it does not work. After loading the script a error appears:

WARNING: could not import Servers.nosslconfig into Bukdu

Here is my Docker:

# Select Official Julia 1.0.1 Distribution
# =========================================================
FROM julia:1.0.1-stretch

# Set directory project and copy project
# ======================================
WORKDIR /home/app/julia-bot-api
COPY . /home/app/julia-bot-api

RUN julia deps.jl

# Expose APP port
# ===============
EXPOSE 8080

# Run server when machine is created
# ==================================
CMD julia -i server.jl

And my server:

include("deeplearning.jl")

using Bukdu
import .Bukdu.Actions: index, show, new, edit, create, delete, update
using .DeepLearning

pipeline(:api) do conn::Conn
end

routes(:api) do
    resources("deeplearning", DeepLearningController)
end

Bukdu.start(8080)

Do you know what could be the issue?

AlbertoHdezCerezo avatar Oct 12 '18 12:10 AlbertoHdezCerezo

thanks for the issue. that's the error by changed since HTTP.jl v0.7.0. I fixed it on master and submit the new release (v0.3.3).

wookay avatar Oct 12 '18 14:10 wookay

OK. we got the Bukdu v0.3.3, please test with it.

wookay avatar Oct 24 '18 04:10 wookay

I tried this with the most recent version of Bukdu and it still failed.

Seanny123 avatar Dec 18 '18 18:12 Seanny123

@Seanny123 I don't know much about the docker settings. but at least this should work. please check your Container ID and try docker exec -it.

~/dockerfiles/julia-bukdu master✔ docker run -p 5000:8080 julia-bukdu
INFO: Bukdu Listening on: 127.0.0.1:8080
~ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
9c091f715e83        julia-bukdu         "julia app.jl"      2 minutes ago       Up 2 minutes        0.0.0.0:5000->8080/tcp   vibrant_allen

~ docker exec -it 9c091f715e83 curl localhost:8080/init/region/west/site/1/channel/2/
["init","west",1,2]

wookay avatar Dec 18 '18 20:12 wookay

Yes, executing curl inside the container does work. However, I'm having trouble getting requests from outside the container, despite using the same configuration as a previous working Flask app.

To be clear, I'm also having this problem with Genie.jl, so it might not be specific to Bukdu.

On Tue, Dec 18, 2018 at 3:11 PM -0500, "WooKyoung Noh" <[email protected]mailto:[email protected]> wrote:

@Seanny123https://github.com/Seanny123 I don't know much about the docker settings. but at least this should work. please check your Container ID and try docker exec -it.

~/dockerfiles/julia-bukdu master✔ docker run -p 5000:8080 julia-bukdu

INFO: Bukdu Listening on: 127.0.0.1:8080

~ docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

9c091f715e83 julia-bukdu "julia app.jl" 2 minutes ago Up 2 minutes 0.0.0.0:5000->8080/tcp vibrant_allen

~ docker exec -it 9c091f715e83 curl localhost:8080/init/region/west/site/1/channel/2/

["init","west",1,2]

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/wookay/Bukdu.jl/issues/53#issuecomment-448353896, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB1HaRRrGpTIL7uFFtTCXRbCBKp0YdVrks5u6UvkgaJpZM4XZY2f.

Seanny123 avatar Dec 18 '18 20:12 Seanny123

Due to a series of embarrassing misunderstandings, I thought 0.0.0.0 and 127.0.0.1 were equivalent. They are not. By changing the code to Bukdu.start(8080, "0.0.0.0") the problem was resolved.

Seanny123 avatar Jan 03 '19 20:01 Seanny123