Let's chat server

by yanother
12 deployments · 9 still active · last rev. 1 year ago

Deploy Let's chat server with Docker on Ubuntu.

Compatible with: No distros currently supported
						#!/bin/bash

aptitude update && aptitude -y upgrade

# Install the latest docker and docker-compose
curl https://gist.githubusercontent.com/wdullaer/f1af16bd7e970389bad3/raw/495717b3518336fbf0ec2113d5228c3bbd5d954a/install.sh |sh -

mkdir -p /var/lets-chat/config
mkdir -p /var/lets-chat/mongo-data
mkdir -p /var/lets-chat/uploads
chmod a+rw /var/lets-chat/uploads

# Write docker-compose.yml
echo 'app:
  image: sdelements/lets-chat
  links:
    - mongo
  ports:
    - 80:8080
    - 5222:5222
  volumes:
    - /var/lets-chat/config:/usr/src/app/config
    - /var/lets-chat/uploads:/usr/src/app/uploads

mongo:
  image: mongo:latest
  volumes:
    - /var/lets-chat/mongo-data:/data/db
' > /var/lets-chat/docker-compose.yml

# Write config for Let's-chat
echo 'auth:
  providers: [local]
  local:
    enableRegistration: true
    passwordRegex: ^.{8,64}$
files:
  enable: true
  provider: local
  maxFileSize: 100000000
  restrictTypes: false
  local:
    dir: uploads
private:
  enable: true
  roster: online # online / all
  expire: 360 # false or number of minutes
' > /var/lets-chat/config/settings.yml


# Register systemd service
mkdir -p /usr/lib/systemd/system

echo '[Unit]
Description=lets-chat-docker
After=network.target remote-fs.target nss-lookup.target
 
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/var/lets-chat
ExecStart=/usr/local/bin/docker-compose up
#ExecReload=/bin/kill -s HUP $MAINPID
#ExecStop=/bin/kill -s QUIT $MAINPID
#PrivateTmp=true
' > /usr/lib/systemd/system/lets-chat-docker.service

systemctl enable lets-chat-docker
systemctl start lets-chat-docker