wordpress-standalone

Example:

# Install Wordpress with Nginx webserver and https configured.
- wordpress-standalone:
    wp_title: My beautiful wordpress site
    webserver: nginx
    hostname: dev.frkl.io
    use_https: true
    wp_admin_name: admin
    wp_admin_email: hello@frkl.io
    wp_admin_password: password123
    wp_db_password: db_password_123

Description

Sets up Wordpress on a machine, including dependencies (MariaDB, Apache/Nginx, LetsEncrypt).

Optionally this frecklet can also checkout a folder with theme/plugin sources and intermingle it with the wordpress project folder, to support good version control and configuration management practices.

If no 'wp_db_password' is specified, freckles will generate a random one. That doesn't really matter (and is arguably more secure), since we don't need to know it in most cases. If we need to find it, we can check the Wordpress config file for it.

Variables

Name Type Default Description

hostname

string --

The hostname of the server. Required

wp_admin_email

n/a --

The email of the wordpress admin user. Required

wp_admin_password

string --

The password of the wordpress admin user. Required

wp_db_password

string --

The password for the database. Required

wp_title

string --

The name of the wordpress instance. Required

base_path

string /var/www

The wordpress project folders parent directory.

disable_ipv6

boolean False

Whether to disable ipv6 for this server block (only nginx supported for now).

letsencrypt_staging

boolean False

Whether to use the letsencrypt staging server.

This is useful for developing -- the letsencrypt production server only allows a few requests per day. This option is disabled in the cli, as it is not used very often. Just use an overlay dict to enable this.

listen_ip

string _default_

The address to listen to, can be any of the following, optionally followed by a colon and a port number (or *): - The IP address of the virtual host; - A fully qualified domain name for the IP address of the virtual host (not recommended); - The character *, which acts as a wildcard and matches any IP address. - The string default, which is an alias for *

project_source

string --

If specified, this location will be checked out into the target host, and 'intermingled' with the wordpress project folder.

server_admin

string --

The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email.

use_https

boolean --

Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set).

vhost_name

string --

The name of the vhost file.

webserver

string nginx

The webserver to use, currently supported: 'apache', nginx'.

webserver_group

string www-data

The group to run the webserver as (if applicable).

webserver_use_pagespeed

boolean False

Whether to install and use the pagespeed module.

Only Nginx currently supported, when using this with Apache it will be ignored. Nginx will be built from source if set to true.

webserver_user

string www-data

The user to run the webserver as.

wp_admin_name

string admin

The name of the wordpress admin user.

wp_content_parent

string

The path relative to 'wp_project_path' that contains the 'wp-content' folder.

wp_db_dump_file

string --

An (optional) database dump file.

wp_db_host

string localhost

The db host.

wp_db_import

boolean False

Whether to import a sql dump.

wp_db_name

string wp_database

The name of the database to use.

wp_db_table_prefix

string wp_

The wordpress db table prefix.

wp_db_user

string wordpress

The db user.

wp_group

string www-data

The group who owns the project files.

wp_plugins

list []

A list of plugins to install.

wp_project_path

string --

The path to the wordpress project folder.

Contain the config file ('wp-config.php'), and the content folder ('wp-content').

This is optional, if specified, this will be symbolically linked to the wordpress folder. Handy for managing wp-content with git.

wp_themes

list []

A list of themes to install.

wp_user

string www-data

The user who owns the project files.

wp_version

string --

The version of Wordpress.

Examples

Example 1

Install Wordpress with Nginx webserver and https configured.

Code
- wordpress-standalone:
    wp_title: My beautiful wordpress site
    webserver: nginx
    hostname: dev.frkl.io
    use_https: true
    wp_admin_name: admin
    wp_admin_email: hello@frkl.io
    wp_admin_password: password123
    wp_db_password: db_password_123
Description

Check the freckles security documentation if you are concerned about plain text passwords in files like this.

Example 2

Minimal Wordpress install.

Code
- wordpress-standalone:
    wp_title: My first Wordpress site
    wp_admin_email: hello@frkl.io
    wp_admin_password: secret_login_password
Description

In this example we use the install Wordpress with the minimum amount of customization.

We don't specify a database password, so freckles will generate a random one.

Example 3

Install a new instance without any plugins, themes, or custom code, using an external IP address.

Code
- wordpress-standalone:
    webserver_user: www-data
    webserver_group: www-data
    wp_admin_password: secret_login_password
    wp_db_password: secret_password_for_wp_database
    wp_admin_email: hello@frkl.io
    wp_title: Freckles example setup
    hostname: 10.0.0.22
Description

Installs a (vanilla) new wordpress instance on the local network, but accessible from outside localhost, without any costumizations.

Code

doc:
  short_help: Sets up a single-site wordpress instance.
  help: |
    Sets up [Wordpress](https://wordpress.com) on a machine, including dependencies
    (MariaDB, Apache/Nginx, LetsEncrypt).

    Optionally this frecklet can also checkout a folder with theme/plugin sources and
    [intermingle](https://TODO) it with the wordpress project folder, to support
    good version control and configuration management practices.

    If no 'wp_db_password' is specified, freckles will generate a random one. That doesn't really matter (and is arguably
    more secure), since we don't need to know it in most cases. If we need to find it, we can check the Wordpress config file for it.
  examples:
  - title: Install Wordpress with Nginx webserver and https configured.
    desc: |
      Check the [freckles security documentation](https://freckles.io/doc/security) if you are concerned about
      plain text passwords in files like this.
    vars:
      wp_title: My beautiful wordpress site
      webserver: nginx
      hostname: dev.frkl.io
      use_https: true
      wp_admin_name: admin
      wp_admin_email: hello@frkl.io
      wp_admin_password: password123
      wp_db_password: db_password_123
  - title: Minimal Wordpress install.
    desc: |
      In this example we use the install Wordpress with the minimum amount of customization.

      We don't specify a database password, so freckles will generate a random one.
    vars:
      wp_title: My first Wordpress site
      wp_admin_email: hello@frkl.io
      wp_admin_password: secret_login_password
  - title: Install a new instance without any plugins, themes, or custom code, using
      an external IP address.
    vars:
      webserver_user: www-data
      webserver_group: www-data
      wp_admin_password: secret_login_password
      wp_db_password: secret_password_for_wp_database
      wp_admin_email: hello@frkl.io
      wp_title: Freckles example setup
      hostname: 10.0.0.22
    desc: |
      Installs a (vanilla) new wordpress instance on the local network, but accessible from outside localhost, without any costumizations.
args:
  project_source:
    doc:
      short_help: The (optional) custom source code for this wordpress site.
      help: |
        If specified, this location will be checked out into the target host,
        and '[intermingled](https://TODO)' with the wordpress project folder.
    type: string
    required: false
    cli:
      metavar: PATH_OR_URL
  vhost_name:
    doc:
      short_help: The name of the vhost file.
    required: false
    type: string
  base_path:
    doc:
      short_help: The wordpress project folders parent directory.
    type: string
    required: false
    default: /var/www
    cli:
      show_default: true
  hostname:
    type: string
    required: true
    doc:
      short_help: The hostname of the server.
  letsencrypt_staging:
    doc:
      short_help: Whether to use the letsencrypt staging server.
      help: |
        Whether to use the letsencrypt staging server.

        This is useful for developing -- the letsencrypt production server only allows a few requests per day. This option is disabled in the cli, as it is not used very often. Just use an overlay dict to enable this.
    type: boolean
    required: false
    default: false
  server_admin:
    type: string
    doc:
      short_help: The email address to use in the vhost file and with letsencrypt,
        falls back to 'wp_admin_email.
    required: false
  use_https:
    type: boolean
    required: false
    doc:
      short_help: Request a lets-encrypt certificate and serve devpi via https (needs
        'server_admin' or 'wp_admin_email' set).
    cli:
      is_flag: true
  webserver_user:
    doc:
      short_help: The user to run the webserver as.
    type: string
    required: false
    default: www-data
    cli:
      metavar: USERNAME
  webserver_group:
    doc:
      short_help: The group to run the webserver as (if applicable).
    type: string
    required: false
    default: www-data
    cli:
      metavar: GROUP
  webserver:
    doc:
      short_help: "The webserver to use, currently supported: 'apache', nginx'."
      references:
      - '[nginx wordpress vhost setup](https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/)'
    type: string
    allowed:
    - apache
    - nginx
    default: nginx
    required: false
  webserver_use_pagespeed:
    doc:
      short_help: Whether to install and use the pagespeed module.
      help: |
        Whether to install and use the pagespeed module.

        Only Nginx currently supported, when using this with Apache it will be ignored.
        Nginx will be built from source if set to true.
    type: boolean
    default: false
    cli:
      param_decls:
      - --use-pagespeed/--no-use-pagespeed
  wp_title:
    doc:
      short_help: The name of the wordpress instance.
    type: string
    required: true
    cli:
      metavar: TITLE
  wp_admin_name:
    doc:
      short_help: The name of the wordpress admin user.
    type: string
    required: false
    default: admin
    cli:
      metavar: USERNAME
  wp_admin_email:
    doc:
      short_help: The email of the wordpress admin user.
    required: true
    cli:
      metavar: EMAIL
  wp_admin_password:
    doc:
      short_help: The password of the wordpress admin user.
    required: true
    type: string
    secret: true
  wp_db_user:
    doc:
      short_help: The db user.
    type: string
    required: false
    default: wordpress
    cli:
      show_default: true
      metavar: DB_USER
  wp_db_host:
    doc:
      short_help: The db host.
    type: string
    required: false
    default: localhost
    cli:
      show_default: true
      metavar: HOST
  wp_db_password:
    doc:
      short_help: The password for the database.
    type: string
    required: true
    secret: true
  wp_db_import:
    doc:
      short_help: Whether to import a sql dump.
    type: boolean
    default: false
    required: false
    cli:
      is_flag: true
  wp_db_dump_file:
    doc:
      short_help: An (optional) database dump file.
    type: string
    required: false
    cli:
      metavar: PATH
  wp_db_name:
    doc:
      short_help: The name of the database to use.
    type: string
    required: false
    default: wp_database
    cli:
      show_default: true
      metavar: DB_NAME
  wp_db_table_prefix:
    doc:
      short_help: The wordpress db table prefix.
    type: string
    default: wp_
    required: false
    cli:
      show_default: true
      metavar: DB_PREFIX
  wp_plugins:
    doc:
      short_help: A list of plugins to install.
    type: list
    schema:
      type: dict
      schema:
        name:
          type: string
          required: true
        zip:
          type: string
          required: false
        url:
          type: string
          required: false
        activate:
          type: boolean
          default: true
          required: false
        force:
          type: boolean
          default: false
          required: false
    required: false
    default: []
    empty: true
    cli:
      metavar: PLUGIN
  wp_themes:
    doc:
      short_help: A list of themes to install.
    type: list
    schema:
      type: dict
      schema:
        name:
          type: string
          required: true
        activate:
          type: boolean
    required: false
    default: []
    empty: true
    cli:
      metavar: THEME
  wp_group:
    doc:
      short_help: The group who owns the project files.
    type: string
    required: false
    default: www-data
    cli:
      metavar: GROUP
  wp_user:
    doc:
      short_help: The user who owns the project files.
    type: string
    required: false
    default: www-data
    cli:
      metavar: USER
  wp_version:
    doc:
      short_help: The version of Wordpress.
    type: string
    required: false
    empty: false
  wp_project_path:
    doc:
      short_help: The path to the wordpress project folder, needs to contain the folder
        'wp-content'.
      help: |
        The path to the wordpress project folder.

        Contain the config file ('wp-config.php'), and the content
        folder ('wp-content').

        This is optional, if specified, this will be symbolically linked to the wordpress folder. Handy for managing wp-content with git.
    type: string
    required: false
    empty: false
    cli:
      metavar: PATH
  wp_content_parent:
    doc:
      short_help: The path relative to 'wp_project_path' that contains the 'wp-content'
        folder.
    type: string
    required: false
    default: ''
    cli:
      metavar: REL_PATH
  listen_ip:
    doc:
      short_help: The ip to listen to (necessary if using the Apache webserver).
      help: |
        The address to listen to, can be any of the following, optionally followed by a colon and a port number (or *):
          - The IP address of the virtual host;
          - A fully qualified domain name for the IP address of the virtual host (not recommended);
          - The character *, which acts as a wildcard and matches any IP address.
          - The string _default_, which is an alias for *
      references:
      - '[Apache VirtualHost documentation](https://httpd.apache.org/docs/current/mod/core.html#virtualhost)'
    type: string
    required: false
    default: _default_
  disable_ipv6:
    doc:
      short_help: Whether to disable ipv6 for this server block (only nginx supported
        for now).
    type: boolean
    required: false
    default: false
    cli:
      is_flag: true
      param_decls:
      - --disable-ipv6

meta:
  idempotent: false
  tags:
  - featured-frecklecutable
  - wordpress
  - standalone
  platforms:
    debian:
      debian:
      - stretch
    not_working:
      debian:
        ubuntu: 18.04.1

frecklets:
  # creating database & installing server if necessary
- mariadb-database-exists:
    db_import: '{{:: wp_db_import ::}}'
    db_dump_file: '{{:: wp_db_dump_file ::}}'
    db_name: '{{:: wp_db_name ::}}'
    db_user: '{{:: wp_db_user ::}}'
    db_user_password: '{{:: wp_db_password ::}}'
#      db_user_password: "{{:: db_pass ::}}"
#  # creating wordpress apache vhost
- wordpress-vhost-nginx:
    frecklet::skip: "{{:: webserver | false_if_equal('nginx') ::}}"
    webserver: '{{:: webserver ::}}'
    vhost_name: '{{:: vhost_name ::}}'
    wp_title: '{{:: wp_title ::}}'
    use_https: '{{:: use_https ::}}'
    host: '{{:: hostname ::}}'
    base_path: '{{:: base_path ::}}'
    server_admin: '{{:: server_admin ::}}'
    listen_ip: '{{:: listen_ip ::}}'
    disable_ipv6: '{{:: disable_ipv6 ::}}'
- wordpress-vhost-apache:
    frecklet::skip: "{{:: webserver | false_if_equal('apache') ::}}"
    webserver: '{{:: webserver ::}}'
    vhost_name: '{{:: vhost_name ::}}'
    wp_title: '{{:: wp_title ::}}'
    use_https: '{{:: use_https ::}}'
    host: '{{:: hostname ::}}'
    base_path: '{{:: base_path ::}}'
    server_admin: '{{:: server_admin ::}}'
    listen_ip: '{{:: listen_ip ::}}'
  # installing webserver and dependencies (php, https-cert...)
- webserver-service:
    webserver: '{{:: webserver ::}}'
    letsencrypt_webroot: '{{:: base_path ::}}/{{:: wp_title | clean_string | lower
      ::}}'
    use_https: '{{:: use_https | default(false) ::}}'
    letsencrypt_email: '{{:: server_admin | default(wp_admin_email, true) ::}}'
    letsencrypt_staging: '{{:: letsencrypt_staging ::}}'
    letsencrypt_domains:
    - '{{:: hostname ::}}'
    webserver_user: '{{:: webserver_user ::}}'
    webserver_group: '{{:: webserver_group ::}}'
    webserver_use_pagespeed: '{{:: webserver_use_pagespeed ::}}'
    webserver_nginx_config:
      nginx_client_max_body_size: 64m
    use_php: true
    php_packages:
      debian:
      - php-zip
      - php-curl
      - php-gd
      - php-mbstring
      - php-mcrypt
      - php-xml
      - php-xmlrpc
      - php-mysql
#          - libapache2-mod-php
  # making sure wordpress project document_root exists
- folder-exists:
    path: '{{:: base_path ::}}/{{:: wp_title | clean_string | lower ::}}'
    owner: '{{:: webserver_user ::}}'
    group: '{{:: webserver_group ::}}'
    mode: '0775'
    become: true
  # integrating our project source
- folders-intermingled:
    frecklet::skip: '{{:: wp_project_path | true_if_empty ::}}'
    become: true
    checkout_stage: '{{:: project_source | false_if_empty ::}}'
    checkout_src: '{{:: project_source ::}}'
    checkout_dest: '{{:: wp_project_path ::}}'
    checkout_force: true
    checkout_type: rsync
    checkout_folder_owner: '{{:: webserver_user ::}}'
    checkout_folder_group: '{{:: webserver_group ::}}'
    intermingle_stage: '{{:: wp_project_path | false_if_empty ::}}'
    intermingle_src: '{{:: wp_project_path ::}}/{{:: wp_content_parent ::}}'
    intermingle_target: '{{:: base_path ::}}/{{:: wp_title | clean_string | lower
      ::}}'
    intermingle_type: symlink
    intermingle_folder_owner: '{{:: webserver_user ::}}'
    intermingle_folder_group: '{{:: webserver_group ::}}'
    intermingle_config:
      interminglings:
        wp-content/themes/*: wp-content/themes
        wp-content/plugins/*: wp-content/plugins
  # installing Wordpress folders, setting up db tables and wp-config.php and such
- wordpress-folder-prepared:
    wordpress_installs:
    - name: '{{:: wp_title | clean_string | lower ::}}'
      dbname: '{{:: wp_db_name ::}}'
      dbuser: '{{:: wp_db_user ::}}'
      dbpass: '{{:: wp_db_password ::}}'
#          dbpass: "{{:: db_pass ::}}"
      dbhost: '{{:: wp_db_host ::}}'
      dbprefix: '{{:: wp_db_table_prefix ::}}'
      version: '{{:: wp_version ::}}'
      path: '{{:: base_path ::}}/{{:: wp_title | clean_string | lower ::}}'
      owner: '{{:: wp_user ::}}'
      group: '{{:: wp_group ::}}'
      url: "{{:: use_https | string_for_boolean('https', 'http') ::}}://{{:: hostname\
        \ ::}}"
      title: '{{:: wp_title ::}}'
      admin_name: '{{:: wp_admin_name ::}}'
      admin_email: '{{:: wp_admin_email ::}}'
      admin_password: '{{:: wp_admin_password ::}}'
      plugins: '{{:: wp_plugins | default([]) ::}}'
      themes: '{{:: wp_themes | default([]) ::}}'
      users: {}
      options: []
frecklecute wordpress-standalone --help

Usage: frecklecute wordpress-standalone [OPTIONS]

  Sets up [Wordpress](https://wordpress.com) on a machine, including
  dependencies (MariaDB, Apache/Nginx, LetsEncrypt).

  Optionally this frecklet can also checkout a folder with theme/plugin
  sources and [intermingle](https://TODO) it with the wordpress project
  folder, to support good version control and configuration management
  practices.

  If no 'wp_db_password' is specified, freckles will generate a random one.
  That doesn't really matter (and is arguably more secure), since we don't
  need to know it in most cases. If we need to find it, we can check the
  Wordpress config file for it.

Options:
  --hostname HOSTNAME             The hostname of the server.  [required]
  --wp-admin-email EMAIL          The email of the wordpress admin user.
                                  [required]
  --wp-admin-password WP_ADMIN_PASSWORD
                                  The password of the wordpress admin user.
                                  [required]
  --wp-db-password WP_DB_PASSWORD
                                  The password for the database.  [required]
  --wp-title TITLE                The name of the wordpress instance.
                                  [required]
  --base-path BASE_PATH           The wordpress project folders parent
                                  directory.
  --disable-ipv6                  Whether to disable ipv6 for this server
                                  block (only nginx supported for now).
  --letsencrypt-staging / --no-letsencrypt-staging
                                  Whether to use the letsencrypt staging
                                  server.
  --listen-ip LISTEN_IP           The ip to listen to (necessary if using the
                                  Apache webserver).
  --project-source PATH_OR_URL    The (optional) custom source code for this
                                  wordpress site.
  --server-admin SERVER_ADMIN     The email address to use in the vhost file
                                  and with letsencrypt, falls back to
                                  'wp_admin_email.
  --use-https / --no-use-https    Request a lets-encrypt certificate and serve
                                  devpi via https (needs 'server_admin' or
                                  'wp_admin_email' set).
  --vhost-name VHOST_NAME         The name of the vhost file.
  --webserver WEBSERVER           The webserver to use, currently supported:
                                  'apache', nginx'.
  --webserver-group GROUP         The group to run the webserver as (if
                                  applicable).
  --use-pagespeed / --no-use-pagespeed
                                  Whether to install and use the pagespeed
                                  module.
  --webserver-user USERNAME       The user to run the webserver as.
  --wp-admin-name USERNAME        The name of the wordpress admin user.
  --wp-content-parent REL_PATH    The path relative to 'wp_project_path' that
                                  contains the 'wp-content' folder.
  --wp-db-dump-file PATH          An (optional) database dump file.
  --wp-db-host HOST               The db host.
  --wp-db-import / --no-wp-db-import
                                  Whether to import a sql dump.
  --wp-db-name DB_NAME            The name of the database to use.
  --wp-db-table-prefix DB_PREFIX  The wordpress db table prefix.
  --wp-db-user DB_USER            The db user.
  --wp-group GROUP                The group who owns the project files.
  --wp-plugins PLUGIN             A list of plugins to install.
  --wp-project-path PATH          The path to the wordpress project folder,
                                  needs to contain the folder 'wp-content'.
  --wp-themes THEME               A list of themes to install.
  --wp-user USER                  The user who owns the project files.
  --wp-version WP_VERSION         The version of Wordpress.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.wordpress_standalone.WordpressStandalone
#


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

@dataclass
class WordpressStandalone(AutoPycklet):
    """Sets up [Wordpress](https://wordpress.com) on a machine, including dependencies
     (MariaDB, Apache/Nginx, LetsEncrypt).

     Optionally this frecklet can also checkout a folder with theme/plugin sources and
     [intermingle](https://TODO) it with the wordpress project folder, to support
     good version control and configuration management practices.

     If no 'wp_db_password' is specified, freckles will generate a random one. That doesn't really matter (and is arguably
     more secure), since we don't need to know it in most cases. If we need to find it, we can check the Wordpress config file for it.

       Args:
         base_path: The wordpress project folders parent directory.
         disable_ipv6: Whether to disable ipv6 for this server block (only nginx supported for now).
         hostname: The hostname of the server.
         letsencrypt_staging: Whether to use the letsencrypt staging server.
         listen_ip: The ip to listen to (necessary if using the Apache webserver).
         project_source: The (optional) custom source code for this wordpress site.
         server_admin: The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email.
         use_https: Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set).
         vhost_name: The name of the vhost file.
         webserver: The webserver to use, currently supported: 'apache', nginx'.
         webserver_group: The group to run the webserver as (if applicable).
         webserver_use_pagespeed: Whether to install and use the pagespeed module.
         webserver_user: The user to run the webserver as.
         wp_admin_email: The email of the wordpress admin user.
         wp_admin_name: The name of the wordpress admin user.
         wp_admin_password: The password of the wordpress admin user.
         wp_content_parent: The path relative to 'wp_project_path' that contains the 'wp-content' folder.
         wp_db_dump_file: An (optional) database dump file.
         wp_db_host: The db host.
         wp_db_import: Whether to import a sql dump.
         wp_db_name: The name of the database to use.
         wp_db_password: The password for the database.
         wp_db_table_prefix: The wordpress db table prefix.
         wp_db_user: The db user.
         wp_group: The group who owns the project files.
         wp_plugins: A list of plugins to install.
         wp_project_path: The path to the wordpress project folder, needs to contain the folder 'wp-content'.
         wp_themes: A list of themes to install.
         wp_title: The name of the wordpress instance.
         wp_user: The user who owns the project files.
         wp_version: The version of Wordpress.

    """

    FRECKLET_ID = "wordpress-standalone"

    base_path: str = None
    disable_ipv6: bool = None
    hostname: str = None
    letsencrypt_staging: bool = None
    listen_ip: str = None
    project_source: str = None
    server_admin: str = None
    use_https: bool = None
    vhost_name: str = None
    webserver: str = None
    webserver_group: str = None
    webserver_use_pagespeed: bool = None
    webserver_user: str = None
    wp_admin_email: str = None
    wp_admin_name: str = None
    wp_admin_password: str = None
    wp_content_parent: str = None
    wp_db_dump_file: str = None
    wp_db_host: str = None
    wp_db_import: bool = None
    wp_db_name: str = None
    wp_db_password: str = None
    wp_db_table_prefix: str = None
    wp_db_user: str = None
    wp_group: str = None
    wp_plugins: List = None
    wp_project_path: str = None
    wp_themes: List = None
    wp_title: str = None
    wp_user: str = None
    wp_version: str = None


    def __post_init__(self):
        super(WordpressStandalone, self).__init__(var_names=["base_path", "disable_ipv6", "hostname", "letsencrypt_staging", "listen_ip", "project_source", "server_admin", "use_https", "vhost_name", "webserver", "webserver_group", "webserver_use_pagespeed", "webserver_user", "wp_admin_email", "wp_admin_name", "wp_admin_password", "wp_content_parent", "wp_db_dump_file", "wp_db_host", "wp_db_import", "wp_db_name", "wp_db_password", "wp_db_table_prefix", "wp_db_user", "wp_group", "wp_plugins", "wp_project_path", "wp_themes", "wp_title", "wp_user", "wp_version"])


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


#
# module path: pycklets.wordpress_standalone.WordpressStandalone
#


from pyckles import AutoPycklet

class WordpressStandalone(AutoPycklet):
    """Sets up [Wordpress](https://wordpress.com) on a machine, including dependencies
     (MariaDB, Apache/Nginx, LetsEncrypt).

     Optionally this frecklet can also checkout a folder with theme/plugin sources and
     [intermingle](https://TODO) it with the wordpress project folder, to support
     good version control and configuration management practices.

     If no 'wp_db_password' is specified, freckles will generate a random one. That doesn't really matter (and is arguably
     more secure), since we don't need to know it in most cases. If we need to find it, we can check the Wordpress config file for it.

       Args:
         base_path: The wordpress project folders parent directory.
         disable_ipv6: Whether to disable ipv6 for this server block (only nginx supported for now).
         hostname: The hostname of the server.
         letsencrypt_staging: Whether to use the letsencrypt staging server.
         listen_ip: The ip to listen to (necessary if using the Apache webserver).
         project_source: The (optional) custom source code for this wordpress site.
         server_admin: The email address to use in the vhost file and with letsencrypt, falls back to 'wp_admin_email.
         use_https: Request a lets-encrypt certificate and serve devpi via https (needs 'server_admin' or 'wp_admin_email' set).
         vhost_name: The name of the vhost file.
         webserver: The webserver to use, currently supported: 'apache', nginx'.
         webserver_group: The group to run the webserver as (if applicable).
         webserver_use_pagespeed: Whether to install and use the pagespeed module.
         webserver_user: The user to run the webserver as.
         wp_admin_email: The email of the wordpress admin user.
         wp_admin_name: The name of the wordpress admin user.
         wp_admin_password: The password of the wordpress admin user.
         wp_content_parent: The path relative to 'wp_project_path' that contains the 'wp-content' folder.
         wp_db_dump_file: An (optional) database dump file.
         wp_db_host: The db host.
         wp_db_import: Whether to import a sql dump.
         wp_db_name: The name of the database to use.
         wp_db_password: The password for the database.
         wp_db_table_prefix: The wordpress db table prefix.
         wp_db_user: The db user.
         wp_group: The group who owns the project files.
         wp_plugins: A list of plugins to install.
         wp_project_path: The path to the wordpress project folder, needs to contain the folder 'wp-content'.
         wp_themes: A list of themes to install.
         wp_title: The name of the wordpress instance.
         wp_user: The user who owns the project files.
         wp_version: The version of Wordpress.

    """

    FRECKLET_ID = "wordpress-standalone"

    def __init__(self, base_path="/var/www", disable_ipv6=None, hostname=None, letsencrypt_staging=None, listen_ip="_default_", project_source=None, server_admin=None, use_https=None, vhost_name=None, webserver="nginx", webserver_group="www-data", webserver_use_pagespeed=None, webserver_user="www-data", wp_admin_email=None, wp_admin_name="admin", wp_admin_password=None, wp_content_parent=None, wp_db_dump_file=None, wp_db_host="localhost", wp_db_import=None, wp_db_name="wp_database", wp_db_password=None, wp_db_table_prefix="wp_", wp_db_user="wordpress", wp_group="www-data", wp_plugins=None, wp_project_path=None, wp_themes=None, wp_title=None, wp_user="www-data", wp_version=None):

        super(WordpressStandalone, self).__init__(var_names=["base_path", "disable_ipv6", "hostname", "letsencrypt_staging", "listen_ip", "project_source", "server_admin", "use_https", "vhost_name", "webserver", "webserver_group", "webserver_use_pagespeed", "webserver_user", "wp_admin_email", "wp_admin_name", "wp_admin_password", "wp_content_parent", "wp_db_dump_file", "wp_db_host", "wp_db_import", "wp_db_name", "wp_db_password", "wp_db_table_prefix", "wp_db_user", "wp_group", "wp_plugins", "wp_project_path", "wp_themes", "wp_title", "wp_user", "wp_version"])
        self._base_path = base_path
        self._disable_ipv6 = disable_ipv6
        self._hostname = hostname
        self._letsencrypt_staging = letsencrypt_staging
        self._listen_ip = listen_ip
        self._project_source = project_source
        self._server_admin = server_admin
        self._use_https = use_https
        self._vhost_name = vhost_name
        self._webserver = webserver
        self._webserver_group = webserver_group
        self._webserver_use_pagespeed = webserver_use_pagespeed
        self._webserver_user = webserver_user
        self._wp_admin_email = wp_admin_email
        self._wp_admin_name = wp_admin_name
        self._wp_admin_password = wp_admin_password
        self._wp_content_parent = wp_content_parent
        self._wp_db_dump_file = wp_db_dump_file
        self._wp_db_host = wp_db_host
        self._wp_db_import = wp_db_import
        self._wp_db_name = wp_db_name
        self._wp_db_password = wp_db_password
        self._wp_db_table_prefix = wp_db_table_prefix
        self._wp_db_user = wp_db_user
        self._wp_group = wp_group
        self._wp_plugins = wp_plugins
        self._wp_project_path = wp_project_path
        self._wp_themes = wp_themes
        self._wp_title = wp_title
        self._wp_user = wp_user
        self._wp_version = wp_version

    @property
    def base_path(self):
        return self._base_path

    @base_path.setter
    def base_path(self, base_path):
        self._base_path = base_path

    @property
    def disable_ipv6(self):
        return self._disable_ipv6

    @disable_ipv6.setter
    def disable_ipv6(self, disable_ipv6):
        self._disable_ipv6 = disable_ipv6

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

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

    @property
    def letsencrypt_staging(self):
        return self._letsencrypt_staging

    @letsencrypt_staging.setter
    def letsencrypt_staging(self, letsencrypt_staging):
        self._letsencrypt_staging = letsencrypt_staging

    @property
    def listen_ip(self):
        return self._listen_ip

    @listen_ip.setter
    def listen_ip(self, listen_ip):
        self._listen_ip = listen_ip

    @property
    def project_source(self):
        return self._project_source

    @project_source.setter
    def project_source(self, project_source):
        self._project_source = project_source

    @property
    def server_admin(self):
        return self._server_admin

    @server_admin.setter
    def server_admin(self, server_admin):
        self._server_admin = server_admin

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

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

    @property
    def vhost_name(self):
        return self._vhost_name

    @vhost_name.setter
    def vhost_name(self, vhost_name):
        self._vhost_name = vhost_name

    @property
    def webserver(self):
        return self._webserver

    @webserver.setter
    def webserver(self, webserver):
        self._webserver = webserver

    @property
    def webserver_group(self):
        return self._webserver_group

    @webserver_group.setter
    def webserver_group(self, webserver_group):
        self._webserver_group = webserver_group

    @property
    def webserver_use_pagespeed(self):
        return self._webserver_use_pagespeed

    @webserver_use_pagespeed.setter
    def webserver_use_pagespeed(self, webserver_use_pagespeed):
        self._webserver_use_pagespeed = webserver_use_pagespeed

    @property
    def webserver_user(self):
        return self._webserver_user

    @webserver_user.setter
    def webserver_user(self, webserver_user):
        self._webserver_user = webserver_user

    @property
    def wp_admin_email(self):
        return self._wp_admin_email

    @wp_admin_email.setter
    def wp_admin_email(self, wp_admin_email):
        self._wp_admin_email = wp_admin_email

    @property
    def wp_admin_name(self):
        return self._wp_admin_name

    @wp_admin_name.setter
    def wp_admin_name(self, wp_admin_name):
        self._wp_admin_name = wp_admin_name

    @property
    def wp_admin_password(self):
        return self._wp_admin_password

    @wp_admin_password.setter
    def wp_admin_password(self, wp_admin_password):
        self._wp_admin_password = wp_admin_password

    @property
    def wp_content_parent(self):
        return self._wp_content_parent

    @wp_content_parent.setter
    def wp_content_parent(self, wp_content_parent):
        self._wp_content_parent = wp_content_parent

    @property
    def wp_db_dump_file(self):
        return self._wp_db_dump_file

    @wp_db_dump_file.setter
    def wp_db_dump_file(self, wp_db_dump_file):
        self._wp_db_dump_file = wp_db_dump_file

    @property
    def wp_db_host(self):
        return self._wp_db_host

    @wp_db_host.setter
    def wp_db_host(self, wp_db_host):
        self._wp_db_host = wp_db_host

    @property
    def wp_db_import(self):
        return self._wp_db_import

    @wp_db_import.setter
    def wp_db_import(self, wp_db_import):
        self._wp_db_import = wp_db_import

    @property
    def wp_db_name(self):
        return self._wp_db_name

    @wp_db_name.setter
    def wp_db_name(self, wp_db_name):
        self._wp_db_name = wp_db_name

    @property
    def wp_db_password(self):
        return self._wp_db_password

    @wp_db_password.setter
    def wp_db_password(self, wp_db_password):
        self._wp_db_password = wp_db_password

    @property
    def wp_db_table_prefix(self):
        return self._wp_db_table_prefix

    @wp_db_table_prefix.setter
    def wp_db_table_prefix(self, wp_db_table_prefix):
        self._wp_db_table_prefix = wp_db_table_prefix

    @property
    def wp_db_user(self):
        return self._wp_db_user

    @wp_db_user.setter
    def wp_db_user(self, wp_db_user):
        self._wp_db_user = wp_db_user

    @property
    def wp_group(self):
        return self._wp_group

    @wp_group.setter
    def wp_group(self, wp_group):
        self._wp_group = wp_group

    @property
    def wp_plugins(self):
        return self._wp_plugins

    @wp_plugins.setter
    def wp_plugins(self, wp_plugins):
        self._wp_plugins = wp_plugins

    @property
    def wp_project_path(self):
        return self._wp_project_path

    @wp_project_path.setter
    def wp_project_path(self, wp_project_path):
        self._wp_project_path = wp_project_path

    @property
    def wp_themes(self):
        return self._wp_themes

    @wp_themes.setter
    def wp_themes(self, wp_themes):
        self._wp_themes = wp_themes

    @property
    def wp_title(self):
        return self._wp_title

    @wp_title.setter
    def wp_title(self, wp_title):
        self._wp_title = wp_title

    @property
    def wp_user(self):
        return self._wp_user

    @wp_user.setter
    def wp_user(self, wp_user):
        self._wp_user = wp_user

    @property
    def wp_version(self):
        return self._wp_version

    @wp_version.setter
    def wp_version(self, wp_version):
        self._wp_version = wp_version



frecklet_class = WordpressStandalone