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

Docker improvements #1142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ FROM ubuntu:${TAG} AS build
### Build stage

# Install curl and git and simplexmq dependencies
RUN apt-get update && apt-get install -y curl git build-essential libgmp3-dev zlib1g-dev llvm-12 llvm-12-dev libnuma-dev libssl-dev
RUN apt-get update && \
apt-get install -y --no-install-recommends curl git ca-certificates build-essential libgmp3-dev zlib1g-dev llvm-12 llvm-12-dev libnuma-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*

# Specify bootstrap Haskell versions
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.6.3
Expand All @@ -21,8 +23,8 @@ ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH"
RUN ghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}" && \
ghcup set cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"

COPY . /project
WORKDIR /project
COPY . .

ARG APP
ARG APP_PORT
Expand All @@ -33,7 +35,6 @@ RUN cabal update
RUN cabal build exe:$APP

# Create new path containing all files needed
RUN mkdir /final
WORKDIR /final

# Strip the binary from debug symbols to reduce size
Expand All @@ -46,7 +47,9 @@ RUN bin=$(find /project/dist-newstyle -name "$APP" -type f -executable) && \
FROM ubuntu:${TAG}

# Install OpenSSL dependency
RUN apt-get update && apt-get install -y openssl libnuma-dev
RUN apt-get update && \
apt-get install -y --no-install-recommends openssl libnuma-dev && \
rm -rf /var/lib/apt/lists/*

# Copy compiled app from build stage
COPY --from=build /final /usr/local/bin/
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,24 @@ On Linux, you can deploy smp and xftp server using Docker. This will download im
simplexchat/xftp-server:latest
```

#### Using Docker Compose

Alternatively you can use Docker Compose to deploy SMP and XFTP servers. In this case the servers store their data in docker volumes rather then the current directory.

1. Download [docker-compose.yml](https://github.com/simplex-chat/simplexmq/blob/stable/docker-compose.yml):

```sh
curl -O https://raw.githubusercontent.com/simplex-chat/simplexmq/stable/docker-compose.yml
```

2. Start the servers:

```sh
ADDR=your_ip_or_domain.com PASS=password QUOTA=100gb docker-compose up -d
```

Environment variables are used only on the first start when server config files are created, you don't need to specify them on subsequent starts.

#### Using installation script

**Please note** that currently, only Ubuntu distribution is supported.
Expand Down
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# You must pass ADDR, PASS and QUOTA as environment variables to docker-compose like so:
# ADDR=your-ip-or-domain.com PASS=p@ssw0rd QUOTA=100gb docker-compose up -d
# Or replace the variables with your own values in the file below

services:
smp:
image: simplexchat/smp-server:latest
environment:
ADDR: ${ADDR}
PASS: ${PASS}
ports:
- 5223:5223
volumes:
- smp_config:/etc/opt/simplex
- smp_logs:/var/opt/simplex

xftp:
image: simplexchat/xftp-server:latest
environment:
ADDR: ${ADDR}
QUOTA: ${QUOTA}
ports:
- 443:443
volumes:
- xftp_config:/etc/opt/simplex-xftp
- xftp_logs:/var/opt/simplex-xftp
- xftp_files:/srv/xftp

volumes:
smp_config:
smp_logs:
xftp_config:
xftp_logs:
xftp_files:
Loading