discourse-standalone

Example:

# Install Discourse.
- discourse-standalone:
    hostname: friends.of.freckles.io
    admin_emails:
    - [email protected]
    discourse_smtp_address: smtp.postmarkapp.com
    discourse_smtp_port: 587
    discourse_smtp_user_name: uuid-uuid-uuid-uuid...
    discourse_smtp_password: super-secret-password...

Description

Install and configure a discourse instance.

This uses the '30 minute guide' from the official Discourse GitHub repository.

Variables

Name Type Default Description

admin_emails

list --

The first email will also be set as the letsencrypt contact email. Required

discourse_smtp_address

string --

The SMTP server address. Required

discourse_smtp_password

string --

The SMTP password. Required

discourse_smtp_port

integer --

The SMTP port. Required

discourse_smtp_user_name

string --

The SMTP user name. Required

hostname

string --

The discourse hostname. Required

discourse_plugins

list []

A list of discourse plugin urls.

discourse_smtp_enable_start_tls

boolean True

Whether to use START_TLS when connecting to the SMTP server.

discourse_version

string stable

The version of discourse.

set_from_email

string --

This only needs to be set/run once, at install time. Needs to be an address that is supported by your smtp settings.

use_https

boolean True

Whether to use https with letsencrypt.

Examples

Example 1

Install Discourse.

Code
- discourse-standalone:
    hostname: friends.of.freckles.io
    admin_emails:
    - [email protected]
    discourse_smtp_address: smtp.postmarkapp.com
    discourse_smtp_port: 587
    discourse_smtp_user_name: uuid-uuid-uuid-uuid...
    discourse_smtp_password: super-secret-password...
Description

This needs mail setup beforehand (refer to Discourse documentation for this).

Code

doc:
  short_help: Install and configure a Discourse instance.
  help: |
    Install and configure a [discourse](https://discourse.org) instance.

    This uses the ['30 minute guide'](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) from the
    official [Discourse GitHub repository](https://github.com/discourse/discourse).

  furter_reading:
    Discourse install documentation: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
  notes:
  - this may fail if the host machine already has a swap file in /swapfile which is
    smaller than 2GB. If this happens, the 'discourse-setup' scripts fault.
  examples:
  - title: Install Discourse.
    desc: |
      This needs mail setup beforehand (refer to Discourse documentation for this).
    vars:
      hostname: friends.of.freckles.io
      admin_emails:
      - [email protected]
      discourse_smtp_address: smtp.postmarkapp.com
      discourse_smtp_port: 587
      discourse_smtp_user_name: uuid-uuid-uuid-uuid...
      discourse_smtp_password: super-secret-password...

args:
  use_https:
    doc:
      short_help: Whether to use https with letsencrypt.
    type: boolean
    default: true
    cli:
      param_decls:
      - --use-https/--no-use-https
  hostname:
    doc:
      short_help: The discourse hostname.
    type: string
    required: true
  admin_emails:
    doc:
      short_help: A list of email addresses that will be admins after install.
      help: |
        The first email will also be set as the letsencrypt contact email.
    required: true
    type: list
    schema:
      type: string
    empty: false
    cli:
      param_decls:
      - --admin-email
      metavar: EMAIL
  discourse_version:
    doc:
      short_help: The version of discourse.
    type: string
    default: stable
    required: false
    cli:
      show_default: true
  discourse_smtp_address:
    doc:
      short_help: The SMTP server address.
    type: string
    required: true
  discourse_smtp_port:
    doc:
      short_help: The SMTP port.
    type: integer
    required: true
  discourse_smtp_user_name:
    doc:
      short_help: The SMTP user name.
    type: string
    required: true
  discourse_smtp_password:
    doc:
      short_help: The SMTP password.
    type: string
    required: true
  discourse_smtp_enable_start_tls:
    doc:
      short_help: Whether to use START_TLS when connecting to the SMTP server.
    type: boolean
    default: true
    required: true
    cli:
      param_decls:
      - --start-tls/--no-start-tls
  set_from_email:
    doc:
      short_help: A custom 'from' email address (e.g. [email protected]).
      help: |
        This only needs to be set/run once, at install time. Needs to be an address that is supported by your smtp settings.
    type: string
    required: false
  discourse_plugins:
    doc:
      short_help: A list of discourse plugin urls.
    type: list
    schema:
      type: string
    required: false
    default: []
    empty: true
    cli:
      metavar: PLUGIN
      show_default: true

meta:
  tags:
  - discourse
  - forum
  - setup
  - docker
  - standalone

frecklets:
- docker-service:
    users:
    - discourse
- git-repo-synced:
    dest: /var/discourse
    repo: https://github.com/discourse/discourse_docker.git
    owner: root
- discourse-config-file:
    path: /var/discourse/containers/app.yml
    owner: root
    group: root
    mode: '700'
    hostname: '{{:: hostname ::}}'
    use_https: '{{:: use_https ::}}'
    admin_emails: '{{:: admin_emails ::}}'
    discourse_version: '{{:: discourse_version ::}}'
    set_from_email: '{{:: set_from_email ::}}'
    discourse_smtp_address: '{{:: discourse_smtp_address ::}}'
    discourse_smtp_port: '{{:: discourse_smtp_port ::}}'
    discourse_smtp_user_name: '{{:: discourse_smtp_user_name ::}}'
    discourse_smtp_password: '{{:: discourse_smtp_password ::}}'
    discourse_smtp_enable_start_tls: '{{:: discourse_smtp_enable_start_tls ::}}'
    discourse_plugins: '{{:: discourse_plugins ::}}'
- execute-command:
    frecklet::desc:
      short: setting up discourse, this will take quite a while (really, don't give
        up...)
    command: /var/discourse/launcher rebuild app
    chdir: /var/discourse
    become_user: root
frecklecute --community discourse-standalone --help

Usage: frecklecute discourse-standalone [OPTIONS]

  Install and configure a [discourse](https://discourse.org) instance.

  This uses the ['30 minute
  guide'](https://github.com/discourse/discourse/blob/master/docs/INSTALL-
  cloud.md) from the official [Discourse GitHub
  repository](https://github.com/discourse/discourse).

Options:
  --admin-email EMAIL             A list of email addresses that will be
                                  admins after install.  [required]
  --discourse-smtp-address DISCOURSE_SMTP_ADDRESS
                                  The SMTP server address.  [required]
  --discourse-smtp-password DISCOURSE_SMTP_PASSWORD
                                  The SMTP password.  [required]
  --discourse-smtp-port DISCOURSE_SMTP_PORT
                                  The SMTP port.  [required]
  --discourse-smtp-user-name DISCOURSE_SMTP_USER_NAME
                                  The SMTP user name.  [required]
  --hostname HOSTNAME             The discourse hostname.  [required]
  --discourse-plugins PLUGIN      A list of discourse plugin urls.
  --start-tls / --no-start-tls    Whether to use START_TLS when connecting to
                                  the SMTP server.
  --discourse-version DISCOURSE_VERSION
                                  The version of discourse.
  --set-from-email SET_FROM_EMAIL
                                  A custom 'from' email address (e.g.
                                  [email protected]).
  --use-https / --no-use-https    Whether to use https with letsencrypt.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.discourse_standalone.DiscourseStandalone
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class DiscourseStandalone(AutoPycklet):
    """Install and configure a [discourse](https://discourse.org) instance.

     This uses the ['30 minute guide'](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) from the
     official [Discourse GitHub repository](https://github.com/discourse/discourse).

       Args:
         admin_emails: A list of email addresses that will be admins after install.
         discourse_plugins: A list of discourse plugin urls.
         discourse_smtp_address: The SMTP server address.
         discourse_smtp_enable_start_tls: Whether to use START_TLS when connecting to the SMTP server.
         discourse_smtp_password: The SMTP password.
         discourse_smtp_port: The SMTP port.
         discourse_smtp_user_name: The SMTP user name.
         discourse_version: The version of discourse.
         hostname: The discourse hostname.
         set_from_email: A custom 'from' email address (e.g. [email protected]).
         use_https: Whether to use https with letsencrypt.

    """

    FRECKLET_ID = "discourse-standalone"

    admin_emails: List = None
    discourse_plugins: List = None
    discourse_smtp_address: str = None
    discourse_smtp_enable_start_tls: bool = None
    discourse_smtp_password: str = None
    discourse_smtp_port: int = None
    discourse_smtp_user_name: str = None
    discourse_version: str = None
    hostname: str = None
    set_from_email: str = None
    use_https: bool = None


    def __post_init__(self):
        super(DiscourseStandalone, self).__init__(var_names=["admin_emails", "discourse_plugins", "discourse_smtp_address", "discourse_smtp_enable_start_tls", "discourse_smtp_password", "discourse_smtp_port", "discourse_smtp_user_name", "discourse_version", "hostname", "set_from_email", "use_https"])


frecklet_class = DiscourseStandalone
# -*- coding: utf-8 -*-


#
# module path: pycklets.discourse_standalone.DiscourseStandalone
#


from pyckles import AutoPycklet

class DiscourseStandalone(AutoPycklet):
    """Install and configure a [discourse](https://discourse.org) instance.

     This uses the ['30 minute guide'](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) from the
     official [Discourse GitHub repository](https://github.com/discourse/discourse).

       Args:
         admin_emails: A list of email addresses that will be admins after install.
         discourse_plugins: A list of discourse plugin urls.
         discourse_smtp_address: The SMTP server address.
         discourse_smtp_enable_start_tls: Whether to use START_TLS when connecting to the SMTP server.
         discourse_smtp_password: The SMTP password.
         discourse_smtp_port: The SMTP port.
         discourse_smtp_user_name: The SMTP user name.
         discourse_version: The version of discourse.
         hostname: The discourse hostname.
         set_from_email: A custom 'from' email address (e.g. [email protected]).
         use_https: Whether to use https with letsencrypt.

    """

    FRECKLET_ID = "discourse-standalone"

    def __init__(self, admin_emails=None, discourse_plugins=None, discourse_smtp_address=None, discourse_smtp_enable_start_tls=True, discourse_smtp_password=None, discourse_smtp_port=None, discourse_smtp_user_name=None, discourse_version="stable", hostname=None, set_from_email=None, use_https=True):

        super(DiscourseStandalone, self).__init__(var_names=["admin_emails", "discourse_plugins", "discourse_smtp_address", "discourse_smtp_enable_start_tls", "discourse_smtp_password", "discourse_smtp_port", "discourse_smtp_user_name", "discourse_version", "hostname", "set_from_email", "use_https"])
        self._admin_emails = admin_emails
        self._discourse_plugins = discourse_plugins
        self._discourse_smtp_address = discourse_smtp_address
        self._discourse_smtp_enable_start_tls = discourse_smtp_enable_start_tls
        self._discourse_smtp_password = discourse_smtp_password
        self._discourse_smtp_port = discourse_smtp_port
        self._discourse_smtp_user_name = discourse_smtp_user_name
        self._discourse_version = discourse_version
        self._hostname = hostname
        self._set_from_email = set_from_email
        self._use_https = use_https

    @property
    def admin_emails(self):
        return self._admin_emails

    @admin_emails.setter
    def admin_emails(self, admin_emails):
        self._admin_emails = admin_emails

    @property
    def discourse_plugins(self):
        return self._discourse_plugins

    @discourse_plugins.setter
    def discourse_plugins(self, discourse_plugins):
        self._discourse_plugins = discourse_plugins

    @property
    def discourse_smtp_address(self):
        return self._discourse_smtp_address

    @discourse_smtp_address.setter
    def discourse_smtp_address(self, discourse_smtp_address):
        self._discourse_smtp_address = discourse_smtp_address

    @property
    def discourse_smtp_enable_start_tls(self):
        return self._discourse_smtp_enable_start_tls

    @discourse_smtp_enable_start_tls.setter
    def discourse_smtp_enable_start_tls(self, discourse_smtp_enable_start_tls):
        self._discourse_smtp_enable_start_tls = discourse_smtp_enable_start_tls

    @property
    def discourse_smtp_password(self):
        return self._discourse_smtp_password

    @discourse_smtp_password.setter
    def discourse_smtp_password(self, discourse_smtp_password):
        self._discourse_smtp_password = discourse_smtp_password

    @property
    def discourse_smtp_port(self):
        return self._discourse_smtp_port

    @discourse_smtp_port.setter
    def discourse_smtp_port(self, discourse_smtp_port):
        self._discourse_smtp_port = discourse_smtp_port

    @property
    def discourse_smtp_user_name(self):
        return self._discourse_smtp_user_name

    @discourse_smtp_user_name.setter
    def discourse_smtp_user_name(self, discourse_smtp_user_name):
        self._discourse_smtp_user_name = discourse_smtp_user_name

    @property
    def discourse_version(self):
        return self._discourse_version

    @discourse_version.setter
    def discourse_version(self, discourse_version):
        self._discourse_version = discourse_version

    @property
    def hostname(self):
        return self._hostname

    @hostname.setter
    def hostname(self, hostname):
        self._hostname = hostname

    @property
    def set_from_email(self):
        return self._set_from_email

    @set_from_email.setter
    def set_from_email(self, set_from_email):
        self._set_from_email = set_from_email

    @property
    def use_https(self):
        return self._use_https

    @use_https.setter
    def use_https(self, use_https):
        self._use_https = use_https



frecklet_class = DiscourseStandalone