Skip to content

Instantly share code, notes, and snippets.

@peter-mw
Last active February 25, 2019 14:37
Show Gist options
  • Save peter-mw/73aabe83d7942ce0bbca10d2d80c09db to your computer and use it in GitHub Desktop.
Save peter-mw/73aabe83d7942ce0bbca10d2d80c09db to your computer and use it in GitHub Desktop.

Revisions

  1. peter-mw revised this gist Jul 19, 2018. No changes.
  2. peter-mw revised this gist Jul 19, 2018. No changes.
  3. peter-mw revised this gist Jul 18, 2018. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -57,10 +57,8 @@ downloadcms:
    unzip -qq /tmp/microweber-latest.zip -d /var/www/microweber
    wget -q https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    wget -q https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    php /var/www/microweber/artisan cache:clear
    php /var/www/microweber/artisan microweber:install [email protected] admin password 127.0.0.1 microweber microweber $(</tmp/mysqlpass) -p site_ -t dream -d 1 -c 1
    chown -R apache:apache /var/www/microweber
    @@ -78,7 +76,6 @@ setupfirewall:
    - &setup_firewall |
    firewall-offline-cmd --zone=public --add-port=80/tcp
    firewall-offline-cmd --zone=public --add-port=443/tcp
    # firewall-offline-cmd --zone=public --add-port=22/tcp
    service firewalld restart
    systemctl enable firewalld

  4. peter-mw revised this gist Jul 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ setupfirewall:
    - &setup_firewall |
    firewall-offline-cmd --zone=public --add-port=80/tcp
    firewall-offline-cmd --zone=public --add-port=443/tcp
    firewall-offline-cmd --zone=public --add-port=22/tcp
    # firewall-offline-cmd --zone=public --add-port=22/tcp
    service firewalld restart
    systemctl enable firewalld

  5. peter-mw revised this gist Jul 11, 2018. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -53,12 +53,12 @@ restartapache:
    downloadcms:
    - &download_cms |
    mkdir /var/www/microweber
    wget http://download.microweberapi.com/ready/core/microweber-latest.zip -O /tmp/microweber-latest.zip
    wget -q http://download.microweberapi.com/ready/core/microweber-latest.zip -O /tmp/microweber-latest.zip
    unzip -qq /tmp/microweber-latest.zip -d /var/www/microweber
    wget https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
    wget -q https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    wget https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    wget -q https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    php /var/www/microweber/artisan cache:clear
    @@ -69,7 +69,6 @@ downloadcms:

    makeauths:
    - &make_auths |
    su -c /usr/bin/cschpw/global.sh
    echo 'sh /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    service sshd restart
  6. peter-mw revised this gist Jul 11, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,7 @@ downloadcms:
    makeauths:
    - &make_auths |
    su -c /usr/bin/cschpw/global.sh
    echo '/usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    echo 'sh /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    service sshd restart

  7. peter-mw revised this gist Jul 11, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -54,9 +54,9 @@ downloadcms:
    - &download_cms |
    mkdir /var/www/microweber
    wget http://download.microweberapi.com/ready/core/microweber-latest.zip -O /tmp/microweber-latest.zip
    unzip /tmp/microweber-latest.zip -d /var/www/microweber
    unzip -qq /tmp/microweber-latest.zip -d /var/www/microweber
    wget https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
    unzip /tmp/userfiles.zip -d /var/www/microweber
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    wget https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber
  8. peter-mw revised this gist Jul 11, 2018. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ downloadcms:
    unzip /tmp/userfiles.zip -d /var/www/microweber

    wget https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    unzip /tmp/userfiles.zip -d /var/www/microweber
    unzip -qq /tmp/userfiles.zip -d /var/www/microweber

    php /var/www/microweber/artisan cache:clear
    php /var/www/microweber/artisan microweber:install [email protected] admin password 127.0.0.1 microweber microweber $(</tmp/mysqlpass) -p site_ -t dream -d 1 -c 1
    @@ -70,7 +70,8 @@ downloadcms:
    makeauths:
    - &make_auths |
    su -c /usr/bin/cschpw/global.sh
    echo 'su -c /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    echo '/usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    service sshd restart


  9. peter-mw revised this gist Jul 11, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,9 @@ setupfirewall:
    - &setup_firewall |
    firewall-offline-cmd --zone=public --add-port=80/tcp
    firewall-offline-cmd --zone=public --add-port=443/tcp
    firewall-offline-cmd --zone=public --add-port=22/tcp
    service firewalld restart
    systemctl enable firewalld

    runcmd:
    - [ sh, -c, *install_lamp ]
  10. peter-mw revised this gist Jul 11, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@ packages:
    - epel-release
    - httpd
    - mariadb
    - mariadb-server
    - unzip

    installlamp:
    @@ -40,10 +41,14 @@ configmysql:
    mysql -e "CREATE USER microweber@localhost IDENTIFIED BY '$(</tmp/mysqlpass)';"
    mysql -e "GRANT ALL PRIVILEGES ON microweber.* TO 'microweber'@'localhost';"
    mysql -e "FLUSH PRIVILEGES;"
    systemctl enable mariadb


    restartapache:
    - &restart_apache |
    service httpd restart
    systemctl enable httpd


    downloadcms:
    - &download_cms |
  11. peter-mw revised this gist Jul 11, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloudinit cloudsigma
    Original file line number Diff line number Diff line change
    @@ -60,7 +60,7 @@ downloadcms:
    php /var/www/microweber/artisan microweber:install [email protected] admin password 127.0.0.1 microweber microweber $(</tmp/mysqlpass) -p site_ -t dream -d 1 -c 1
    chown -R apache:apache /var/www/microweber
    chmod -R 755 /var/www/microweber
    chcon -Rv --type=httpd_sys_rw_content_t /var/www/microweber
    chcon -R --type=httpd_sys_rw_content_t /var/www/microweber

    makeauths:
    - &make_auths |
  12. peter-mw renamed this gist Jul 9, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  13. peter-mw created this gist Jul 9, 2018.
    98 changes: 98 additions & 0 deletions cloudinit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,98 @@
    #cloud-config

    package_update: true
    package_upgrade: false

    packages:
    - ca-certificates
    - epel-release
    - httpd
    - mariadb
    - unzip

    installlamp:
    - &install_lamp |
    rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
    yum --enablerepo=remi-php72 install php php-fpm php-mysql php-mcrypt php-mbstring php-json php-imap php-intl php-gd php-curl php-xml -y

    configapache:
    - &config_apache |
    cat > /etc/httpd/conf.d/microweber.conf <<EOF
    NameVirtualHost *:80
    <VirtualHost *:80>
    UseCanonicalName off
    Options All
    DocumentRoot /var/www/microweber
    <Directory /var/www/microweber>
    AllowOverride All
    </Directory>
    ErrorLog /var/log/microweber-error.log
    LogLevel warn
    CustomLog /var/log/microweber-access.log combined
    </VirtualHost>
    EOF

    configmysql:
    - &config_mysql |
    echo $(openssl rand -base64 12) > /tmp/mysqlpass
    mysql -e "CREATE DATABASE microweber /*\!40100 DEFAULT CHARACTER SET utf8 */;"
    mysql -e "CREATE USER microweber@localhost IDENTIFIED BY '$(</tmp/mysqlpass)';"
    mysql -e "GRANT ALL PRIVILEGES ON microweber.* TO 'microweber'@'localhost';"
    mysql -e "FLUSH PRIVILEGES;"

    restartapache:
    - &restart_apache |
    service httpd restart

    downloadcms:
    - &download_cms |
    mkdir /var/www/microweber
    wget http://download.microweberapi.com/ready/core/microweber-latest.zip -O /tmp/microweber-latest.zip
    unzip /tmp/microweber-latest.zip -d /var/www/microweber
    wget https://members.microweber.com/_partners/csigma/userfiles.zip -O /tmp/userfiles.zip
    unzip /tmp/userfiles.zip -d /var/www/microweber

    wget https://microweber.com/download.php?templates_key=T3fOU5Zfw11%3Ac%21 -O /tmp/userfiles.zip
    unzip /tmp/userfiles.zip -d /var/www/microweber

    php /var/www/microweber/artisan cache:clear
    php /var/www/microweber/artisan microweber:install [email protected] admin password 127.0.0.1 microweber microweber $(</tmp/mysqlpass) -p site_ -t dream -d 1 -c 1
    chown -R apache:apache /var/www/microweber
    chmod -R 755 /var/www/microweber
    chcon -Rv --type=httpd_sys_rw_content_t /var/www/microweber

    makeauths:
    - &make_auths |
    su -c /usr/bin/cschpw/global.sh
    echo 'su -c /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    service sshd restart


    setupfirewall:
    - &setup_firewall |
    firewall-offline-cmd --zone=public --add-port=80/tcp
    firewall-offline-cmd --zone=public --add-port=443/tcp
    service firewalld restart

    runcmd:
    - [ sh, -c, *install_lamp ]
    - touch /tmp/done1
    - [ sh, -c, *config_mysql ]
    - touch /tmp/done2
    - [ sh, -c, *download_cms ]
    - touch /tmp/done3
    - [ sh, -c, *config_apache ]
    - touch /tmp/done4
    - [ sh, -c, *restart_apache ]
    - touch /tmp/done5
    - [ sh, -c, *make_auths ]
    - touch /tmp/done6
    - [ sh, -c, *setup_firewall ]
    # - [ sh, -c, /usr/bin/cschpw/global.sh ]
    - touch /tmp/done7
    - touch /tmp/done8
    # - echo 'su /usr/bin/cschpw/ssh_meta.sh' >> /etc/rc.d/rc.local
    # - echo 'su /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
    # - service sshd restart
    - touch /tmp/done9