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.
#cloud-config
package_update: true
package_upgrade: false
packages:
- ca-certificates
- epel-release
- httpd
- mariadb
- mariadb-server
- 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;"
systemctl enable mariadb
restartapache:
- &restart_apache |
service httpd restart
systemctl enable httpd
downloadcms:
- &download_cms |
mkdir /var/www/microweber
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 -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
chmod -R 755 /var/www/microweber
chcon -R --type=httpd_sys_rw_content_t /var/www/microweber
makeauths:
- &make_auths |
echo 'sh /usr/bin/cschpw/global.sh' >> /etc/rc.d/rc.local
chmod +x /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
systemctl enable firewalld
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment