-
Notifications
You must be signed in to change notification settings - Fork 1
Install Rec Sys on Google Cloud VM
Step 1: Create a standard 2 cores and 8GB ram VM.
Step 2: SSD Disck 10GB.
Step 3: Ubuntu 18 LTS.
Step 4: Access vya SSH shell.
Step 5: Enable swap memory.
$ sudo fallocate -l 1G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ sudo cp /etc/fstab /etc/fstab.bak
$ echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstabStep 6: Install mariadb.
$ sudo apt update
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
$ sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'
$ sudo apt update
$ sudo apt install mariadb-serverStep 7: Install miniconda.
$ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
-o Miniconda3-latest-Linux-x86_64.sh
$ chmod +x Miniconda3-latest-Linux-x86_64.sh
$ bash Miniconda3-latest-Linux-x86_64.sh
$ source ~/.bashrcStep 9: Install default dev tools used to compile packages.
$ sudo apt-get install build-essential gcc make perl dkmsStep 10: Install mamba.
$ conda install -c conda-forge mambaStep 11: Clone rec-sys repository.
$ git clone https://github.com/magistery-tps/rec-sys.git
$ cd rec-sysStep 12: Crear environment.
$ mamba env create -f environment.ymlStep 13: Activar environment.
$ conda activate recsysStep 14: Asign a passworf to root database user.
$ sudo mysqladmin -u root passwordStep 15: Create database.
$ mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS recsys"Step 15: import database dump.
$ mysqldump -u root -pMariaDB [recsys]> Use recsys;
Database changedMariaDB [recsys]> source /home/adrianmarino1000/rec-sys/database/recsys_database.sqlMariaDB [recsys]> show tables;
+-----------------------------------------------+
| Tables_in_recsys |
+-----------------------------------------------+
| account_emailconfirmation |
| auth_group |
...
| taggit_tag |
| taggit_taggeditem |
+-----------------------------------------------+
31 rows in set (0.00 sec)MariaDB [recsys]> exit;Step 16: Copy file.service to ~/.config/systemd/user/:
$ mkdir -p ~/.config/systemd/user
$ cp -v recsys.service ~/.config/systemd/user/Step 17: Import required env variables.
$ echo "source ~/rec-sys/.shell.recsysrc" >> ~/.bashrcStep 18: Refresh systemd config.
$ systemctl --user daemon-reloadStep 19: Start systemd service on boot.
$ systemctl --user enable recsysStep 20: Config our database root password.
$ vim rec-sys/recsys/settings.pyDATABASES = {
'default': {
...
'PASSWORD': 'MY_PASSWORD',
...
}
}Step 21: Config installed miniconda path.
$ vim service.confexport CONDA_PATH="$HOME/miniconda3"Step 22: Install screen.
$ sudo apt install screenStep 23: Open an screen session.
$ screenStep 24: Get network interface name.
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 42:01:0a:96:00:03 brd ff:ff:ff:ff:ff:ffStep 25: Setup port forwarding from 80 to 8000.
$ sudo rec-sys/bin/setup-port-forwarding ens4Step 26: Start rec-sys app service.
$ systemctl --user restart recsysStep 27: Ctrl+A and Ctrl+D to detack from screen session.
Step 28: Close ssh session.
Step 29: Go to recsys.systes.net