commit
fd25da5592
@ -1,7 +0,0 @@
|
|||||||
data
|
|
||||||
Dockerfile
|
|
||||||
docker-compose.yml
|
|
||||||
.dockerignore
|
|
||||||
.git
|
|
||||||
.gitignore
|
|
||||||
node_modules
|
|
@ -1,4 +0,0 @@
|
|||||||
VERSION=latest
|
|
||||||
USE_SSL=true
|
|
||||||
STORAGE='./storage/file'
|
|
||||||
LOG_TO_STDOUT=true
|
|
@ -1,11 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- soon
|
|
||||||
- staging
|
|
||||||
node_js:
|
|
||||||
- "6.6.0"
|
|
||||||
script:
|
|
||||||
- npm run-script lint
|
|
||||||
- docker build -t xwiki/cryptpad .
|
|
@ -1,45 +0,0 @@
|
|||||||
# We use multi stage builds
|
|
||||||
FROM node:12-stretch-slim AS build
|
|
||||||
|
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq git jq python curl
|
|
||||||
RUN npm install -g bower
|
|
||||||
|
|
||||||
# install tini in this stage to avoid the need of jq and python
|
|
||||||
# in the final image
|
|
||||||
ADD docker-install-tini.sh /usr/local/bin/docker-install-tini.sh
|
|
||||||
RUN /usr/local/bin/docker-install-tini.sh
|
|
||||||
|
|
||||||
COPY . /cryptpad
|
|
||||||
WORKDIR /cryptpad
|
|
||||||
|
|
||||||
RUN npm install --production \
|
|
||||||
&& npm install -g bower \
|
|
||||||
&& bower install --allow-root
|
|
||||||
|
|
||||||
FROM node:12-stretch-slim
|
|
||||||
|
|
||||||
# You want USE_SSL=true if not putting cryptpad behind a proxy
|
|
||||||
ENV USE_SSL=false
|
|
||||||
ENV STORAGE="'./storage/file'"
|
|
||||||
ENV LOG_TO_STDOUT=true
|
|
||||||
|
|
||||||
# Persistent storage needs
|
|
||||||
VOLUME /cryptpad/cfg
|
|
||||||
VOLUME /cryptpad/datastore
|
|
||||||
VOLUME /cryptpad/customize
|
|
||||||
VOLUME /cryptpad/blobstage
|
|
||||||
VOLUME /cryptpad/block
|
|
||||||
VOLUME /cryptpad/blob
|
|
||||||
VOLUME /cryptpad/data
|
|
||||||
|
|
||||||
# Copy cryptpad and tini from the build container
|
|
||||||
COPY --from=build /sbin/tini /sbin/tini
|
|
||||||
COPY --from=build /cryptpad /cryptpad
|
|
||||||
|
|
||||||
WORKDIR /cryptpad
|
|
||||||
|
|
||||||
# Unsafe / Safe ports
|
|
||||||
EXPOSE 3000 3001
|
|
||||||
|
|
||||||
# Run cryptpad on startup
|
|
||||||
CMD ["/sbin/tini", "--", "/cryptpad/container-start.sh"]
|
|
@ -1,27 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Creating customize folder
|
|
||||||
mkdir -p customize
|
|
||||||
|
|
||||||
# Copying default config
|
|
||||||
mkdir -p cfg
|
|
||||||
[ ! -f cfg/config.js ] && echo "Creating config.js" && cp config/config.example.js cfg/config.js
|
|
||||||
|
|
||||||
# Linking config.js
|
|
||||||
[ ! -L config/config.js ] && echo "Linking config.js" && ln -s ../cfg/config.js config/config.js
|
|
||||||
|
|
||||||
|
|
||||||
# Thanks to http://stackoverflow.com/a/10467453
|
|
||||||
sedeasy() {
|
|
||||||
sed -i "s/$1/$(echo $2 | sed -e 's/[\/&]/\\&/g')/g" $3
|
|
||||||
}
|
|
||||||
|
|
||||||
# Configure
|
|
||||||
[ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
|
|
||||||
&& sedeasy "storage: [^,]*," "storage: ${STORAGE}," cfg/config.js
|
|
||||||
|
|
||||||
[ -n "$LOG_TO_STDOUT" ] && echo "Logging to stdout: $LOG_TO_STDOUT" \
|
|
||||||
&& sedeasy "logToStdout: [^,]*," "logToStdout: ${LOG_TO_STDOUT}," cfg/config.js
|
|
||||||
|
|
||||||
export FRESH=1
|
|
||||||
exec node ./server.js
|
|
@ -1,31 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
services:
|
|
||||||
|
|
||||||
cryptpad:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
args:
|
|
||||||
- VERSION=${VERSION}
|
|
||||||
image: "xwiki/cryptpad:${VERSION}"
|
|
||||||
hostname: cryptpad
|
|
||||||
|
|
||||||
labels:
|
|
||||||
- traefik.port=3000
|
|
||||||
- traefik.frontend.passHostHeader=true
|
|
||||||
environment:
|
|
||||||
- USE_SSL=${USE_SSL}
|
|
||||||
- STORAGE=${STORAGE}
|
|
||||||
- LOG_TO_STDOUT=${LOG_TO_STDOUT}
|
|
||||||
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
- "3001:3001"
|
|
||||||
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- ./data/files:/cryptpad/datastore:rw
|
|
||||||
- ./data/customize:/cryptpad/customize:rw
|
|
||||||
- ./data/blob:/cryptpad/blob:rw
|
|
||||||
- ./data/block:/cryptpad/block:rw
|
|
||||||
- ./data/config:/cryptpad/cfg:rw
|
|
||||||
- ./data/data:/cryptpad/data:rw
|
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Figure out latest release via GitHub API
|
|
||||||
release=$(curl --silent "https://api.github.com/repos/krallin/tini/releases/latest" | jq -r .tag_name)
|
|
||||||
|
|
||||||
# _Reliable_ way to get which arch for tini download
|
|
||||||
arch=$(python <<EOF
|
|
||||||
from __future__ import print_function
|
|
||||||
import platform
|
|
||||||
processor = platform.machine()
|
|
||||||
if processor == 'aarch64':
|
|
||||||
print('arm64', end='')
|
|
||||||
elif processor == 'x86 64' or processor == 'x86_64':
|
|
||||||
print('amd64', end='')
|
|
||||||
elif processor == 'armv7l':
|
|
||||||
print('armhf', end='')
|
|
||||||
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
# Download/install tini
|
|
||||||
curl -L https://github.com/krallin/tini/releases/download/$release/tini-static-$arch \
|
|
||||||
-o /sbin/tini
|
|
||||||
chmod a+x /sbin/tini
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
# Cryptpad Docker Image
|
|
||||||
|
|
||||||
Cryptpad includes support for building a Docker image and running it to provide a Cryptpad instance. You can manage the container manually, or let Docker Compose manage it for you.
|
|
||||||
|
|
||||||
A full tutorial is available [on the Cryptpad Github wiki](https://github.com/xwiki-labs/cryptpad/wiki/Docker). This document provides a brief overview.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Configuration via .env file
|
|
||||||
- Ready for use with traffic
|
|
||||||
- Using github master for now, release 0.3.0 too old
|
|
||||||
- Creating customize folder
|
|
||||||
- Adding config.js to customize folder
|
|
||||||
- Persistance for datastore and customize folder
|
|
||||||
|
|
||||||
## Run
|
|
||||||
|
|
||||||
Run from the cryptpad source directory, keeping instance state in `/var/cryptpad`:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build -t xwiki/cryptpad .
|
|
||||||
docker run --restart=always -d --name cryptpad -p 3000:3000 -p 3001:3001 \
|
|
||||||
-v /var/cryptpad/files:/cryptpad/datastore \
|
|
||||||
-v /var/cryptpad/customize:/cryptpad/customize \
|
|
||||||
-v /var/cryptpad/blob:/cryptpad/blob \
|
|
||||||
-v /var/cryptpad/blobstage:/cryptpad/blobstage \
|
|
||||||
-v /var/cryptpad/pins:/cryptpad/pins \
|
|
||||||
-v /var/cryptpad/tasks:/cryptpad/tasks \
|
|
||||||
-v /var/cryptpad/block:/cryptpad/block \
|
|
||||||
xwiki/cryptpad
|
|
||||||
```
|
|
||||||
|
|
||||||
Or, using docker-compose and the included `docker-compose.yml`, keeping instance state in the current directory under `./data`:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Set configurations Dockerfile or in .env (using docker-compose) file.
|
|
||||||
|
|
||||||
- VERSION=latest
|
|
||||||
- USE_SSL=false
|
|
||||||
- STORAGE='./storage/file'
|
|
||||||
- LOG_TO_STDOUT=true
|
|
||||||
|
|
||||||
The .env variables are read by docker-compose and forwarded to docker container.
|
|
||||||
On runtime, in `bin/container-start.sh` the settings are written to the `config.js` file.
|
|
||||||
|
|
||||||
|
|
||||||
## Persistance
|
|
||||||
|
|
||||||
The docker-compose file is preconfigured to persist folders
|
|
||||||
|
|
||||||
- cryptpad/datastore --> ./data/files
|
|
||||||
- cryptpad/customize --> ./data/customize
|
|
||||||
- cryptpad/pins --> ./data/pins
|
|
||||||
- cryptpad/blob --> ./data/blob
|
|
||||||
- cryptpad/blobstage --> ./data/blobstage
|
|
||||||
- cryptpad/tasks --> ./data/tasks
|
|
||||||
- cryptpad/block --> ./data/block
|
|
||||||
|
|
||||||
Your configuration file will be in `./data/customize/config.js`.
|
|
||||||
|
|
||||||
The data folder is ignored by git, so if you want to add your customizations to git versioning change the volume:
|
|
||||||
|
|
||||||
```
|
|
||||||
./customize:/cryptpad/customize:rw
|
|
||||||
```
|
|
||||||
|
|
||||||
## SSL Proxy
|
|
||||||
|
|
||||||
The [traefik](https://traefik.io/) proxy has builtin Let'sEncrypt for easy SSL setup.
|
|
||||||
In the docker-compose file you can find preset lables for usage with traefik.
|
|
||||||
|
|
||||||
[Traefik Docker Image](https://hub.docker.com/_/traefik/)
|
|
||||||
|
|
||||||
Alternativly just use plain old nginx.
|
|
Loading…
Reference in New Issue