Skip to content

Instantly share code, notes, and snippets.

@devbeno
Last active September 2, 2024 02:53
Show Gist options
  • Save devbeno/592ae18b0109156ade694b0e4164a405 to your computer and use it in GitHub Desktop.
Save devbeno/592ae18b0109156ade694b0e4164a405 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Update and install necessary packages
apt-get update
apt-get upgrade -y
apt-get install -y git python3-dev python3-pip python3-venv mariadb-server redis-server curl npm supervisor
# Start MariaDB and run secure installation
systemctl start mariadb
mysql_secure_installation <<EOF
Y
$DB_ROOT_PASSWORD
$DB_ROOT_PASSWORD
Y
Y
Y
Y
EOF
# Configure MariaDB
echo "[server]
user = mysql
pid-file = /run/mysqld/mysqld.pid
socket = /run/mysqld/mysqld.sock
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
bind-address = 127.0.0.1
query_cache_size = 16M
log_error = /var/log/mysql/error.log
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4" | tee /etc/mysql/mariadb.conf.d/50-server.cnf
systemctl restart mariadb
# Install Node Version Manager (nvm) and Node.js
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install 14.15.0
# Install Yarn
npm install -g yarn
# Install and configure Frappe
sudo -H pip3 install frappe-bench
bench --version
chmod -R o+rx /home/$ORB_MACHINE_USERNAME/
bench init frappe-bench
bench start &
sleep 60
# Configure Supervisor
ln -s /home/$ORB_MACHINE_USERNAME/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/frappe-bench.conf
supervisorctl reread
supervisorctl update
supervisorctl status
# Update Supervisor configuration
echo "[unix_http_server]
file=/var/tmp/supervisord.sock
chmod=0700
chown=$ORB_MACHINE_USERNAME:$ORB_MACHINE_USERNAME" | sudo tee -a /etc/supervisor/supervisord.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment