Browse Source

update Documentation

pull/324/head
Guillaume Vincent 7 years ago
parent
commit
63ca51010c
6 changed files with 52 additions and 101 deletions
  1. +47
    -12
      lesspass.sh
  2. +0
    -73
      letsencrypt.sh
  3. +1
    -1
      nginx
  4. +1
    -1
      openssl
  5. +3
    -3
      readme.md
  6. +0
    -11
      scripts/deploy.sh

+ 47
- 12
lesspass.sh View File

@@ -1,42 +1,77 @@
#!/usr/bin/env bash
set -e

#########
# Check #
#########
OUTPUT_DIR=LessPass
if [ -d "$OUTPUT_DIR" ]
then
echo "LessPass directory exists, move ./LessPass folder and re-run lesspass.sh script"
exit 1
fi
docker --version
docker-compose --version

####################
# Context creation #
####################
mkdir $OUTPUT_DIR
cd $OUTPUT_DIR

curl -o docker-compose.yml https://raw.githubusercontent.com/lesspass/lesspass/master/docker-compose.prod.yml

DATABASE_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)
SECRET_KEY=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)

if [ "$#" -eq "1" ]
if [ "$#" -eq "2" ]
then
DOMAIN=$1
EMAIL=$2
else
echo "Please enter your domain name (e.g. example.org): "
read DOMAIN
echo
echo "Please enter your email (Used to generate an HTTPS certificate with LetsEncrypt):"
read EMAIL
fi

# create env file
DATABASE_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)
SECRET_KEY=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)

cat >> .env << EOF
ALLOWED_HOSTS=.$DOMAIN
DATABASE_PASSWORD=$DATABASE_PASSWORD
SECRET_KEY=$SECRET_KEY
DOMAIN=$DOMAIN
EMAIL=$EMAIL
EOF

# pull new images
#######################
# Docker compose file #
#######################
curl -s -o docker-compose2.yml https://raw.githubusercontent.com/lesspass/lesspass/master/docker-compose.prod.yml
docker-compose pull

# restart container
docker-compose down

###############
# LetsEncrypt #
###############
echo "Create LetsEncrypt certificate..."
mkdir letsencrypt
docker run -it --rm -p 443:443 -p 80:80 -v $PWD/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --quiet --email $EMAIL --agree-tos -d $DOMAIN
docker run -it --rm -v $PWD/letsencrypt/live/:/certificates/ lesspass/openssl openssl dhparam -out /certificates/$DOMAIN/dhparam.pem 4096

############
# LessPass #
############
curl -s -o update.sh https://raw.githubusercontent.com/lesspass/lesspass/master/scripts/update.sh
chmod u+x update.sh
docker-compose up -d
echo "--------------------------------------------"
echo "Congratulation LessPass Database is running!"
echo "--------------------------------------------"
echo "visit https://$DOMAIN"
echo
echo "## Create super user"
echo "see: https://github.com/lesspass/lesspass#create-super-user"
echo
echo "## Update LessPass"
echo "Just run ./update.sh"
echo "It renews the LestEncrypt certificate and updates LessPass"

echo "LessPass Database is now running on $DOMAIN"
echo "If you want to configure an email server for your LessPass Database see: https://github.com/lesspass/lesspass#configure-email"

+ 0
- 73
letsencrypt.sh View File

@@ -1,73 +0,0 @@
#!/usr/bin/env bash

#########
# Check #
#########
OUTPUT_DIR=LessPass
if [ -d "$OUTPUT_DIR" ]
then
echo "LessPass directory exists, move ./LessPass folder and re-run lesspass.sh script"
exit 1
fi

####################
# Context creation #
####################
mkdir $OUTPUT_DIR
cd $OUTPUT_DIR

if [ "$#" -eq "2" ]
then
DOMAIN=$1
EMAIL=$2
else
echo "Please enter your domain name (e.g. example.org): "
read DOMAIN
echo
echo "Please enter your email (Used to generate an HTTPS certificate with LetsEncrypt):"
read EMAIL
fi

DATABASE_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)
SECRET_KEY=$(LC_ALL=C tr -dc A-Za-z0-9_ </dev/urandom | head -c 32)

cat >> .env << EOF
ALLOWED_HOSTS=.$DOMAIN
DATABASE_PASSWORD=$DATABASE_PASSWORD
SECRET_KEY=$SECRET_KEY
DOMAIN=$DOMAIN
EMAIL=$EMAIL
EOF

#######################
# Docker compose file #
#######################
curl -s -o docker-compose.yml https://raw.githubusercontent.com/lesspass/lesspass/master/docker-compose.prod.yml > /dev/null
docker-compose pull
docker-compose down

###############
# LetsEncrypt #
###############
echo "Create LetsEncrypt certificate..."
mkdir letsencrypt
docker run -it --rm -p 443:443 -p 80:80 -v $PWD/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --quiet --email $EMAIL --agree-tos -d $DOMAIN > /dev/null
docker run -it --rm -v $PWD/letsencrypt/live/:/certificates/ lesspass/openssl openssl dhparam -out /certificates/$DOMAIN/dhparam.pem 4096

############
# LessPass #
############
curl -s https://raw.githubusercontent.com/lesspass/lesspass/master/scripts/update.sh > /dev/null
docker-compose up -d
echo "--------------------------------------------"
echo "Congratulation LessPass Database is running!"
echo "--------------------------------------------"
echo "visit https://$DOMAIN"
echo
echo "## Create super user"
echo "see: https://github.com/lesspass/lesspass#create-super-user"
echo
echo "## Update LessPass"
echo "Just run ./update.sh"
echo "It renews the LestEncrypt certificate and updates LessPass"


+ 1
- 1
nginx

@@ -1 +1 @@
Subproject commit 14b33a260f6be16cdf9aeb13ef8b363162953733
Subproject commit ed80a2f89204c8c2c99eb1194586fcc5b3929135

+ 1
- 1
openssl

@@ -1 +1 @@
Subproject commit 59465350039cda18e963410122884304d1c0e0a5
Subproject commit dff766bc06a7447b8e9645956f9ec3768da32e16

+ 3
- 3
readme.md View File

@@ -19,12 +19,13 @@ LessPass open source password manager (https://lesspass.com)
- [frontend](https://github.com/lesspass/frontend) : https://lesspass.com source code
- [move](https://github.com/lesspass/move) : password migration tool for LessPass
- [nginx](https://github.com/lesspass/nginx) : configuration for nginx
- [openssl](https://github.com/lesspass/openssl) : configuration for openssl
- [pure](https://github.com/lesspass/pure) : pure component in vuejs used by cozy, frontend and webextension
- [snap](https://github.com/lesspass/snap) : snap for lesspass-cli
- [web extension](https://github.com/lesspass/webextension) : chrome and firefox web extension for LessPass password manager


## Self Host your LessPass Database
## Self Host your LessPass Database (WIP)

### requirements

@@ -35,10 +36,9 @@ LessPass open source password manager (https://lesspass.com)

simply run

bash <(curl -s https://raw.githubusercontent.com/lesspass/lesspass/master/letsencrypt.sh) [DOMAIN] [EMAIL]
bash <(curl -s https://raw.githubusercontent.com/lesspass/lesspass/master/lesspass.sh) [DOMAIN] [EMAIL]

`[DOMAIN]` and `[EMAIL]` are used to generate a LetsEncrypt certificate and configure LessPass.
If not provided, you'll be asked to enter it.

### create super user



+ 0
- 11
scripts/deploy.sh View File

@@ -1,11 +0,0 @@
#!/bin/bash

export COMPOSE_HTTP_TIMEOUT=600

# pull new images
docker-compose pull

# restart container
docker-compose down
docker-compose up -d
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi

Loading…
Cancel
Save