mirror of
https://github.com/bitnami/containers.git
synced 2026-02-10 20:47:22 +08:00
First commit
This commit is contained in:
27
bitnami/discourse/Dockerfile
Normal file
27
bitnami/discourse/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM gcr.io/stacksmith-images/minideb:jessie-r2
|
||||
|
||||
MAINTAINER Bitnami <containers@bitnami.com>
|
||||
|
||||
ENV BITNAMI_APP_NAME=discourse \
|
||||
BITNAMI_IMAGE_VERSION=1.6.7 \
|
||||
PATH=/opt/bitnami/ruby/bin:/opt/bitnami/postgresql-client/bin:/opt/bitnami/git/bin:$PATH
|
||||
|
||||
# Additional modules required
|
||||
RUN bitnami-pkg install imagemagick-6.7.5-10-4 --checksum 02caf58e61a89db57ff3f62a412298fbaeff320cf32e196c9439959a197ed73d
|
||||
RUN bitnami-pkg install postgresql-libraries-9.6.1-0 --checksum 74e71a235a42ba1eb24a1bbb5b47020c2197c99a4e307d966414f3bc1deb1571
|
||||
RUN bitnami-pkg install git-2.10.1-0 --checksum 9be08fdf7a0f23a1e86fb41ef7e8c54c43bf9d05890e276ae08483a0fe2802eb
|
||||
RUN bitnami-pkg install postgresql-client-9.6.1-0 --checksum 01f5a09dd813d72db79ab6055e2c1cd95f41ce5883ca373381d0741cc6172719
|
||||
RUN bitnami-pkg install ruby-2.3.3-0 --checksum b64b56e2b71d9ee38b8a54c073006df7ea70c2ccd8f74ced9ac8b35160134829
|
||||
|
||||
# Install discourse
|
||||
RUN bitnami-pkg unpack discourse-1.6.7-0 --checksum b3e72cf58636f8c790b408f5355e8a7e3cbad8e45301b5ec3ea6743831bfe6ac
|
||||
|
||||
COPY rootfs /
|
||||
|
||||
VOLUME ["/bitnami/discourse"]
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["/app-entrypoint.sh"]
|
||||
|
||||
CMD ["nami","start","--foreground","discourse"]
|
||||
283
bitnami/discourse/README.md
Normal file
283
bitnami/discourse/README.md
Normal file
@@ -0,0 +1,283 @@
|
||||
# What is Discourse?
|
||||
|
||||
> Discourse is the next-next-generation community forum platform. Discourse has a thoroughly modern design and is written in JavaScript. Page loads are very fast and new content is loaded as the user scrolls down the page. Discourse allows you to create categories, tag posts, manage notifications, create user profiles, and includes features to let communities govern themselves by voting out trolls and spammers. Discourse is built for mobile from the ground up and support high-res devices.
|
||||
|
||||
https://www.discourse.org/
|
||||
|
||||
# Prerequisites
|
||||
|
||||
To run this application you need Docker Engine 1.10.0. Docker Compose is recommended with a version 1.6.0 or later.
|
||||
|
||||
# How to use this image
|
||||
|
||||
## Run Discourse with a Database Container
|
||||
|
||||
Running Discourse with a database server is the recommended way. You can either use docker-compose or run the containers manually.
|
||||
|
||||
### Run the application using Docker Compose
|
||||
|
||||
This is the recommended way to run Discourse. You can use the following docker compose template:
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
postgresql:
|
||||
image: 'bitnami/postgresql:latest'
|
||||
volumes:
|
||||
- 'postgresql_data:/bitnami/postgresql'
|
||||
redis:
|
||||
image: 'bitnami/redis:latest'
|
||||
volumes:
|
||||
- 'redis_data:/bitnami/redis'
|
||||
application:
|
||||
image: 'bitnami/discourse:latest'
|
||||
ports:
|
||||
- '80:3000'
|
||||
volumes:
|
||||
- 'discourse_data:/bitnami/discourse'
|
||||
depends_on:
|
||||
- postgresql
|
||||
- redis
|
||||
|
||||
volumes:
|
||||
postgresql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
discourse_data:
|
||||
driver: local
|
||||
```
|
||||
|
||||
Launch the containers using:
|
||||
|
||||
```bash
|
||||
$ docker-compose up -d
|
||||
```
|
||||
|
||||
### Run the application manually
|
||||
|
||||
If you want to run the application manually instead of using docker-compose, these are the basic steps you need to run:
|
||||
|
||||
1. Create a new network for the application and the database:
|
||||
|
||||
```
|
||||
$ docker network create discourse-tier
|
||||
```
|
||||
|
||||
2. Start a Postgresql database in the network generated:
|
||||
|
||||
```
|
||||
$ docker run -d --name postgresql --net=discourse-tier bitnami/postgresql
|
||||
```
|
||||
|
||||
*Note:* You need to give the container a name in order to Discourse to resolve the host
|
||||
|
||||
3. Start Redis in the network generated:
|
||||
|
||||
```
|
||||
$ docker run -d --name redis --net=discourse-tier bitnami/redis
|
||||
```
|
||||
|
||||
4. Run the Discourse container:
|
||||
|
||||
```
|
||||
$ docker run -d -p 80:3000 --name discourse --net=discourse-tier bitnami/discourse
|
||||
```
|
||||
|
||||
Then you can access your application at <http://your-ip/>
|
||||
|
||||
## Persisting your application
|
||||
|
||||
If you remove every container and volume all your data will be lost, and the next time you run the image the application will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed. If you are using docker-compose your data will be persistent as long as you don't remove `postgresql_data`, `redis_data` and `application_data` data volumes. If you have run the containers manually or you want to mount the folders with persistent data in your host follow the next steps:
|
||||
|
||||
> **Note!** If you have already started using your application, follow the steps on [backing](#backing-up-your-application) up to pull the data from your running container down to your host.
|
||||
|
||||
### Mount persistent folders in the host using docker-compose
|
||||
|
||||
This requires a sightly modification from the template previously shown:
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
postgresql:
|
||||
image: 'bitnami/postgresql:latest'
|
||||
volumes:
|
||||
- '/path/to/your/local/postgresql_data:/bitnami/postgresql'
|
||||
redis:
|
||||
image: 'bitnami/redis:latest'
|
||||
volumes:
|
||||
- '/path/to/your/local/redis_data:/bitnami/redis'
|
||||
application:
|
||||
image: 'bitnami/discourse:latest'
|
||||
ports:
|
||||
- '80:3000'
|
||||
volumes:
|
||||
- '/path/to/discourse-persistence:/bitnami/discourse'
|
||||
depends_on:
|
||||
- postgresql
|
||||
- redis
|
||||
```
|
||||
|
||||
### Mount persistent folders manually
|
||||
|
||||
In this case you need to specify the directories to mount on the run command. The process is the same than the one previously shown:
|
||||
|
||||
1. If you haven't done this before, create a new network for the application and the database:
|
||||
|
||||
```
|
||||
$ docker network create discourse-tier
|
||||
```
|
||||
|
||||
2. Start a Postgresql database in the previous network:
|
||||
|
||||
```
|
||||
$ docker run -d --name postgresql \
|
||||
--net=discourse-tier \
|
||||
--volume /path/to/postgresql-persistence:/bitnami/postgresql \
|
||||
bitnami/postgresql
|
||||
```
|
||||
|
||||
3. Start Redis in the previous network as well:
|
||||
|
||||
```
|
||||
$ docker run -d --name redis \
|
||||
--net=discourse-tier \
|
||||
--volume /path/to/redis-persistence:/bitnami/redis \
|
||||
bitnami/redis
|
||||
```
|
||||
|
||||
*Note:* You need to give the container a name in order to Discourse to resolve the host
|
||||
|
||||
4. Run the Discourse container:
|
||||
|
||||
```
|
||||
$ docker run -d --name discourse -p 80:80 \
|
||||
--net=discourse-tier \
|
||||
--volume /path/to/discourse-persistence:/bitnami/discourse \
|
||||
bitnami/discourse
|
||||
```
|
||||
|
||||
# Upgrade this application
|
||||
|
||||
Bitnami provides up-to-date versions of Postgresql and Discourse, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container. We will cover here the upgrade of the Discourse container. For the Postgresql upgrade see https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#upgrade-this-image
|
||||
|
||||
1. Get the updated images:
|
||||
|
||||
```
|
||||
$ docker pull bitnami/discourse:latest
|
||||
```
|
||||
|
||||
2. Stop your container
|
||||
|
||||
* For docker-compose: `$ docker-compose stop discourse`
|
||||
* For manual execution: `$ docker stop discourse`
|
||||
|
||||
3. (For non-compose execution only) Create a [backup](#backing-up-your-application) if you have not mounted the discourse folder in the host.
|
||||
|
||||
4. Remove the currently running container
|
||||
|
||||
* For docker-compose: `$ docker-compose rm -v discourse`
|
||||
* For manual execution: `$ docker rm -v discourse`
|
||||
|
||||
5. Run the new image
|
||||
|
||||
* For docker-compose: `$ docker-compose start discourse`
|
||||
* For manual execution ([mount](#mount-persistent-folders-manually) the directories if needed): `docker run --name discourse bitnami/discourse:latest`
|
||||
|
||||
# Configuration
|
||||
## Environment variables
|
||||
When you start the discourse image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. If you want to add a new environment variable:
|
||||
|
||||
* For docker-compose add the variable name and value under the application section:
|
||||
```yaml
|
||||
application:
|
||||
image: bitnami/discourse:latest
|
||||
ports:
|
||||
- 80:80
|
||||
environment:
|
||||
- DISCOURSE_PASSWORD=bitnami
|
||||
volumes_from:
|
||||
- discourse_data:/bitnami/discourse
|
||||
```
|
||||
|
||||
* For manual execution add a `-e` option with each variable and value:
|
||||
|
||||
```
|
||||
$ docker run -d --name discourse -p 80:80 \
|
||||
--net=discourse-tier \
|
||||
--env DISCOURSE_PASSWORD=bitnami \
|
||||
--volume discourse_data:/bitnami/discourse \
|
||||
bitnami/discourse
|
||||
```
|
||||
|
||||
Available variables:
|
||||
|
||||
- `DISCOURSE_USERNAME`: Discourse application username. Default: **user**
|
||||
- `DISCOURSE_PASSWORD`: Discourse application password. Default: **bitnami1**
|
||||
- `DISCOURSE_EMAIL`: Discourse application email. Default: **user@example.com**
|
||||
- `DISCOURSE_SITENAME`: Discourse site name. Default: **User's site**
|
||||
- `POSTGRES_USER`: Root user for the Postgresql database. Default: **postgres**
|
||||
- `POSTGRES_PASSWORD`: Root password for Postgresql.
|
||||
- `POSTGRES_MASTER_HOST`: Hostname for Postgresql server. Default: **postgresql**
|
||||
- `POSTGRES_MASTER_PORT`: Port used by Postgresql server. Default: **5432**
|
||||
- `REDIS_MASTER_HOST`: Hostname for Redis. Default: **redis**
|
||||
- `REDIS_MASTER_PORT`: Port used by Redis. Default: **6379**
|
||||
- `REDIS_PASSWORD`: Password for Redis.
|
||||
- `SMTP_HOST`: Hostname for the SMTP server (necessary for sending e-mails from the application).
|
||||
- `SMTP_PORT`: Port for the SMTP server.
|
||||
- `SMTP_USER`: Username for the SMTP server.
|
||||
|
||||
# Backing up your application
|
||||
|
||||
To backup your application data follow these steps:
|
||||
|
||||
1. Stop the running container:
|
||||
|
||||
* For docker-compose: `$ docker-compose stop discourse`
|
||||
* For manual execution: `$ docker stop discourse`
|
||||
|
||||
2. Copy the Discourse data folder in the host:
|
||||
|
||||
```
|
||||
$ docker cp /your/local/path/bitnami:/bitnami/discourse
|
||||
```
|
||||
|
||||
# Restoring a backup
|
||||
|
||||
To restore your application using backed up data simply mount the folder with Discourse data in the container. See [persisting your application](#persisting-your-application) section for more info.
|
||||
|
||||
# Contributing
|
||||
|
||||
We'd love for you to contribute to this container. You can request new features by creating an
|
||||
[issue](https://github.com/bitnami/bitnami-docker-discourse/issues), or submit a
|
||||
[pull request](https://github.com/bitnami/bitnami-docker-discourse/pulls) with your contribution.
|
||||
|
||||
# Issues
|
||||
|
||||
If you encountered a problem running this container, you can file an
|
||||
[issue](https://github.com/bitnami/bitnami-docker-discourse/issues). For us to provide better support,
|
||||
be sure to include the following information in your issue:
|
||||
|
||||
- Host OS and version
|
||||
- Docker version (`docker version`)
|
||||
- Output of `docker info`
|
||||
- Version of this container (`echo $BITNAMI_APP_VERSION` inside the container)
|
||||
- The command you used to run the container, and any relevant output you saw (masking any sensitive
|
||||
information)
|
||||
|
||||
# License
|
||||
|
||||
Copyright 2016 Bitnami
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
53
bitnami/discourse/circle.yml
Normal file
53
bitnami/discourse/circle.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
environment:
|
||||
IMAGE_NAME: discourse
|
||||
DOCKER_PROJECT: bitnami
|
||||
GCLOUD_PROJECT: bitnami-containers
|
||||
|
||||
dependencies:
|
||||
override:
|
||||
- docker info
|
||||
- gcloud version
|
||||
- docker pull $DOCKER_PROJECT/$IMAGE_NAME:_ || true
|
||||
|
||||
test:
|
||||
override:
|
||||
- docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_BUILD_NUM .
|
||||
|
||||
deployment:
|
||||
cache:
|
||||
branch: master
|
||||
commands:
|
||||
- >
|
||||
if [ -n "$DOCKER_PASS" ]; then
|
||||
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:_ .
|
||||
docker push $DOCKER_PROJECT/$IMAGE_NAME:_
|
||||
fi
|
||||
release:
|
||||
tag: /^[0-9].*-r[0-9]+$/
|
||||
commands:
|
||||
- >
|
||||
if [ -n "$DOCKER_PASS" ]; then
|
||||
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||
docker build --rm=false -t $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG .
|
||||
docker tag $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG $DOCKER_PROJECT/$IMAGE_NAME:latest
|
||||
docker push $DOCKER_PROJECT/$IMAGE_NAME:$CIRCLE_TAG
|
||||
docker push $DOCKER_PROJECT/$IMAGE_NAME:latest
|
||||
fi
|
||||
- >
|
||||
if [ -n "$GCLOUD_SERVICE_KEY" ]; then
|
||||
echo $GCLOUD_SERVICE_KEY | base64 --decode > ${HOME}/gcloud-service-key.json
|
||||
gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
|
||||
echo 'ENV BITNAMI_CONTAINER_ORIGIN=GCR' >> Dockerfile
|
||||
docker build --rm=false -t gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG .
|
||||
docker tag gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:latest
|
||||
gcloud docker -- push gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:$CIRCLE_TAG
|
||||
gcloud docker -- push gcr.io/$GCLOUD_PROJECT/$IMAGE_NAME:latest
|
||||
fi
|
||||
- >
|
||||
if [ -n "$STACKSMITH_API_KEY" ]; then
|
||||
curl "https://stacksmith.bitnami.com/api/v1/components/$IMAGE_NAME/versions?api_key=$STACKSMITH_API_KEY" -H 'Content-Type: application/json' --data '{"version": "'"${CIRCLE_TAG%-r*}"'", "revision": "'"${CIRCLE_TAG#*-r}"'", "published": true}'
|
||||
fi
|
||||
26
bitnami/discourse/docker-compose.yml
Normal file
26
bitnami/discourse/docker-compose.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: '2'
|
||||
services:
|
||||
postgresql:
|
||||
image: 'bitnami/postgresql:latest'
|
||||
volumes:
|
||||
- 'postgresql_data:/bitnami/postgresql'
|
||||
redis:
|
||||
image: 'bitnami/redis:latest'
|
||||
volumes:
|
||||
- 'redis_data:/bitnami/redis'
|
||||
discourse:
|
||||
image: 'bitnami/discourse:latest'
|
||||
ports:
|
||||
- '80:3000'
|
||||
depends_on:
|
||||
- postgresql
|
||||
- redis
|
||||
volumes:
|
||||
- 'discourse_data:/bitnami/discourse'
|
||||
volumes:
|
||||
postgresql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
discourse_data:
|
||||
driver: local
|
||||
32
bitnami/discourse/rootfs/app-entrypoint.sh
Executable file
32
bitnami/discourse/rootfs/app-entrypoint.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function initialize {
|
||||
# Package can be "installed" or "unpacked"
|
||||
status=`nami inspect $1`
|
||||
if [[ "$status" == *'"lifecycle": "unpacked"'* ]]; then
|
||||
# Clean up inputs
|
||||
inputs=""
|
||||
if [[ -f /$1-inputs.json ]]; then
|
||||
inputs=--inputs-file=/$1-inputs.json
|
||||
fi
|
||||
nami initialize $1 $inputs
|
||||
fi
|
||||
}
|
||||
|
||||
# Set default values
|
||||
export DISCOURSE_USERNAME=${DISCOURSE_USERNAME:-"user"}
|
||||
export DISCOURSE_PASSWORD=${DISCOURSE_PASSWORD:-"bitnami"}
|
||||
export DISCOURSE_EMAIL=${DISCOURSE_EMAIL:-"user@example.com"}
|
||||
export POSTGRES_USER=${POSTGRES_USER:-"postgres"}
|
||||
export POSTGRES_MASTER_HOST=${POSTGRES_MASTER_HOST:-"postgresql"}
|
||||
export REDIS_MASTER_HOST=${REDIS_MASTER_HOST:-"redis"}
|
||||
|
||||
|
||||
|
||||
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then
|
||||
initialize discourse
|
||||
echo "Starting application ..."
|
||||
fi
|
||||
|
||||
exec /entrypoint.sh "$@"
|
||||
18
bitnami/discourse/rootfs/discourse-inputs.json
Normal file
18
bitnami/discourse/rootfs/discourse-inputs.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"username": "{{$global.env.DISCOURSE_USERNAME}}",
|
||||
"password": "{{$global.env.DISCOURSE_PASSWORD}}",
|
||||
"email": "{{$global.env.DISCOURSE_EMAIL}}",
|
||||
"siteName": "{{$global.env.DISCOURSE_SITENAME}}",
|
||||
"databaseAdminUser": "{{$global.env.POSTGRES_USER}}",
|
||||
"databaseAdminPassword": "{{$global.env.POSTGRES_PASSWORD}}",
|
||||
"databaseServerHost": "{{$global.env.POSTGRES_MASTER_HOST}}",
|
||||
"databaseServerPort": "{{$global.env.POSTGRES_MASTER_PORT}}",
|
||||
"redisPort": "{{$global.env.REDIS_MASTER_PORT}}",
|
||||
"redisHost": "{{$global.env.REDIS_MASTER_HOST}}",
|
||||
"redisPassword": "{{$global.env.REDIS_PASSWORD}}",
|
||||
"smtpHost": "{{$global.env.SMTP_HOST}}",
|
||||
"smtpPort": "{{$global.env.SMTP_PORT}}",
|
||||
"smtpUser": "{{$global.env.SMTP_USER}}",
|
||||
"smtpPassword": "{{$global.env.SMTP_PASSWORD}}",
|
||||
"smtpTls": "{{$global.env.SMTP_TLS}}"
|
||||
}
|
||||
Reference in New Issue
Block a user