Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dockerfile to make drone run inside a container #14

Closed
wants to merge 1 commit into from

Conversation

crosbymichael
Copy link

This is just the beginning to get drone running inside a container and talking to a local or remote docker.

@bradrydzewski
Copy link

awesome! some minor suggestions

we should add libsqlite3-dev and sqlite3

RUN apt-get install -y wget gcc make g++ build-essential ca-certificates mercurial git bzr libsqlite3-dev sqlite3

let's use make and make install. this will embed all static assets in the drone binary and serve from memory. make install will add the binaries to /usr/local/bin:

RUN make
RUN make install

make run will create the drone database in /tmp. let's instead invoke drone directly and specify a more permanent database path:

EXPOSE 80
CMD /usr/local/bin/droned --port=":80" --datasource="/var/lib/drone/drone.sqlite"

you mentioned this was just the beginning, so I didn't know if you wanted to make the changes, or you wanted me to merge this PR and I can make them myself. Either way, thanks!

@crosbymichael
Copy link
Author

Thanks i'll make the changes

@whitlockjc
Copy link

By the way, if it means anything, I've taken your PR and merged in these changes requested from @bradrydzewski and I get the following:

cd cmd/droned   && rice embed
/bin/sh: 1: rice: not found
*** [embed] Error 127

It seems that we're not installing everything we need or I've just done something wrong somehow. If I find out what is up before you do, I'll post it here.

@whitlockjc
Copy link

sigh...found it, somehow blew away the "make deps".

@crosbymichael
Copy link
Author

@whitlockjc Feel free to take over and open a new PR with the changes if I don't get to it in time. Not going to hurt my feelings ;)

@whitlockjc
Copy link

I can be patient, no rush on my end. I have been playing with it and I have it working but I did run into an interesting constraint. Using boot2docker (OS X), I run into memory issues when building go due to the tests. It seems to be a known issue. Since it's known to be a problem and we're treating Go as an external dependency, maybe using ./make.bash instead of ./all.bash would make sense. Thoughts?

@crosbymichael
Copy link
Author

Yes, change it to make.bash but you should give b2d more memory.

@bradrydzewski
Copy link

you could also download the pre-compiled Go binaries:

RUN wget http:https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz --quiet && \ 
    tar -C /usr/local -xzf go1.2.linux-amd64.tar.gz && \
    rm go1.2.linux-amd64.tar.gz

and add these env variables

ENV GOROOT /usr/local/go
ENV GOPATH /gocode
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin

@proppy proppy mentioned this pull request Feb 13, 2014
@whitlockjc
Copy link

Would you rather binaries or source build? I have it working now, although I did run into some OS X specific stuff with VirtualBox and port forwarding port 80.

@crosbymichael
Copy link
Author

@whitlockjc I think the binaries would be fine

@whitlockjc
Copy link

Here is my current version:

FROM ubuntu:13.10

RUN apt-get update
RUN apt-get install -y wget gcc make g++ build-essential ca-certificates mercurial git bzr libsqlite3-dev sqlite3

RUN wget https://go.googlecode.com/files/go1.2.src.tar.gz && tar zxvf go1.2.src.tar.gz && cd go/src && ./make.bash 

ENV PATH $PATH:/go/bin:/gocode/bin
ENV GOPATH /gocode

RUN mkdir -p /gocode/src/github.com/drone

ADD . /gocode/src/github.com/drone/drone

WORKDIR /gocode/src/github.com/drone/drone

RUN make deps
RUN make
RUN make install

EXPOSE 80

CMD ["/usr/local/bin/droned", "--port=:80", "--path=/var/lib/drone/drone.sqlite"]

This works and it includes the changes mentioned above, although it still builds go 1.2 from source instead of using a binary. On OS X, you have to use port forwarding when you run the container to work around the inability of VirtualBox.app to forward ports less than 1024 like this docker run -p 8080:80 whitlockjc/drone. Since @crosbymichael did the heavy lifting, I will not create a new pull request.

@crosbymichael
Copy link
Author

@whitlockjc I would add /usr/local/bin/droned as the ENTRYPOINT and then the default args as the CMD

@whitlockjc
Copy link

Done. A quick question: Why would Docker fail to run drone when drone is listening on port 80 but it runs fine with the default port 8080? When I say "fail to run", when I run the container configured to connect on port 80 and port forward 80->8080 on the host, I get no data back. If I run the same container but tell drone to listen on port 8080 instead of 80 and then port forward 8080->8080 on the host, I get the page back. I'm on OS X so this could be a boot2docker on OS X ism.

Here is the current iteration:

FROM ubuntu:13.10

RUN apt-get update
RUN apt-get install -y wget gcc make g++ build-essential ca-certificates mercurial git bzr libsqlite3-dev sqlite3

RUN wget https://go.googlecode.com/files/go1.2.src.tar.gz && tar zxvf go1.2.src.tar.gz && cd go/src && ./make.bash 

ENV PATH $PATH:/go/bin:/gocode/bin
ENV GOPATH /gocode

RUN mkdir -p /gocode/src/github.com/drone

ADD . /gocode/src/github.com/drone/drone

WORKDIR /gocode/src/github.com/drone/drone

RUN make deps
RUN make
RUN make install

EXPOSE 80

ENTRYPOINT ["/usr/local/bin/droned"]

CMD ["--port=:80", "--path=/var/lib/drone/drone.sqlite"]

@crosbymichael
Copy link
Author

Closing so @whitlockjc can take this over, sorry i don't have time right now

johannesHarness added a commit that referenced this pull request Sep 26, 2023
…, but log and return. Also adds some more validations for path creation and resource moving. Add accesslogging for git and api router (#14)

This commit contains the following:
- Improve and simplify error handling (remove unnecessary wrappers, make it feel like go)
- Add extra validation for path creation and resource moving (path has to be within same top space, no top space alias allowed)
- Add access logging for rest api and git api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants