From 7fa9017d25ec7b83e5f4e411f6757d15613dd7b1 Mon Sep 17 00:00:00 2001 From: Jeremiah Butler Date: Thu, 18 Mar 2021 15:53:38 +0000 Subject: [PATCH 1/5] add docker-compose --- .gitignore | 2 ++ docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ Dockerfile => docker/Dockerfile | 6 +++--- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml rename Dockerfile => docker/Dockerfile (82%) diff --git a/.gitignore b/.gitignore index 0d5f77bdf..9d4e97e15 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ webapp/cypress/videos server/swagger/clients server/vendor .idea +certs +data diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..a0010728a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3" +services: + app: + build: + context: ./docker + container_name: focalboard + expose: + - 8000 + environment: + - VIRTUAL_HOST=focalboard.local + - VIRTUAL_PORT=8000 + + proxy: + image: jwilder/nginx-proxy:latest + container_name: focalboard-proxy + ports: + - 443:443 + volumes: + - "./certs:/etc/nginx/certs:ro" + - "/var/run/docker.sock:/tmp/docker.sock:ro" + + postgres: + image: postgres:latest + container_name: focalboard-postgres + restart: always + volumes: + - "./data:/var/lib/postgresql/data" + environment: + POSTGRES_DB: boards + POSTGRES_USER: boarduser + POSTGRES_PASSWORD: board-password + diff --git a/Dockerfile b/docker/Dockerfile similarity index 82% rename from Dockerfile rename to docker/Dockerfile index 9ccb5988b..50b3a8085 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM ubuntu:latest +FROM ubuntu:20.04 # Make sure that the underlying container is patched to the latest versions -RUN apt update && \ - apt install -y wget tar gzip unzip file +RUN apt-get update && \ + apt-get install -y wget tar unzip gzip file # Now install Focalboard as a seperate layer RUN wget https://releases.mattermost.com/focalboard/0.5.0/focalboard-server-linux-amd64.tar.gz && \ From 08b2bf4bf3b721ebb2e71cefa82e685c83fe3817 Mon Sep 17 00:00:00 2001 From: Jeremiah Butler Date: Thu, 18 Mar 2021 14:17:56 -0400 Subject: [PATCH 2/5] update compose for single and nginx solution --- docker-compose-db-nginx.yml | 32 ++++++++++++++++++++++++++++++++ docker-compose.yml | 24 ++---------------------- 2 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 docker-compose-db-nginx.yml diff --git a/docker-compose-db-nginx.yml b/docker-compose-db-nginx.yml new file mode 100644 index 000000000..a0010728a --- /dev/null +++ b/docker-compose-db-nginx.yml @@ -0,0 +1,32 @@ +version: "3" +services: + app: + build: + context: ./docker + container_name: focalboard + expose: + - 8000 + environment: + - VIRTUAL_HOST=focalboard.local + - VIRTUAL_PORT=8000 + + proxy: + image: jwilder/nginx-proxy:latest + container_name: focalboard-proxy + ports: + - 443:443 + volumes: + - "./certs:/etc/nginx/certs:ro" + - "/var/run/docker.sock:/tmp/docker.sock:ro" + + postgres: + image: postgres:latest + container_name: focalboard-postgres + restart: always + volumes: + - "./data:/var/lib/postgresql/data" + environment: + POSTGRES_DB: boards + POSTGRES_USER: boarduser + POSTGRES_PASSWORD: board-password + diff --git a/docker-compose.yml b/docker-compose.yml index a0010728a..8ac8259f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,29 +4,9 @@ services: build: context: ./docker container_name: focalboard - expose: - - 8000 + ports: + - 80:8000 environment: - VIRTUAL_HOST=focalboard.local - VIRTUAL_PORT=8000 - - proxy: - image: jwilder/nginx-proxy:latest - container_name: focalboard-proxy - ports: - - 443:443 - volumes: - - "./certs:/etc/nginx/certs:ro" - - "/var/run/docker.sock:/tmp/docker.sock:ro" - - postgres: - image: postgres:latest - container_name: focalboard-postgres - restart: always - volumes: - - "./data:/var/lib/postgresql/data" - environment: - POSTGRES_DB: boards - POSTGRES_USER: boarduser - POSTGRES_PASSWORD: board-password From f204a7fd927d3a6261e49875282ac549acd2e99e Mon Sep 17 00:00:00 2001 From: Jeremiah Butler Date: Thu, 18 Mar 2021 20:35:54 -0400 Subject: [PATCH 3/5] update docker-compose and add README --- .gitignore | 4 +-- docker/README.md | 30 +++++++++++++++++++ docker/config.json | 16 ++++++++++ .../docker-compose-db-nginx.yml | 10 ++++--- .../docker-compose.yml | 0 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 docker/README.md create mode 100644 docker/config.json rename docker-compose-db-nginx.yml => docker/docker-compose-db-nginx.yml (76%) rename docker-compose.yml => docker/docker-compose.yml (100%) diff --git a/.gitignore b/.gitignore index 9d4e97e15..f006d39e3 100644 --- a/.gitignore +++ b/.gitignore @@ -62,5 +62,5 @@ webapp/cypress/videos server/swagger/clients server/vendor .idea -certs -data +docker/certs +docker/data diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..18c1de9be --- /dev/null +++ b/docker/README.md @@ -0,0 +1,30 @@ +# Deploy Focalboard with Docker + +## Docker + +The Dockerfile gives a quick and easy way to pull the latest Focalboard server and deploy it locally. + +``` +docker build -t focalboard . +docker run -it -p 80:8000 focalboard +``` + +Open a browser to http://localhost to start + +## Docker-Compose + +Docker-Compose provides the option to automate the build and run step, or even include some of the steps from the [personal server setup](https://www.focalboard.com/download/personal-edition/ubuntu/). + +To start the server run + +``` +docker-compose up +``` + +This will automatically build the focalboard image and start it with the http port mapping. + +To run focalboard with a nginx proxy and a postgres backend run + +``` +docker-compose -f docker-compose-db-nginx.yml up +``` diff --git a/docker/config.json b/docker/config.json new file mode 100644 index 000000000..b6471e882 --- /dev/null +++ b/docker/config.json @@ -0,0 +1,16 @@ +{ + "serverRoot": "http://localhost:8000", + "port": 8000, + "dbtype": "postgres", + "dbconfig": "postgres://boardsuser:boardsuser-password@focalboard-db/boards?sslmode=disable&connect_timeout=10", + "postgres_dbconfig": "dbname=boards sslmode=disable", + "useSSL": false, + "webpath": "./pack", + "filespath": "./files", + "telemetry": true, + "session_expire_time": 2592000, + "session_refresh_time": 18000, + "localOnly": false, + "enableLocalMode": true, + "localModeSocketLocation": "/var/tmp/focalboard_local.socket" +} diff --git a/docker-compose-db-nginx.yml b/docker/docker-compose-db-nginx.yml similarity index 76% rename from docker-compose-db-nginx.yml rename to docker/docker-compose-db-nginx.yml index a0010728a..4602b5e1a 100644 --- a/docker-compose-db-nginx.yml +++ b/docker/docker-compose-db-nginx.yml @@ -2,13 +2,15 @@ version: "3" services: app: build: - context: ./docker + context: ./ container_name: focalboard expose: - 8000 environment: - VIRTUAL_HOST=focalboard.local - VIRTUAL_PORT=8000 + volumes: + - "./config.json:/opt/focalboard/config.json" proxy: image: jwilder/nginx-proxy:latest @@ -19,7 +21,7 @@ services: - "./certs:/etc/nginx/certs:ro" - "/var/run/docker.sock:/tmp/docker.sock:ro" - postgres: + focalboard-db: image: postgres:latest container_name: focalboard-postgres restart: always @@ -27,6 +29,6 @@ services: - "./data:/var/lib/postgresql/data" environment: POSTGRES_DB: boards - POSTGRES_USER: boarduser - POSTGRES_PASSWORD: board-password + POSTGRES_USER: boardsuser + POSTGRES_PASSWORD: boardsuser-password diff --git a/docker-compose.yml b/docker/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to docker/docker-compose.yml From d26aa73b323e45b9f9da6289bb5c495966df2a0b Mon Sep 17 00:00:00 2001 From: Jeremiah Butler Date: Thu, 18 Mar 2021 20:38:02 -0400 Subject: [PATCH 4/5] reorder dockerfile install to alphabetize --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 50b3a8085..0cbc54cc8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:20.04 # Make sure that the underlying container is patched to the latest versions RUN apt-get update && \ - apt-get install -y wget tar unzip gzip file + apt-get install -y file gzip tar unzip wget # Now install Focalboard as a seperate layer RUN wget https://releases.mattermost.com/focalboard/0.5.0/focalboard-server-linux-amd64.tar.gz && \ From 9d26fac6164dfd887c4e414e66a825ca46811da1 Mon Sep 17 00:00:00 2001 From: Jeremiah Butler Date: Fri, 19 Mar 2021 11:15:20 -0400 Subject: [PATCH 5/5] update docker-compose for dependency handling --- docker/docker-compose-db-nginx.yml | 2 ++ docker/docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose-db-nginx.yml b/docker/docker-compose-db-nginx.yml index 4602b5e1a..c6db79fa4 100644 --- a/docker/docker-compose-db-nginx.yml +++ b/docker/docker-compose-db-nginx.yml @@ -4,6 +4,8 @@ services: build: context: ./ container_name: focalboard + depends_on: + - focalboard-db expose: - 8000 environment: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8ac8259f1..d32265f49 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3" services: app: build: - context: ./docker + context: ./ container_name: focalboard ports: - 80:8000