Advertisement
wrayan

openxchange poc

Apr 17th, 2016
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 12.63 KB | None | 0 0
  1. # Open-Xchange App Suite POC
  2. # works with Ubuntu 14.04 LTS cloud image: https://cloud-images.ubuntu.com/trusty/
  3. # implements install guide: http://oxpedia.org/wiki/index.php?title=AppSuite:Open-Xchange_Installation_Guide_for_Debian_7.0
  4.  
  5. heat_template_version: 2014-10-16
  6.  
  7. description: >
  8.  OpenXchange POC
  9.   Creates a single-node OX App Suite test setup
  10. parameters:
  11.   public_network_id:
  12.     type: string
  13.     default: insert_floating_ip_network_id_here
  14.   image:
  15.     type: string
  16.     default: Ubuntu-14.04-LTS from cloud-images.ubuntu.com
  17.   flavor:
  18.     type: string
  19.     default: insert_your_vm_flavor_here
  20.   key_name:
  21.     type: string
  22.     default: insert_name_of_ssh_key
  23.   oxconfigdb_pass:
  24.     type: string
  25.     default: database_pass_changeme
  26.   oxadminmaster_pass:
  27.     type: string
  28.     default: oxadminmaster_pass_changeme
  29.   oxadmin_pass:
  30.     type: string
  31.     default: oxadmin_pass_changeme
  32.   oxadmin_email:
  33.     type: string
  34.     default: oxadmin@example.org
  35.  
  36. resources:
  37.   ox_instance:
  38.     type: OS::Nova::Server
  39.     properties:
  40.       name:
  41.         list_join:
  42.          - '-'
  43.           - [ 'instance', 'heat', { get_param: 'OS::stack_name' } ]
  44.       image: { get_param: image }
  45.       flavor: { get_param: flavor }
  46.       key_name: { get_param: key_name }
  47.       user_data_format: RAW
  48.       user_data: { get_resource: cloud_init }
  49.       networks:
  50.         - port: { get_resource: ox_port }
  51.  
  52.   ox_volume_mysql:
  53.     type: OS::Cinder::Volume
  54.     properties:
  55.       description: ox mysql volume
  56.       name:
  57.         list_join:
  58.          - '-'
  59.           - [ 'vm', 'heat', { get_param: 'OS::stack_name' }, 'volume', 'mysql' ]
  60.       size: 50
  61.  
  62.   ox_volume_mysql_attach:
  63.     depends_on: [ ox_instance, ox_volume_mysql ]
  64.     type: OS::Cinder::VolumeAttachment
  65.     properties:
  66.       instance_uuid: { get_resource: ox_instance }
  67.       volume_id: { get_resource: ox_volume_mysql }
  68.  
  69.   ox_volume_files:
  70.     type: OS::Cinder::Volume
  71.     properties:
  72.       description: ox files volume
  73.       name:
  74.         list_join:
  75.          - '-'
  76.           - [ 'vm', 'heat', { get_param: 'OS::stack_name' }, 'volume', 'files' ]
  77.       size: 50
  78.  
  79.   ox_volume_files_attach:
  80.     depends_on: [ ox_instance, ox_volume_files ]
  81.     type: OS::Cinder::VolumeAttachment
  82.     properties:
  83.       instance_uuid: { get_resource: ox_instance }
  84.       volume_id: { get_resource: ox_volume_files }
  85.  
  86.   ox_port:
  87.     type: OS::Neutron::Port
  88.     properties:
  89.       network_id: { get_resource: network }
  90.       security_groups: [ { get_resource: server_security_group } ]
  91.  
  92.   ox_floating_ip:
  93.     type: OS::Neutron::FloatingIP
  94.     properties:
  95.       floating_network: { get_param: public_network_id }
  96.       port_id: { get_resource: ox_port }
  97.  
  98.   network:
  99.     type: OS::Neutron::Net
  100.     properties:
  101.       name:
  102.         list_join:
  103.          - '-'
  104.           - [ 'net', 'heat', { get_param: 'OS::stack_name' } ]
  105.  
  106.   subnet:
  107.     type: OS::Neutron::Subnet
  108.     depends_on: [ router, network ]
  109.     properties:
  110.       name:
  111.         list_join:
  112.          - '-'
  113.           - [ 'subnet', 'heat', { get_param: 'OS::stack_name' } ]
  114.       dns_nameservers:
  115.        - 8.8.8.8
  116.       network_id: { get_resource: network }
  117.       ip_version: 4
  118.       cidr: 10.0.0.0/24
  119.       gateway_ip : 10.0.0.1
  120.       allocation_pools:
  121.       - { start: 10.0.0.10, end: 10.0.0.250 }
  122.  
  123.   router:
  124.     type: OS::Neutron::Router
  125.     properties:
  126.       external_gateway_info: { "network": { get_param: public_network_id } }
  127.       name:
  128.         list_join:
  129.          - '-'
  130.           - [ 'router', 'heat', { get_param: 'OS::stack_name' } ]
  131.  
  132.   router_subnet_bridge:
  133.     type: OS::Neutron::RouterInterface
  134.     depends_on: [ subnet, router ]
  135.     properties:
  136.       router_id: { get_resource: router }
  137.       subnet: { get_resource: subnet }
  138.  
  139.   server_security_group:
  140.     type: OS::Neutron::SecurityGroup
  141.     properties:
  142.       description: security group for onevm
  143.       name:
  144.         list_join:
  145.          - '-'
  146.           - [ 'secgroup', 'heat', { get_param: 'OS::stack_name' } ]
  147.       rules: [
  148.         { remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 22, port_range_max: 22 },
  149.         { remote_ip_prefix: 0.0.0.0/0, protocol: tcp, port_range_min: 80, port_range_max: 80 },
  150.         { remote_ip_prefix: 0.0.0.0/0, protocol: icmp },
  151.         { remote_ip_prefix: 10.0.0.0/8, protocol: tcp, port_range_min: 1, port_range_max: 65535 },
  152.         { remote_ip_prefix: 10.0.0.0/8, protocol: udp, port_range_min: 1, port_range_max: 65535 },
  153.       ]
  154.  
  155.   cloud_init:
  156.     type: OS::Heat::CloudConfig
  157.     properties:
  158.       cloud_config:
  159.         bootcmd:
  160.          - /bin/echo -e 'nameserver 8.8.8.8\nsearch example.org' > /etc/resolv.conf
  161.         write_files:
  162.           - content: |
  163.              #!/bin/bash
  164.               voldata_dev="/dev/disk/by-id/virtio-${1:0:20}"
  165.               if [ -e "$voldata_dev" ]; then
  166.                 if [[ -z $2 ]]; then
  167.                   mountpoint="/mnt/${1:0:20}"
  168.                 else
  169.                   mountpoint="$2"
  170.                 fi
  171.                 if mountpoint "$mountpoint"; then
  172.                   echo "ERROR: already mounted!"
  173.                   exit 1
  174.                 fi
  175.                 mkfs.xfs "$voldata_dev" &&
  176.                 ( grep "^$voldata_dev" /etc/fstab &>/dev/null ||
  177.                   echo "$voldata_dev $mountpoint xfs defaults 1 2" >> /etc/fstab ) &&
  178.                 (
  179.                   if [ -d "$mountpoint" ]; then
  180.                     mnt_user=$(stat -c '%U' "$mountpoint")
  181.                     mnt_group=$(stat -c '%G' "$mountpoint")
  182.                     mnt_perm=$(stat -c '%a' "$mountpoint")
  183.                     mv "$mountpoint" "${mountpoint}.orig" &&
  184.                     mkdir "$mountpoint" &&
  185.                     mount "$mountpoint" &&
  186.                     chown ${mnt_user}:${mnt_group} "$mountpoint" &&
  187.                     chmod ${mnt_perm} "$mountpoint" &&
  188.                     mv "${mountpoint}.orig"/* "${mountpoint}"/ &&
  189.                     rmdir "${mountpoint}.orig"
  190.                   else
  191.                     mkdir -pv "$mountpoint" &&
  192.                     mount "$mountpoint"
  193.                   fi
  194.                 )
  195.               fi
  196.             path: /usr/local/sbin/format_vol
  197.             permissions: '0700'
  198.           - content: |
  199.              <VirtualHost *:80>
  200.                 ServerAdmin webmaster@localhost
  201.  
  202.                 DocumentRoot /var/www
  203.  
  204.                 <Directory /var/www>
  205.                   Options Indexes FollowSymLinks MultiViews
  206.                   AllowOverride None
  207.                   Order allow,deny
  208.                   allow from all
  209.                   RedirectMatch ^/$ /appsuite/
  210.                 </Directory>
  211.  
  212.                 <Directory /var/www/appsuite>
  213.                   Options None +SymLinksIfOwnerMatch
  214.                   AllowOverride Indexes FileInfo
  215.                 </Directory>
  216.               </VirtualHost>
  217.             path: /etc/apache2/sites-available/ox.conf
  218.             permissions: '0644'
  219.           - content: |
  220.              <IfModule mod_proxy_http.c>
  221.                 ProxyRequests Off
  222.                 ProxyStatus On
  223.                 ProxyPreserveHost On
  224.                 <Location /webservices>
  225.                   Order Deny,Allow
  226.                   Deny from all
  227.                   Allow from 127.0.0.1
  228.                 </Location>
  229.                 <Location /servlet/axis2/services>
  230.                   Order Deny,Allow
  231.                   Deny from all
  232.                   Allow from 127.0.0.1
  233.                 </Location>
  234.                 <IfModule mod_status.c>
  235.                   <Location /balancer-manager>
  236.                     SetHandler balancer-manager
  237.                     Order Deny,Allow
  238.                     Deny from all
  239.                     Allow from 127.0.0.1
  240.                   </Location>
  241.                 </IfModule>
  242.                 <Proxy balancer://oxcluster>
  243.                   Order deny,allow
  244.                   Allow from all
  245.                   BalancerMember http://localhost:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1
  246.                   ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
  247.                   SetEnv proxy-initial-not-pooled
  248.                   SetEnv proxy-sendchunked
  249.                 </Proxy>
  250.                 <Proxy balancer://eas_oxcluster>
  251.                   Order deny,allow
  252.                   Allow from all
  253.                   BalancerMember http://localhost_sync:8009 timeout=1900 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1
  254.                   ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
  255.                   SetEnv proxy-initial-not-pooled
  256.                   SetEnv proxy-sendchunked
  257.                 </Proxy>
  258.                 ProxyPass /ajax balancer://oxcluster/ajax
  259.                 ProxyPass /appsuite/api balancer://oxcluster/ajax
  260.                 ProxyPass /drive balancer://oxcluster/drive
  261.                 ProxyPass /infostore balancer://oxcluster/infostore
  262.                 ProxyPass /publications balancer://oxcluster/publications
  263.                 ProxyPass /realtime balancer://oxcluster/realtime
  264.                 ProxyPass /servlet balancer://oxcluster/servlet
  265.                 ProxyPass /webservices balancer://oxcluster/webservices
  266.                 ProxyPass /usm-json balancer://eas_oxcluster/usm-json
  267.                 ProxyPass /Microsoft-Server-ActiveSync balancer://eas_oxcluster/Microsoft-Server-ActiveSync
  268.               </IfModule>
  269.             path: /etc/apache2/conf-available/proxy_http.conf
  270.             permissions: '0644'
  271.         apt_sources:
  272.           - source: deb http://software.open-xchange.com/products/appsuite/stable/appsuiteui/DebianWheezy/ /
  273.             keyid: EED949F0
  274.             filename: open-xchange.list
  275.           - source: deb http://software.open-xchange.com/products/appsuite/stable/backend/DebianWheezy/ /
  276.             keyid: EED949F0
  277.             filename: open-xchange.list
  278.         packages:
  279.          - xfsprogs
  280.           - mysql-server
  281.           - open-xchange
  282.           - open-xchange-authentication-database
  283.           - open-xchange-grizzly
  284.           - open-xchange-admin
  285.           - open-xchange-appsuite
  286.           - open-xchange-appsuite-backend
  287.           - open-xchange-appsuite-manifest
  288.         runcmd:
  289.          - /usr/sbin/service mysql stop
  290.           - [ /usr/local/sbin/format_vol,
  291.               { get_resource: ox_volume_mysql },
  292.               /var/lib/mysql ]
  293.           - /usr/sbin/service mysql start
  294.           - [ /usr/local/sbin/format_vol,
  295.               { get_resource: ox_volume_files },
  296.               /var/opt/filestore ]
  297.           - /bin/sed -i "s/127.0.0.1 localhost/127.0.0.1 localhost.localdomain localhost localhost_sync\n127.0.1.1 $(cat /etc/hostname) oxserver/g" /etc/hosts
  298.           - /usr/sbin/a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests expires deflate headers rewrite mime setenvif
  299.           - /usr/sbin/a2enconf proxy_http
  300.           - /usr/sbin/a2dissite 000-default
  301.           - /usr/sbin/a2ensite ox
  302.           - /usr/sbin/service apache2 restart
  303.           - [ /opt/open-xchange/sbin/initconfigdb,
  304.               -a,
  305.               --configdb-pass, { get_param: oxconfigdb_pass } ]
  306.           - [ /opt/open-xchange/sbin/oxinstaller,
  307.               --no-license,
  308.               --servername, oxserver,
  309.               --network-listener-host, localhost,
  310.               --servermemory, 8192,
  311.               --configdb-pass, { get_param: oxconfigdb_pass },
  312.               --master-pass, { get_param: oxadminmaster_pass } ]
  313.           - /usr/sbin/service open-xchange start
  314.           - sleep 10
  315.           - [ /opt/open-xchange/sbin/registerserver,
  316.               -n, oxserver,
  317.               -A, oxadminmaster,
  318.               -P, { get_param: oxadminmaster_pass } ]
  319.           - [ /opt/open-xchange/sbin/registerfilestore,
  320.               -t, 'file:/var/opt/filestore',
  321.               -s, 49152,
  322.               -A, oxadminmaster,
  323.               -P, { get_param: oxadminmaster_pass } ]
  324.           - [ /opt/open-xchange/sbin/registerdatabase,
  325.               -m, true,
  326.               -A, oxadminmaster,
  327.               -P, { get_param: oxadminmaster_pass },
  328.               -n, oxdatabase,
  329.               -p, { get_param: oxconfigdb_pass } ]
  330.           - [ /opt/open-xchange/sbin/createcontext,
  331.               -A, oxadminmaster,
  332.               -P, { get_param: oxadminmaster_pass },
  333.               -L, defaultcontext,
  334.               -q, 1024,
  335.               --access-combination-name, groupware_standard,
  336.               -c, 1,
  337.               -u, oxadmin,
  338.               -d, Context Admin,
  339.               -g, Admin,
  340.               -s, User,
  341.               -p, { get_param: oxadmin_pass },
  342.               -e, { get_param: oxadmin_email } ]
  343.           - echo 'PATH="/opt/open-xchange/sbin:$PATH"' >> /root/.bashrc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement