From cb5fa69d8b42325fdf490f9509f35a7bf48cc719 Mon Sep 17 00:00:00 2001 From: obenjiro Date: Thu, 5 May 2022 14:24:35 +0300 Subject: [PATCH 1/2] docker-compose for comby-server --- Dockerfile | 12 +++++++++++ Makefile | 3 +++ README.md | 52 +++++++++++++++++++++++++++------------------- docker-compose.yml | 21 +++++++++++++++++++ nginx.conf | 13 ++++++++++++ 5 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb32d00 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM ocaml/opam +WORKDIR /home/app + +COPY . /home/app/ + +RUN sudo apt-get install libgmp-dev pkg-config libpcre3-dev -y + +RUN opam install . --deps-only -y +RUN eval $(opam env) +RUN eval $(opam config env) +RUN make +RUN make install diff --git a/Makefile b/Makefile index 458501d..6242ef6 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +PATH := /home/opam/.opam/4.14/bin:$(PATH) +SHELL := /bin/bash + all: build build: diff --git a/README.md b/README.md index e6ab65c..13a9b6d 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,11 @@ -# Install +# Quick Start -First build and install `comby` from source: +To start comby-server clone this repository and run docker-compose ```bash git clone https://github.com/comby-tools/comby -cd comby && opam install . --deps-only -y -eval $(opam env) -make -make install -cd .. -``` - -Then build and install `comby-server` (this repository): - -```bash -git clone https://github.com/comby-tools/comby-server -cd comby-server && opam install . --deps-only -y -make -``` - -You can now run: - -``` -./comby-server +cd comby +docker-compose up ``` You can test that the server is working by running this command in a separate terminal: @@ -59,5 +42,32 @@ You should see the response: } ``` +# Install + +First build and install `comby` from source: + +```bash +git clone https://github.com/comby-tools/comby +cd comby && opam install . --deps-only -y +eval $(opam env) +make +make install +cd .. +``` + +Then build and install `comby-server` (this repository): + +```bash +git clone https://github.com/comby-tools/comby-server +cd comby-server && opam install . --deps-only -y +make +``` + +You can now run: + +``` +./comby-server +``` + See server options (port, interface, etc.) by typing `comby-server --help`. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b8661e8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3' + +services: + comby-server: + scale: 3 + build: + context: . + dockerfile: Dockerfile + working_dir: /home/app + restart: unless-stopped + expose: + - "3000" + command: ./comby-server + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - comby-server + ports: + - "3333:3333" \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..4e31961 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,13 @@ +user nginx; + +events { + worker_connections 1000; +} +http { + server { + listen 3333; + location / { + proxy_pass http://comby-server:3000; + } + } +} \ No newline at end of file From f6b24a4198d02efe26878a34e67f45cd93efbd5a Mon Sep 17 00:00:00 2001 From: obenjiro Date: Tue, 1 Aug 2023 16:33:17 +0300 Subject: [PATCH 2/2] opam/4.14 --- Dockerfile | 16 ++++++++++------ Makefile | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb32d00..68d6e9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,16 @@ -FROM ocaml/opam +FROM ocaml/opam:ubuntu-18.04-ocaml-4.12 + WORKDIR /home/app -COPY . /home/app/ +RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam +RUN opam init --reinit -ni +RUN mkdir -p /home/opam/dune/_boot /home/opam/dune/_build && chown opam:opam /home/opam/dune/_boot /home/opam/dune/_build +RUN sudo apt-get install git libgmp-dev pkg-config libpcre3-dev -y -RUN sudo apt-get install libgmp-dev pkg-config libpcre3-dev -y +COPY . /home/app/ +RUN git config --global --add safe.directory /home/app RUN opam install . --deps-only -y RUN eval $(opam env) -RUN eval $(opam config env) -RUN make -RUN make install +RUN eval $(opam env) && make +RUN eval $(opam env) && make install diff --git a/Makefile b/Makefile index 6242ef6..c326fa3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PATH := /home/opam/.opam/4.14/bin:$(PATH) +PATH := /home/opam/.opam/4.14.0/bin:$(PATH) SHELL := /bin/bash all: build