Skip to content

Instantly share code, notes, and snippets.

@sergmelikyan
Created October 18, 2016 02:09
Show Gist options
  • Save sergmelikyan/572e6269e1768542a1b5004b94bfbd91 to your computer and use it in GitHub Desktop.
Save sergmelikyan/572e6269e1768542a1b5004b94bfbd91 to your computer and use it in GitHub Desktop.
Plone CMS deployment using Heat and "Unified Plone UNIX Installer"
heat_template_version: 2013-05-23
parameters:
key_name:
type: string
description: Name of an existing key pair to use for the server
constraints:
- custom_constraint: nova.keypair
flavor:
type: string
description: Flavor for the server to be created
default: m1.small
constraints:
- custom_constraint: nova.flavor
image:
type: string
description: Image ID or image name to use for the server
constraints:
- custom_constraint: glance.image
admin_pass:
type: string
description: Admin password
hidden: true
constraints:
- length: { min: 6, max: 8 }
description: Password length must be between 6 and 8 characters
- allowed_pattern: "[a-zA-Z0-9]+"
description: Password must consist of characters and numbers only
- allowed_pattern: "[A-Z]+[a-zA-Z0-9]*"
description: Password must start with an uppercase character
webserver_port:
type: number
description: Webserver port number
default: 8080
constraints:
- range: { min: 1024, max: 60000 }
description: Port number must be between 1024 and 60000
network:
type: string
description: Name or ID of Neutron network into which servers get deployed
subnet:
type: string
description: Name or ID of Neutron sub network into which servers get deployed
resources:
server:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image }
flavor: { get_param: flavor }
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/bash
echo "Installing Plone in standalone mode"
sudo apt-get update
# Install the operating system software and libraries needed to run Plone:
sudo apt-get -y install python-setuptools python-dev build-essential libssl-dev libxml2-dev libxslt1-dev libbz2-dev libjpeg62-dev
# Install optional system packages for the handling of PDF and Office files. Can be omitted:
sudo apt-get -y install libreadline-dev wv poppler-utils
# Download the latest Plone unified installer:
wget --no-check-certificate https://launchpad.net/plone/5.0/5.0.4/+download/Plone-5.0.4-UnifiedInstaller.tgz
# Unzip the latest Plone unified installer:
tar -xvf Plone-5.0.4-UnifiedInstaller.tgz
cd Plone-5.0.4-UnifiedInstaller
# Set the port that Plone will listen to on available network interfaces. Editing "http-address" param in buildout.cfg file:
sed -i "s/^http-address = [0-9]*$/http-address = webserver_port/" buildout_templates/buildout.cfg
# Run the Plone installer in standalone mode
./install.sh --password="admin_pass" --target="/opt/plone" standalone
# Add init.d script
sudo cp ./init_scripts/ubuntu/plone-standalone /etc/init.d/plone
sudo chmod 755 /etc/init.d/plone
sudo update-rc.d plone defaults
# Start Plone
/opt/plone/zinstance/bin/plonectl start
params:
webserver_port: { get_param: webserver_port }
admin_pass: { get_param: admin_pass }
networks:
- port: { get_resource: server_port }
server_port:
type: OS::Neutron::Port
properties:
network: { get_param: network }
fixed_ips:
- subnet: { get_param: subnet }
security_groups: [{ get_resource: server_security_group }]
server_security_group:
type: OS::Neutron::SecurityGroup
properties:
name: plone-security-group
rules: [
{remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 8080, port_range_max: 8080},
{remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22},
{remote_ip_prefix: 0.0.0.0/0, protocol: icmp}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment