Make Gadgets Work

Posts tagged "multiple swap files"

I have found the recent ghost upgrades quite painless but there have been few hiccups for last two times so I kept a record of what helped and it is as listed below: General Update should be as simple as: cd /var/www/html/ghost/ ghost update If after this step, there are any errors or an indication to update ghost-cli, following command should be used. sudo npm install -g ghost-cli After this if there are issues accessing the blog over internet, we may need to do a bit of checks. Logical sequence is to first check that access for all folders is right and proper. If it needs to be updated, command to be used is: cd ghost sudo chown -R <your username>:www-data . cd content/ sudo chown -R ghost:ghost images/ If there are any errors when starting ghost, following command is indicated by the ghost-cli and it does help. ghost setup linux-user systemd If still accessing the blog is an issue following command will list the ghost log file: ghost log If there are database migration errors on log file, following commands may help: sudo npm install -g knex-migrator ghost setup migrate ghost setup migrate does work very well and must be remembered. If you have digitalocean setup such as mine, memory can be an issue you may want to restart the virtual machine and reload the swap files. sudo reboot now sudo swapon /swapfile1 sudo swapon /swapfile2 If there are still issues accessing the blog with error 503, check the apache logs: sudo nano /var/log/apache2/error.log If issue is with accessing the upstream ghost server. Try changing the port on ghost config and updating the apache conf files. ##Change Directory to ghost install cd /var/www/html/ghost ##Stop the ghost server ghost stop ##Change port to another number nano config.production.json ##Change directory apache2 server cd /etc/apache2/sites-available/ ##Open the ghost.conf file and change the localhost port to same number that was changed in config.production.json sudo nano ghost.conf ##Open the ghost-le-ssl.conf file and change the localhost port to same number that was changed in config.production.json sudo nano ghost-le-ssl.conf ##Disable and enable the conf files on apache. sudo a2dissite ghost.conf ghost-le-ssl.conf sudo a2ensite ghost-le-ssl.conf ghost.conf sudo service apache2 reload ##Finally change directory to your ghost install and start ghost server. cd /var/www/html/ghost ghost start

Ghost Upgrade errors and fixes (1.19.x)

I have found the recent ghost upgrades quite painless but there have been few hiccups for last two times so I kept a record of what helped and it is as listed below: General Update should be as simple as: cd /var/www/html/ghost/ ghost update If after this
While renewing my LetsEncrypt certificate, I found myself in a strange situation where the certbot won't run asking me to update pip and then each time I tried updating pip it failed with the error "error: command 'x86_64-linux-gnu-gcc' failed with exit status 4". It turns out that this happens due to low memory and with my digitalocean droplet being the cheapest one this was bound to happen sooner rather than later. Fortunately there is a way around it as explained below. Use of following commands will ensure that the swap file is created which in turn will help avoid the "error: command 'x86_64-linux-gnu-gcc' failed with exit status 4". Following commands will create a swap file: sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 sudo mkswap /swapfile1 sudo chown root:root /swapfile1 sudo chmod 0600 /swapfile1 sudo swapon /swapfile1 The swap file will now be activated but will be gone after the reboot. It can be reactivated using the last command (I hope - know so as I have now tried it). Anyway, after creating the swapfile, you will be able to upgrade pip without the aforementioned error. :) Update: 02/03/2017 I ran into memory issues yet again and I thought instead of increasing the memory for swapfile1, what if I can create another swapfile. I tried this and it works. Infact I felt quite nice uncovering a concept of multiple swapfiles purely based on my whim ;). All I really had to do was repeat above code replacing swapfile1 with swapfile2 and I had two swapfiles working together increasing available memory for my server. sudo dd if=/dev/zero of=/swapfile2 bs=1024 count=524288 sudo mkswap /swapfile2 sudo chown root:root /swapfile2 sudo chmod 0600 /swapfile2 sudo swapon /swapfile2 Thing is after it worked I was a bit intrigued by the concept and read a bit more on swapon / swapoff and few useful commands are listed below: # To enable all swapfiles swapon -a # To disable all swapfiles swapoff -a # To see all available swapfiles swapon -s # To enable a particular swapfile swapon <filename>

Swap File to create extra memory

While renewing my LetsEncrypt certificate, I found myself in a strange situation where the certbot won't run asking me to update pip and then each time I tried updating pip it failed with the error "error: command 'x86_64-linux-gnu-gcc' failed with exit status 4". It turns out that