Page MenuHomeDevCentral

Decouple PostgreSQL from forum container on Dwellers
Closed, WontfixPublic

Description

Currently, the forum container uses a PostgreSQL server.

We could use it for other applications too, for example Sentry, and so run it in a separate container.

Container name: Nuern

Event Timeline

dereckson renamed this task from Decouple PostGreSQL from forum container on Dwellers to Decouple PostgreSQL from forum container on Dwellers.Jan 22 2016, 03:04
dereckson updated the task description. (Show Details)

Container launched.

Script to run the container

#!/bin/sh

#   -------------------------------------------------------------
#   PostgreSQL Nuern instance
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#   Author:         Sébastien Santoro aka Dereckson
#   Project:        Nasqueron
#   Created:        2016-03-01
#   Description:    Provide PostgreSQL database for Dwellers apps
#   Image:          postgres
#   Services used:  Docker volume   (/data/nuern/data)
#   -------------------------------------------------------------

#   -------------------------------------------------------------
#   Container parameters
#
#   Get credentials from zr
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

INSTANCE_NAME=nuern
PGSQL_SUPERUSER_PASSWORD=`ssh -i /root/.ssh/id_zr zr@212.83.187.132 cat data/nuern.dat`

#   -------------------------------------------------------------
#   Local data directory
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

PGSQL_DATADIR=/data/$INSTANCE_NAME/data
mkdir -p $PGSQL_DATADIR
chcon -Rt svirt_sandbox_file_t $PGSQL_DATADIR

#   -------------------------------------------------------------
#   Run container
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

docker run -dt \
  -e POSTGRES_PASSWORD=$PGSQL_SUPERUSER_PASSWORD \
  -v $PGSQL_DATADIR:/var/lib/postgresql/data \
  --name $INSTANCE_NAME postgres

Still to do

Import database from the forum.

dereckson removed dereckson as the assignee of this task.Mar 8 2018, 21:07

PostgreSQL by default doesn't consume 2 GB of RAM for an InnoDB cache, so I'm not sure it's a good idea.

dereckson claimed this task.

Any new deployment of Discourse, we'll take a decision where to host it.

We've a PostgreSQL cluster starting with db-A-001 available for example to decouple database from Docker, but that will be consolidated.

Services like Sentry are welcome to host all their stack including the db in containers.

Nasqueron in-house services will use an optimised cluster.