Skip to content
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
58 changes: 31 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,37 @@ We have packaged things up to run easily with [Vagrant](https://www.vagrantup.co

If anything in this guide is not accurate or if you run into any issues installing & running LaunchKit, please send us a pull request. No one is actively addressing bug reports, but we will happily review and integrate pull requests.

## Getting Started - Docker

### Step 1

Install Docker. You can find installation instructions at https://docs.docker.com/install/

### Step 2

Install Docker Compose. You can find installation instructions at https://docs.docker.com/compose/install/

### Step 3

Get the LaunchKit code and configure your LK settings.

$ git clone https://github.com/LaunchKit/LaunchKit.git
$ cd LaunchKit

### Step 4

**NOTE 1.** Before running LaunchKit, you can edit `docker-compose.yml` file to change SMTP and SLACK configuration.

**NOTE 2.** In this step, you will be using prebuilt docker images from Docker Hub. You can build images on your own using `build_images.sh` script.

Run Launchkit

$ docker-compose up -d

### Step 5

Navigate to http://localhost:9100/

## Getting Started - Vagrant

Getting your LK instance up and running is fairly simple. This process has been tested thoroughly on **Mac OS 10.11**, but should also work on other systems compatible with Vagrant, VirtualBox and Ansible.
Expand Down Expand Up @@ -86,33 +117,6 @@ If you're never going to use LaunchKit again, you can destroy the machine altoge

$ vagrant destroy

## Getting Started - Docker

### Step 1

Install Docker. You can find installation instructions here: https://docs.docker.com/install/

### Step 2

Install Docker Compose. You can find installation instructions here: https://docs.docker.com/compose/install/

### Step 3

Get the LaunchKit code and configure your LK settings.

$ git clone https://github.com/LaunchKit/LaunchKit.git
$ cd LaunchKit

### Step 4

Run Launchkit

$ docker-compose up -d

It might take some time to initialize all components.

Navigate to http://localhost:9100/

## System Configuration

LaunchKit will work largely out of the box, but each service has some **external dependencies** that you will need to configure if you wish the service to work properly.
Expand Down
4 changes: 2 additions & 2 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

# If you want email to work, configure an SMTP server here.

EMAIL_SMTP_HOST = None # eg. "smtp.sendgrid.com"
EMAIL_SMTP_HOST = None # eg. "smtp.sendgrid.com"
EMAIL_SMTP_USER = None
EMAIL_SMTP_PASSWORD = None
EMAIL_FROM_DOMAIN = "yoursite.com"
Expand Down Expand Up @@ -105,7 +105,7 @@
BETA_LINK_SECRET = '00000000000000000000000000000000' # must be 32 hex chars
UNSUB_SUB_NOTIFY_SECRET = '00000000000000000000000000000000' # must be 32 hex chars

ENCRYPTED_ID_KEY_IV = '0000000000000000' # must be 16 hex chars
ENCRYPTED_ID_KEY_IV = '0000000000000000' # must be 16 hex chars

COOKIE_SECRET_KEY = '00000000000000000000000000000000' # arbitrary secret

Expand Down
15 changes: 15 additions & 0 deletions build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

VERSION=1.0.0
# Docker gives by default 2gb of RAM for Docker containers
# But building lxml library takes more memory and causes OOM,
# This option helps speed up the build and avoid OOM
MEMORY_LIMIT=4g

docker build -f docker/Dockerfile.base -t launchkit-base -m ${MEMORY_LIMIT} .
docker build -f docker/Dockerfile.backend -t viktorkifer/launchkit-app:${VERSION} -m ${MEMORY_LIMIT} .
docker build -f docker/Dockerfile.gae -t viktorkifer/launchkit-gae:${VERSION} -m ${MEMORY_LIMIT} .
docker build -f docker/Dockerfile.reviews -t viktorkifer/launchkit-reviews:${VERSION} -m ${MEMORY_LIMIT} .
docker build -f docker/Dockerfile.skit -t viktorkifer/launchkit-skit:${VERSION} -m ${MEMORY_LIMIT} .
docker build -f docker/Dockerfile.postgres -t viktorkifer/launchkit-postgres-hstore:${VERSION} -m ${MEMORY_LIMIT} .
docker rmi -f launchkit-base
54 changes: 38 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
version: '2.1'
version: '2.2'

networks:
lk-shared:
driver: local

volumes:
db-volume:
Expand All @@ -8,9 +12,7 @@ volumes:

services:
backend:
build:
context: .
dockerfile: docker/Dockerfile.backend
image: viktorkifer/launchkit-app:1.0.0
restart: unless-stopped
environment:
PORT: 9101
Expand All @@ -19,8 +21,17 @@ services:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
REDIS_URL: redis://redis:6379/0
SECRET_KEY: CYtDmKetk7QbsCWgSyLWIRo1V57mGXsP
SECRET_KEY: MySecretKey
C_FORCE_ROOT: "true"
# these are optional
EMAIL_SMTP_HOST:
EMAIL_SMTP_USER:
EMAIL_SMTP_PASSWORD:
EMAIL_FROM_DOMAIN: yoursite.com
SLACK_CLIENT_ID:
SLACK_CLIENT_SECRET:
networks:
- lk-shared
depends_on:
postgres:
condition: service_healthy
Expand All @@ -37,12 +48,12 @@ services:
retries: 6

gae:
build:
context: .
dockerfile: docker/Dockerfile.gae
image: viktorkifer/launchkit-gae:1.0.0
restart: unless-stopped
environment:
SERVER_SOFTWARE: Dev
networks:
- lk-shared
volumes:
- gae-storage:/usr/src/app/.dev_gae_storage
ports:
Expand All @@ -55,9 +66,7 @@ services:
retries: 6

reviews:
build:
context: .
dockerfile: docker/Dockerfile.reviews
image: viktorkifer/launchkit-reviews:1.0.0
restart: unless-stopped
environment:
PORT: 9101
Expand All @@ -66,24 +75,33 @@ services:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
REDIS_URL: redis://redis:6379/0
SECRET_KEY: CYtDmKetk7QbsCWgSyLWIRo1V57mGXsP
SECRET_KEY: MySecretKey
# these are optional
EMAIL_SMTP_HOST:
EMAIL_SMTP_USER:
EMAIL_SMTP_PASSWORD:
EMAIL_FROM_DOMAIN: yoursite.com
SLACK_CLIENT_ID:
SLACK_CLIENT_SECRET:
networks:
- lk-shared
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy

skit:
build:
context: .
dockerfile: docker/Dockerfile.skit
image: viktorkifer/launchkit-skit:1.0.0
restart: unless-stopped
environment:
API_HOST: http://backend:9101/
DEBUG: 'true'
PORT: 9100
depends_on:
- backend
networks:
- lk-shared
ports:
- 9100:9100
healthcheck:
Expand All @@ -95,17 +113,21 @@ services:
redis:
image: redis:4-alpine
restart: unless-stopped
networks:
- lk-shared
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3

postgres:
image: aidanlister/postgres-hstore
image: viktorkifer/launchkit-postgres-hstore:1.0.0
restart: unless-stopped
ports:
- 5432:5432
networks:
- lk-shared
environment:
POSTGRES_NAME: postgres
POSTGRES_PASSWORD: postgres
Expand Down
12 changes: 2 additions & 10 deletions docker/Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
FROM python:2.7-alpine
FROM launchkit-base

RUN apk update && apk add make gcc libffi-dev musl-dev \
postgresql-dev python-dev zlib-dev jpeg-dev libpng-dev libxml2-dev libxslt-dev go
RUN apk --update add --no-cache go

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN LIBRARY_PATH=/lib:/usr/lib pip install --no-cache-dir -r requirements.txt

COPY backend /usr/src/app/backend
COPY manage.py /usr/src/app
COPY devproxy.go devproxy.go
COPY docker/cmd.backend.sh /usr/src/app/
Expand Down
13 changes: 13 additions & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:2.7-alpine

RUN apk --update add --no-cache make gcc libffi-dev musl-dev postgresql-dev \
python-dev zlib-dev jpeg-dev libpng-dev libxml2-dev libxslt-dev

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN LIBRARY_PATH=/lib:/usr/lib pip install --no-cache-dir -r requirements.txt

COPY backend /usr/src/app/backend

4 changes: 2 additions & 2 deletions docker/Dockerfile.gae
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM python:2.7-alpine

RUN apk update && apk add build-base jpeg-dev zlib-dev wget unzip go
RUN apk --update add --no-cache build-base jpeg-dev zlib-dev wget unzip go

RUN pip install Pillow

RUN wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.27.zip && unzip google_appengine_1.9.27.zip -d /usr/local && rm google_appengine_1.9.27.zip

ENV PATH="/usr/local/google_appengine:${PATH}"

COPY ansible/roles/lk-google-app-engine/files/home.appcfg_nag /.appcfg_nag
COPY ansible/roles/lk-google-app-engine/files/home.appcfg_nag ~/.appcfg_nag

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM postgres:9.3-alpine
MAINTAINER Viktor Kifer
ADD docker/cmd.postgres.sh docker-entrypoint-initdb.d/cmd.postgres.sh
12 changes: 1 addition & 11 deletions docker/Dockerfile.reviews
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
FROM python:2.7-alpine
FROM launchkit-base

RUN apk update && apk add make gcc libffi-dev musl-dev postgresql-dev \
python-dev zlib-dev jpeg-dev libpng-dev libxml2-dev libxslt-dev

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN LIBRARY_PATH=/lib:/usr/lib pip install --no-cache-dir -r requirements.txt

COPY backend /usr/src/app/backend
COPY review_ingester.py /usr/src/app
COPY docker/cmd.reviews.sh /usr/src/app/

Expand Down
19 changes: 18 additions & 1 deletion docker/cmd.backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ sed -i "s|'USER': 'vagrant'|'USER': '${POSTGRES_USER}'|" backend/settings.py
sed -i "s|'PASSWORD': ''|'PASSWORD': '${POSTGRES_PASSWORD}'|" backend/settings.py
sed -i "s|'HOST': 'localhost'|'HOST': '${POSTGRES_HOST}'|" backend/settings.py

# sed -i "s|APP_ENGINE_PHOTOS_UPLOAD_BASE_PATH = \"http://localhost:9102\"|APP_ENGINE_PHOTOS_UPLOAD_BASE_PATH = \"http://gae:9102\"|" backend/settings.py
if [ -z "${EMAIL_SMTP_HOST}" ]; then
sed -i "s|EMAIL_SMTP_HOST = None|'EMAIL_SMTP_HOST': '${EMAIL_SMTP_HOST}'|" backend/settings.py
fi
if [ -z "${EMAIL_SMTP_USER}" ]; then
sed -i "s|EMAIL_SMTP_USER = None|'EMAIL_SMTP_USER': '${EMAIL_SMTP_USER}'|" backend/settings.py
fi
if [ -z "${EMAIL_SMTP_PASSWORD}" ]; then
sed -i "s|EMAIL_SMTP_PASSWORD = None|'EMAIL_SMTP_PASSWORD': '${EMAIL_SMTP_PASSWORD}'|" backend/settings.py
fi
if [ -z "${EMAIL_FROM_DOMAIN}" ]; then
sed -i "s|EMAIL_FROM_DOMAIN = \"yoursite.com\"|'EMAIL_SMTP_PASSWORD': '${EMAIL_FROM_DOMAIN}'|" backend/settings.py
fi
if [ -z "${SLACK_CLIENT_ID}" ]; then
sed -i "s|SLACK_CLIENT_ID = \"\"|'SLACK_CLIENT_ID': '${SLACK_CLIENT_ID}'|" backend/settings.py
fi
if [ -z "${SLACK_CLIENT_SECRET}" ]; then
sed -i "s|SLACK_CLIENT_SECRET = \"\"|'SLACK_CLIENT_SECRET': '${SLACK_CLIENT_SECRET}'|" backend/settings.py
fi

# Fix Redis settings
sed -i "s|redis://localhost:6379/0|${REDIS_URL}|" backend/settings.py
Expand Down
10 changes: 10 additions & 0 deletions docker/cmd.postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Because both template1 and the user postgres database have already been created,
# we need to create the hstore extension in template1 and then recreate the postgres database.
#
# Running CREATE EXTENSION in both template1 and postgres can lead to
# the extensions having different id's.
gosu postgres psql --dbname template1 <<EOSQL
CREATE EXTENSION hstore;
DROP DATABASE $POSTGRES_USER;
CREATE DATABASE $POSTGRES_USER TEMPLATE template1;
EOSQL
19 changes: 19 additions & 0 deletions docker/cmd.reviews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ sed -i "s|'USER': 'vagrant'|'USER': '${POSTGRES_USER}'|" backend/settings.py
sed -i "s|'PASSWORD': ''|'PASSWORD': '${POSTGRES_PASSWORD}'|" backend/settings.py
sed -i "s|'HOST': 'localhost'|'HOST': '${POSTGRES_HOST}'|" backend/settings.py

if [ -z "${EMAIL_SMTP_HOST}" ]; then
sed -i "s|EMAIL_SMTP_HOST = None|'EMAIL_SMTP_HOST': '${EMAIL_SMTP_HOST}'|" backend/settings.py
fi
if [ -z "${EMAIL_SMTP_USER}" ]; then
sed -i "s|EMAIL_SMTP_USER = None|'EMAIL_SMTP_USER': '${EMAIL_SMTP_USER}'|" backend/settings.py
fi
if [ -z "${EMAIL_SMTP_PASSWORD}" ]; then
sed -i "s|EMAIL_SMTP_PASSWORD = None|'EMAIL_SMTP_PASSWORD': '${EMAIL_SMTP_PASSWORD}'|" backend/settings.py
fi
if [ -z "${EMAIL_FROM_DOMAIN}" ]; then
sed -i "s|EMAIL_FROM_DOMAIN = \"yoursite.com\"|'EMAIL_SMTP_PASSWORD': '${EMAIL_FROM_DOMAIN}'|" backend/settings.py
fi
if [ -z "${SLACK_CLIENT_ID}" ]; then
sed -i "s|SLACK_CLIENT_ID = \"\"|'SLACK_CLIENT_ID': '${SLACK_CLIENT_ID}'|" backend/settings.py
fi
if [ -z "${SLACK_CLIENT_SECRET}" ]; then
sed -i "s|SLACK_CLIENT_SECRET = \"\"|'SLACK_CLIENT_SECRET': '${SLACK_CLIENT_SECRET}'|" backend/settings.py
fi

# Fix Redis settings
sed -i "s|redis://localhost:6379/0|${REDIS_URL}|" backend/settings.py

Expand Down