Skip to content

Instantly share code, notes, and snippets.

@Pishoy
Created February 20, 2019 10:30
Show Gist options
  • Save Pishoy/b1667a5d3d49788061622f68af3853ea to your computer and use it in GitHub Desktop.
Save Pishoy/b1667a5d3d49788061622f68af3853ea to your computer and use it in GitHub Desktop.
[startup.sshdkeys]
name = "bash"
after = ["init"]
running_delay = -1
[startup.sshdkeys.args]
script = """
chmod 400 -R /etc/ssh/
mkdir -p /run/sshd
"""
[startup.sshd]
name = "core.system"
after = ["sshdkeys"]
[startup.sshd.args]
name = "/usr/sbin/sshd"
args = ["-e", "-D"]
[startup.sshdkeys]
name = "bash"
running_delay = -1
[startup.mysql.intialization]
name = "bash"
after = ["init"]
running_delay = -1
[startup.mysql.intialization.args]
script = """
chown -R mysql /var/lib/mysql/
chown -R mysql /var/log/mysql/
chown -R mysql /var/run/mysqld/
find /var/lib/mysql/ -maxdepth 0 -empty -exec /usr/sbin/mysqld --initialize-insecure --user=mysql --datadir=/var/lib/mysql/ \\;
"""
[startup.mysql]
name = "core.system"
after = ["mysql.intialization"]
protected = true
[startup.mysql.args]
name = "mysqld"
[startup.apache]
name = "core.system"
protected = true
after = ["setup"]
[startup.apache.args]
name = "apachectl"
args = [
"-DFOREGROUND"
]
[startup.cron1]
name = "bash"
recurring_period = 60
[startup.cron1.args]
script = """
/usr/bin/php /var/www/html/humhub/protected/yii queue/run >/dev/null 2>&
"""
[startup.cron2]
name = "bash"
recurring_period=60
[startup.cron2.args]
script = """
/usr/bin/php /var/www/html/humhub/protected/yii cron/run >/dev/null 2>&1
"""
[startup.setup]
name = "bash"
running_delay = -1
[startup.setup.args]
script = """
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
export HOME=/root
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
[ -d /root/.ssh/ ] || mkdir /root/.ssh
[ \"$(find /var/www/html/humhub -maxdepth 0 -empty)\" ] && (cd /var/www/html ; wget https://www.humhub.org/en/download/package/humhub-1.3.9.tar.gz;tar -xvf humhub-1.3.9.tar.gz --strip-components=1 --directory /var/www/html/humhub > /dev/null)
# verify that below files are exist
iyo_file=\"/var/www/html/humhub/protected/humhub/modules/user/authclient/IYO.php\"
common_file=\"/var/www/html/humhub/protected/config/common.php\"
[ -f \"$iyo_file\" ] || wget https://raw.githubusercontent.com/threefoldgrid/freeflow/master/utils/IYO.php -O $iyo_file
[ -f \"$common_file\" ] || wget https://raw.githubusercontent.com/threefoldgrid/freeflow/master/utils/common.php -O $common_file
chown -R www-data:www-data /var/www/
chmod -R 775 /var/www/
if [ ! -d /var/lib/mysql/humhub/ ] ; then
mysql -e 'CREATE DATABASE IF NOT EXISTS humhub CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'
mysql -e \"GRANT ALL ON humhub.* TO 'humhub'@'localhost' IDENTIFIED BY 'Hum_flist_hubB'\"
mysql -e 'FLUSH PRIVILEGES'
fi
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment