Im not going to going to worry about scripting the entire installation on chef/puppet yet. This will be done later when the project is ready to be productionised.
Once the functional aspects are setup properly, I will have time to worry about non functional requirements (security / backup, restore / monitoring / performance / cost efficiency / high availability / etc..)
heres the steps I followed:
- https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
- sudo apt-get update
- sudo apt-get upgrade
- https://www.youtube.com/watch?v=wd6NvOFERJc
sudo apt install -y apache2 mariadb-server mariadb-client php libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip
- sudo systemctl start apache2
- sudo systemctl start mariadb
- sudo systemctl enable apache2
- sudo systemctl enable mariadb
- sudo mysql_secure_installation (follow through the steps)
- sudo ufw allow http
- sudo ufw allow https
- sudo ufw enable
- Setup DB and DB user
- sudo mysql -u root -p
- create database <dbname>;
- create user <name@host> identified by '<pass>';
- grant all on <db> to <user>;
- flush privileges;
- cd /var/www
- sudo wget https://download.nextcloud.com/server/releases/latest-19.tar.bz2
- tar -xvf <tar file>
- chown -R www-data:www-data nextcloud/
- Setup Apache
- sudo vim /etc/apache2/sites-available/nextcloud.conf
- add content to conf (https://docs.nextcloud.com/server/19/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation)
- sudo a2ensite nextcloud.conf
- sudo a2enmod rewrite
- sudo a2enmod headers
- sudo a2dissite 000-default
- sudo systemctl restart apache2
- Map block storage to droplet
- https://www.digitalocean.com/community/questions/configuring-volumes
- sudo mkdir -p /media/nextcloud_data
- sudo mount -o discard,defaults,noatime /dev/disk/by-id/<disk-id> /media/nextcloud_data
- sudo echo '/dev/disk/by-id/<disk-id> /media/nextcloud_data ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
- sudo chown -R www-data:www-data /media/nextcloud_data
- sudo chmod -R 774 /media/nextcloud_data
- sudo mkdir /media/nextcloud_data/data
- sudo chown -R www-data:www-data /media/nextcloud_data/data
- sudo chmod -R 770 /media/nextcloud_data/data
- Goto http:<public-ip> or <domain> to continue with the web setup
- Update config.php at /var/www/nextcloud/config to add the trusted domains
- Setup SSL for nextcloud instance
- https://www.youtube.com/watch?v=mGcqC3oOINw
- sudo add-apt-repository ppa:certbot/certbot
- sudo apt install python-certbot-apache -y
- sudo certbot --apache -d <domain>
- Go through the interactive setup
- Follow up with part 2 to finalise the social login setup
- Remove all unwanted apps via nextcloud admin panel
- collaborative tags
- contacts interactions
- Federation
- First run wizard
- Support
- Usage Survey
- Setup PHP for memory limit and file uploads
- sudo vim /etc/php/7.2/apache2/php.ini
- memory_limit = 512M
- upload_max_filesize = 100M
- sudo systemctl restart apache2
- Setup MariaDB for 4byte characters
- sudo mysql -u root -p
- MariaDB prompt: use nextcloud;
- MariaDB prompt: set global innodb_large_prefix=on;
- MariaDB prompt: set global innodb_file_format=Barracuda;
- cd /var/www/nextcloud
- sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
- sudo -u www-data php occ maintenance:repair
- sudo -u www-data php occ maintenance:mode --off
- Install missing PHP libs
- sudo apt-get install -y php-gmp php-bcmath
- sudo systemctl restart apache2
- Setup log location
- update log config
- "log_type" => "file",
- "logfile" => "/var/log/nextcloud.log",
- "loglevel" => 2,
- "logdateformat" => "F d, Y H:i:s",
- 'log.condition' => [
- 'apps' => ['admin_audit'],
- ]
- sudo touch /var/log/nextcloud.log
- sudo chown www-data /var/log/nextcloud.log
- sudo systemctl restart apache2
- Change nextcloud cron to run via OS cron (you can do this via UI)
- https://docs.nextcloud.com/server/19/admin_manual/configuration_server/background_jobs_configuration.html
- crontab -u www-data -e
- */5 * * * * php -f /var/www/nextcloud/cron.php
- take a back up of the pod and volume
No comments:
Post a Comment