Add Docker workflow to hacking options (#37)
* Adds Dockerfile & docker-compose.yml * Additions to documentation Thanks to @pataquets for the PR!
This commit is contained in:
parent
da7f91b6b9
commit
6c084ca985
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
FROM gcc
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
apt-get update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get -y install \
|
||||||
|
cmake \
|
||||||
|
libboost-program-options-dev \
|
||||||
|
libboost-thread-dev \
|
||||||
|
libevent-dev \
|
||||||
|
libgtest-dev \
|
||||||
|
libsqlite3-dev \
|
||||||
|
&& \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
mkdir -vp /tmp/.build && cd /tmp/.build && \
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=RELEASE /usr/src/gtest/ && \
|
||||||
|
make && \
|
||||||
|
mv -v libgtest* /usr/lib/ && \
|
||||||
|
rm -vrf /tmp/.build && cd -
|
||||||
|
|
||||||
|
COPY . /usr/src/udpt
|
||||||
|
WORKDIR /usr/src/udpt
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release . && \
|
||||||
|
make udpt -j8
|
||||||
|
|
||||||
|
ENTRYPOINT [ "./udpt", "--interactive" ]
|
7
docker-compose.yml
Normal file
7
docker-compose.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
udpt:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 6969:6969/udp
|
||||||
|
- 127.0.0.1:8081:8081
|
||||||
|
volumes:
|
||||||
|
- ./udpt.conf:/etc/udpt.conf:ro
|
|
@ -68,6 +68,35 @@ This should leave you with a udpt executable file, and optionally a udpt_tests e
|
||||||
|
|
||||||
If everything succeeded, head over to :doc:`udpt.conf` and get your tracker running!
|
If everything succeeded, head over to :doc:`udpt.conf` and get your tracker running!
|
||||||
|
|
||||||
|
Building with Docker
|
||||||
|
====================
|
||||||
|
Complete working Docker workflow is possible allowing you to start hacking and building without any other requirements or dependencies. All the required libs and build tools are handled by Docker build process.
|
||||||
|
|
||||||
|
Using the provided Dockerfile you can build a complete working image with all the required dependencies.
|
||||||
|
|
||||||
|
If you're not familiar with Docker, better use Docker Compose to both build and run your source easy and effortlessly.
|
||||||
|
|
||||||
|
From the ``docker-compose.yml`` directory, run::
|
||||||
|
|
||||||
|
docker-compose up --build
|
||||||
|
|
||||||
|
Skip the ``--build`` switch to launch the last built container image without rebuilding again.
|
||||||
|
|
||||||
|
The provided ``docker-compose.yml`` file is configured to:
|
||||||
|
|
||||||
|
* Expose daemon's ports to host (using port's defaults). API server is only exposed on 127.0.0.1 to the Docker host.
|
||||||
|
* Mount your host's ``udpt.conf`` from your source tree inside the container at ``/etc/udpt.conf`` (read-only).
|
||||||
|
* Start with the ``--interactive`` switch to avoid forking to background, as required with Docker.
|
||||||
|
|
||||||
|
To run udpt inside a Docker container, you need to:
|
||||||
|
|
||||||
|
* Configure logging to ``/dev/stdout`` to send the program's messages to Docker's standard logging.
|
||||||
|
* Configure API server to listen to 0.0.0.0 inside the container to be able to contact it from your development host, that is from outside the container.
|
||||||
|
|
||||||
|
See the ``docker-compose.yml`` to view and tweak the launch parameters.
|
||||||
|
|
||||||
|
Stop the container by ``CTRL+C``'ing it.
|
||||||
|
|
||||||
Building for Windows
|
Building for Windows
|
||||||
====================
|
====================
|
||||||
.. note:: This documentation is a work-in-progress. Stay tuned!
|
.. note:: This documentation is a work-in-progress. Stay tuned!
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <event2/http.h>
|
#include <event2/http.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include "db/database.hpp"
|
#include "db/database.hpp"
|
||||||
|
|
||||||
|
@ -79,4 +80,4 @@ namespace UDPT
|
||||||
static void sendReply(struct ::evhttp_request *req, int code, const char *reason, const std::string &response);
|
static void sendReply(struct ::evhttp_request *req, int code, const char *reason, const std::string &response);
|
||||||
static void sendReply(struct ::evhttp_request *req, int code, const char *reason, const char *response, size_t len);
|
static void sendReply(struct ::evhttp_request *req, int code, const char *reason, const char *response, size_t len);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue