Giter Site home page Giter Site logo

discourse-docker's Introduction

discourse-docker

Discourse is a re-imagined online forum software. Installing Discourse can be quite an involved process. We use Docker, an exciting new container management tool, to greatly ease its install process.

Usage

Get yourself a Ubuntu 13.04 VM (I recommend DigitalOcean), and start getting Discourse up and running in a few minutes:

# Install docker
open http://docs.docker.io/en/latest/installation/ubuntulinux/#ubuntu-raring

# Install postgresql-client for management-tasks
sudo apt-get install postgresql-client

# Install supervisor, the process manager
sudo apt-get install python-pip
sudo pip install supervisor

git clone https://github.com/srid/discourse-docker.git
cd discourse-docker

# Pull the docker images (expect this to download a few megabytes)
make pull  # or `make build` if you want to locally build them

# Configure your discourse site domain (DISCOURSE_HOST)
more etc/env
echo 'export DISCOURSE_HOST=mysite.com:5000' > .env
# OPTIONAL: email support via postmarkapp.com.
# later, add the 'From' address to Discourse admin settings.
echo 'export POSTMARK_API_KEY=<apikey>' >> .env

# Start supervisor on a separate terminal window. This will
# automatically start the redis and postgresql containers.
make supervisor

# Verify that redis-server and postgres are running.
# Note: bin/sup is alias to `sudo supervisorctl`.
bin/sup status

# Setup the discourse database and compile static assets.
# Note: postgres data is at data/postgres; discourse public/
# (containing uploaded files) directory is mounted from
# data/discourse-public.
bin/discourse-start setup

# Finally, start discourse, sidekiq and nginx
bin/sup start discourse sidekiq nginx

# Discourse is now running; launch the discourse site URL.
make info

# After signing up for an account, make yourself an admin:
bin/make-admin myusername

Upgrading to newer Discourse versions

  1. Set DISCOURSE_VERSION in discourse/Dockerfile to the appropriate version

  2. Rebuild the images using make build

  3. Stop supervisord, clean up running docker containers, and run make supervisord

  4. Run bin/discourse-start setup (this will run rake db:migrate)

  5. Run bin/discourse-start "bundle exec rake assets:precompile"

  6. Start discourse and the rest: bin/sup start all

Migration

To migrate from an existing Discourse forum:

  1. Start only postgresql,redis

  2. Take a snapshot of the database and import it right after starting the postgresql container.

  3. Run bin/discourse-start setup. If the assets creation step fails, try re-running it using bin/discourse-start "bundle exec rake assets:precompile".

  4. Import public/uploads directory into data/discourse-public/uploads

  5. Start everything: bin/sup start all

discourse-docker's People

Contributors

finkregh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discourse-docker's Issues

bin/discourse-start setup fails: POSTGRES_PORT seems to be wrong

~/discourse-docker$ bin/discourse-start setup
+ exec sudo docker run -e REDIS_PROVIDER_URL=redis://[email protected]:49153 -e POSTGRES_HOST=100.85.250.86 -e POSTGRES_PORT=0.0.0.0:49155 -e POSTMARK_API_KEY= -e DISCOURSE_HOST=bvdiscourse.cloudapp.com -v /home/badvoltage/discourse-docker/data/discourse-public:/discourse/public srid/discourse setup
+ bundle exec rake db:create
invalid port number: "0.0.0.0:49155"

This seems to be being caused by this (code taken from bin/postgresql-info):

$ sudo docker ps | grep srid/postgresql:9.1 | awk '{print $1}'
299eb624837f
$ sudo docker port 299eb624837f 5432
0.0.0.0:49155

I think that the docker port command ought to be printing just a port number, not printing an IP and port number. I haven't changed any postgres configuration, and I followed the steps in the README. Do I need to tweak some configuration somewhere?

Don't delete .git

I have no idea why you would delete .git, as that's shooting your upgrade abilities in the knee.

problem during installation - make pull command

i am installing discourse on server (digitalocean) -ubuntu 13.04 - (1GB mem, 20 GB SSD)
while installing this error being displayed on passing the command :
make pull

sudo docker pull srid/discourse-nginx
sudo: docker: command not found
make: *** [pull] Error 1

Nothing but 404's

I followed your doc to a T. Only thing I did different was that I created my droplet with the Docker on Ubuntu 13.04 Application. Anyway, when I run make info I get the IP address and the url for my site, both are 404's.

Orchestration

We should figure out a way to abstract startup scripts (in bin/) and configuration (in etc/) using some sort of docker orchestration tool.

Watch out for docker run -link ... moby/moby#1907 in docker 0.7. Also track moby/moby#1352 for starting multiple containers.

Emails not sending

I am a little unclear on how to get emails to be sent out from the app. I've followed the setup guide word-for-word and added in my Postmark API key but no emails are being sent out of the app.

How can I debug this problem?

Backup script

Need a backup script to back up both the postgres data and the Discourse uploads folder (data/discourse-public) on regular basis.

Postgres data in particular should be backed using pg_dump.

Ideally also have support for Dropbox -- their API is simple -- so that backups can be directly uploaded to one's Dropbox App folder

initdb fails to run

I keep getting the following error when running postgres with make supervisor

uname -a

Linux hostname 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.04
Release:        13.04
Codename:       raring

/tmp/postgres.log

++ pwd
+ exec sudo docker run -v /home/user/discourse-docker/data/postgres:/var/lib/postgresql srid/postgresql:9.1
2013/10/22 15:24:34 Error: Error starting container 44f138420e8d: iptables failed: iptables -t nat -A DOCKER -p tcp --dport 49153 ! -i docker0 -j DNAT --to-destination 172.17.0.3:5432
++ pwd
+ exec sudo docker run -v /home/user/discourse-docker/data/postgres:/var/lib/postgresql srid/postgresql:9.1
Creating Postgres data at /var/lib/postgresql/9.1/main
Initializing Postgres Database at /var/lib/postgresql/9.1/main
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/postgresql/9.1/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 24MB
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/9.1/main/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... Illegal instruction
child process exited with exit code 132
initdb: removing contents of data directory "/var/lib/postgresql/9.1/main"
2013-10-22 19:24:38 UTC FATAL:  "/var/lib/postgresql/9.1/main" is not a valid data directory
2013-10-22 19:24:38 UTC DETAIL:  File "/var/lib/postgresql/9.1/main/PG_VERSION" is missing.

add script to activate accounts / enable mailing

nice scripts so far; the problem at the moment is that i cannot login with my account because the confirmation-email did not get anywhere...

sh: 1: /usr/sbin/sendmail: not found in the sidekiq-docker...

you could eventually symlink sendmail to echo or something... :)

Upgrade script

Upgrade script for upgrading to discourse future tag releases

  • Automatically backup/restore data/{postgresql/discourse-public} in the event if failure.
  • Run db:migrate and asset:precompile without resetting data/discourse-public (as 'setup' does).

Issue faced during installation - make supervisor

Installing Discourse on server
1GB Ram, 30GB, SSD Disk, Ubuntu 12.04 x64
Successfully installed docker

open http://docs.docker.io/en/latest/installation/ubuntulinux/#ubuntu-raring
apt-get install postgresql-client
sudo apt-get install python-pip
sudo pip install supervisor
git clone https://github.com/srid/discourse-docker.git
cd discourse-docker
make pull

Error displayed while attempting the below command
make supervisor

discourse

Attached the screenshot of the error.
Sorry, i am new at this. Could anybody suggest a solution ?

Use system supervisord

Should use the system supervisord (apt-get install supervisor) so that other non-discourse containers too can be managed in it.

Create a etc/supervisor.conf.d/discourse file and instruct the user to symlink it to the system supervisor conf.d directory.

bin/discourse-start setup

bin/discourse-start setup

  • exec sudo docker run -e REDIS_PROVIDER_URL=redis://[email protected]: Usage: docker port CONTAINER PRIVATE_PORT Lookup the public-facing port which is NAT-ed to PRIVATE_PORT -e POSTGRES_HOST=192.168.0.138 -e POSTGRES_PORT= Usage: docker port CONTAINER PRIVATE_PORT Lookup the public-facing port which is NAT-ed to PRIVATE_PORT -e POSTMARK_API_KEY= -e DISCOURSE_HOST=mysite.com:5000 -v /home/bilbo/discourse-docker/data/discourse-public:/discourse/public srid/discourse setup
    Unable to find image 'Usage:' (tag: latest) locally
    2013/11/10 10:33:16 Invalid repository name (Usage), only [a-z0-9-_.] are allowed

I tried localhost, too.

Don't use supervisor

if you ctrl+c a make supervisor session, supervisor will seemingly exit after killing the docker processes, but docker ps will indicate that the containers are still running.

supervisor is effectively useless in this context.

we should get rid of it, unless docker will play well with process supervisors (see docker issue 1311).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.