Make Gadgets Work

Posts tagged "Linux"

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
Right then, the Ghost V1.0 was out a while back and they made Ghost 0.11.x an LTS so I was not in any rush to upgrade too. I have not had much time to sort this out for a while and two days back when I finally came around to check how to upgrade, my first moment of concern was that officially supported stack is for NGINX. I have moved my blog to the Apache Stack on DigitalOcean and while on my sandbox environment I still have NGINX, that is not a place I want to host my blog from. Anyhoo, I realised soon enough that while not officially supported it s easy to bypass the restrictions so I went ahead. The upgrade itself couldn't have been simpler considering the major version bump. The answer to the question "Was it worth it?" is something we will have to wait and see although I am liking what I see except for the initial hiccups. EDITED AFTER THE POST Boy oh boy - just after I finished this post I saw the latest version of Ghost V1.12 is out and it was such a painless process compared to past. Just a simple command 'ghost update' and job done. That itself makes this whole pain kind of worth it. OK so the steps I took are as below: Backup Download and Install Setup Wizard Configure Apache Restore Tweak Backup We will take the back-up from front end for all the posts and we will also backup on the server the entire directory where old instance of the blog is residing. To take backup of all the content and download it in a json file, open your ghost site on a browser, navidate to "Settings" and then click on "Export". Next for the backup of folder on the server itself. To do this issue the following commands on the terminal. #Updateand upgrade the OS repo sudo apt-get update sudo apt-get upgrade #Stop the ghost server pm2 stop Ghost "assuming Ghost is the pm2 id for the site" # Change directory to web-server root cd /var/www/html/"path to your ghost directory say 'ghost' " # Create a new directory for backup sudo mkdir old_ghost_bkp sudo mv ghost old_ghost_bkp # Recreate the ghost directory sudo mkdir ghost cd ghost # Give right privileges to the new directory sudo chown -R <your username>:www-data . Download and Install As we are already in the right directory lets get on with installing the latest version of Ghost using npm. sudo npm install -g ghost-cli #Make sure you are in the directory where new ghost is to be installed. #If you have followed all commands so far, you will already be in #required the directory ghost install It is at this point that you will have to deviate from official guide if you have Apache instead of NGINX. You will be prompted by the installer that it could not find NGINX and do you still want to continue. Default is "No" so make sure you enter "Y" and then press enter. For me rest of the install went smoothly. Setup Wizard Immediately after the install is complete, you will be presented with following questions: Please note that if you have configured SSL using LetsEncrypt as explained in previous posts on this blog then even if you are using https, the answer to blog url must be the with http and not https. For example: I gave http://mgw.dumatics.com and not https://mgw.dumatics.com Enter your blog url: http://your.blog.url Enter your MySQL Hostname: localhost Enter your MySQL Username: root Enter your MySQL Password: "your mysql root password" Enter your Ghost database Name: "a relevant name - for security reasons you may want to keep it different from your blog name" Do you wish to set up Nginx: no Do you wish to set uo Ghost MySQL User: yes Do you wish to set up Systemd: yes Do you want to start Ghost: yes Please do note that the response on line 6 above to "Setup Nginx" must be "no" After the questions are complete you will get a notification You can access you blog at http://your.blog.url. At this point, it is best to see which port is configured by ghost CLI for this installation. you can do so by checking the configuration file like so: nano config.production.json You can change the port if you like but if it is different than the port you originally had for old version of ghost you can either change it here or you need to change Apache conf file in next step. If you do decide to change the port here, then there should be no need to carry out the next step - Configure Apache. Configure Apache Assuming that the port in Ghost config file was 1234, there will be some changes that you will need to make in Apache conf files like so: cd /etc/apache2/sites-available/ sudo nano ghost.conf Now change the port on ProxyPass and ProxyPassReverse to be same as what is in the config.production.json file and save it by pressing Ctrl+x and y.- so for this example it will be changed to 1234 and change will look as below: ProxyRequests off ProxyPass / http://localhost:1234/ ProxyPassReverse / http:/localhost:1234/ Now open the ssl config file for the site using commands below and make the same changes as above. sudo nano ghost-le-ssl.conf TIP: If done using LetsEncrypt, it will be named something like `ghost-le-ssl.conf`. Once the changes are saved, disable and enable the configurations using following commands: sudo a2dissite ghost.conf sudo a2dissite ghost-le-ssl.conf sudo a2ensite ghost.conf sudo a2ensite ghost-le-ssl #Restart the server sudo service apache2 restart Now if you enter you blog url in a browser, you should be presented with vanilla Ghost site. If not, something in server set-up has not worked and you will need to troubleshoot it and fix - luckily for me all worked like a charm. Restore Right, so you are now on the browser looking at the Vanilla Ghost install. First thing you need to do now is create the user with same credentials you had on your old version of ghost. To do this you will first need to enter the admin url for ghost and follow the steps to create your user. Once you are into the admin interface, navigate to "Settings" -> "Labs" and click on "Choose File" button, select the json backup that was exported from your old version of the blog and then click on "Import" button. Now to restore the images from your old blog on the server issue following commands: cd /var/www/html/ghost/content sudo rm images sudo cp /var/www/html/old_ghost_bkp/ghost/content/images /var/www/html/ghost/content/ ### Make the new image directory is writable or image uploads will fail sudo chown -R ghost:ghost images/ ### Restart Ghost cd .. ghost restart 1. The ghost CLI commands like stop, start and restart will require you to be in the directory where ghost is installed. 2. While start and stop commands of ghost specifically ask for sudo credentials, restart command just keeps rotating and hence it is better to issue a command with sudo before you issue `ghost restart`. This is it. Your old blog is now fully restored. Tweak This section is a bit of a pain because there are quite a few things that break with this version. So if you have heavily used html, you will painstakingly need to go through posts and add a new line between markdown and html content for it to be parsed properly or else it will display quite wiered outputs on your blog. If you have used code blocks with syntax highlighting, another change is with older version you would have given three backticks followed by language-sql but now you just need to give three backticks followed by sql. If you have used line numbering using prism.js, it just wont work and you will need to apply changes to your theme the way I did. Without going too much in detail on that, you can get the copy of prism.js, prism-custom-line-number.js, prism.css, prism-line-number.css using the github links for my theme and place them in assets directory of your theme. Then make sure you include them in relevant files where your theme calls the javascripts. Once done, issue the command ghost restart and things should look pretty again. Happy Migrating !!!

Ghost V1.0 Upgrade on Apache stack, related quirks and fixes

Right then, the Ghost V1.0 was out a while back and they made Ghost 0.11.x an LTS so I was not in any rush to upgrade too. I have not had much time to sort this out for a while and two days back when I finally
Ethercalc is good tool which can be selfhosted. It is fairly simple to do so. Though it will be available for anyone who has the URL because there is no inbuilt login mechanism. I did not dig into making it accessible with a login interface as I lost interest after I made it work on my server and played around a bit with it but it was simply because I got interested in other things and not because the tool isn't fascinating enough. I am fairly certain this will not be overly complicated but for a simple selfhosted spreadsheet solution this is definitely worth playing around with. The steps I took are as below: #Ethercalc plays well wth redis as per their documentation. So Install and start "redis" sudo dnf install redis sudo systemctl start redis.service #Test if "redis" is working redis-cli ping #Enable redis to automatically start at the time of system start-up sudo systemctl enable redis.service #check if it runs ethercalc #Press Ctrl+C to exit #To run it forever use pm2 pm2 start ethercalc npm list -g --depth=0 #Change port to whichever port you want Ethercalc to run on by opening app.js #and changing port. nano /home/<yourusername>/.npm-global/lib/node_modules/ethercalc/app.js #change port and save #run with pm2 and alias as Ecalc pm2 start ethercalc --name "Ecalc" #check logs using pm2 pm2 logs Ecalc #Reverse proxy Ethercalc using nginx sudo nano /etc/nginx/conf.d/ecalc.conf sudo systemctl restart nginx.service

Ethercalc

Ethercalc is good tool which can be selfhosted. It is fairly simple to do so. Though it will be available for anyone who has the URL because there is no inbuilt login mechanism. I did not dig into making it accessible with a login interface as I lost interest after
Steps: Configure Namecheap Set-up DDCLIENT Test DDCLIENT Set up DDCLIENT to run at start-up Known Issue with DDCLIENT Configure Namecheap Follow the Namecheap guide here NOTE: For a subdomain "oxygen.copper.com", just replace @ with "oxygen" Set-up DDCLIENT #Install DDCLIENT on Fedora sudo dnf install ddclient #Edit the configuration file to update IP on your Dynamic DNS host sudo nano /etc/ddclient/ddclient.conf Press Ctrl+W and type the name of host for your Dynamic DNS. Mine is with Namecheap and I needed to configure for the subdomain hence following config reflects how to do it for Namecheap. For other hosts, you will need to refer their documentation. ## NameCheap (namecheap.com) ## use=web, web=dynamicdns.park-your-domain.com/getip protocol=namecheap, \ server=dynamicdns.park-your-domain.com, \ login=copper.com, \ password=<copy the password from namecheap advanced DN section> \ oxygen # myhost.namecheap.com The password to be provided above is what you will find on namecheap dashboard (Ref. Screenshot above). Log in to the namecheap account. Go to Advanced DNS Scroll down to Dynamic DNS section Copy the password Paste in ddclient config file Test DDCLIENT Before we schedule ddclient to run at boot, we need to test if it has been configured properly and is able to communicate with Namecheap by sudo ddclient -daemon=0 -debug -verbose -noquiet. If it is configured properly, you will see a message similar to this as part of the final output. SUCCESS: updating oxygen: good: IP address set to 92.117.273.56 If it is not what you see, and more importantly, if you do not see last line as "Success", then there is something wrong with configuration and you must correct it before proceeding. If this test worked, we are ready to update the DDCLIENT service. Set up DDCLIENT to run at start-up When we install ddclient using dnf, a ddclient.service file is automatically created in the location /etc/systemd/system/ddclient.service with following content. [Unit] Description=A Perl Client Used To Update Dynamic DNS After=syslog.target network.target nss-lookup.target [Service] User=ddclient Group=ddclient Type=forking PIDFile=/var/run/ddclient/ddclient.pid EnvironmentFile=-/etc/sysconfig/ddclient ExecStartPre=/bin/touch /var/cache/ddclient/ddclient.cache ExecStart=/usr/sbin/ddclient $DDCLIENT_OPTIONS [Install] WantedBy=multi-user.target We will enable and start this service by issuing following commands: sudo systemctl enable ddclient.service sudo systemctl start ddclient.service One would think that enabling and starting this service is all you need to do but that is not usually the case. I was getting following error: /bin/touch: cannot touch `/var/cache/ddclient/ddclient.cache': Permission denied A quick google search establishes that there seems to be some bug in how the ddclient cache file is created and how the permissions are set. After lot of searching, scratching head later, I did the following which fixed the issue. So if sudo systemctl start ddclient results in error, you may need to do the following: #Go Root su #Create a directory for ddclient mkdir /var/run/ddclient #Chown the various directories for ddclient as user chown ddclient:ddclient /etc/ddclient.conf chown ddclient:ddclient /var/run/ddclient/ #change directory cd /var/run/ddclient #delete ddclient.cache if it exists rm ddclient.cache #change directory cd /etc/sysconfig #delete ddclients.cache rm ddclients.cache #create a blank ddclient.cache nano /var/run/ddclient/ddclient.cache #chown it for ddclient user chown ddclient:ddclient /var/run/ddclient/ddclient.cache #exit root exit #enable and start ddclient service sudo systemctl enable ddclient.service sudo systemctl start ddclient.service Done !!! Known Issue with DDCLIENT There is a known issue and I can confirm that I have seen on my logfile as recently as today. WARNING: cannot connect to dynamicdns.park-your-domain.com:80 socket: IO::Socket::INET: Bad hostname 'dynamicdns.park-your-domain.com' It isn't major but it is there and restarting the service by issuing the command sudo systemctl restart ddclient.service fixes the problem.

DDCLIENT set-up on Fedora for Namecheap

Steps: Configure Namecheap Set-up DDCLIENT Test DDCLIENT Set up DDCLIENT to run at start-up Known Issue with DDCLIENT Configure Namecheap Follow the Namecheap guide here NOTE: For a subdomain "oxygen.copper.com", just replace @ with "oxygen" Set-up DDCLIENT #Install DDCLIENT on Fedora sudo dnf install ddclient #Edit the configuration file
UPDATE: PENCIL is an opensource software which is a pretty good alternative as well with a smaller learning curve and is Opensource. I was recently looking for Visio alternatives on Linux and while Dia is good it lacks the oomph of Visio and hence not an easy sell for new and potential Linux converts. Now good news for those open to enter the wonderful world of Linux is that any OS need not have an alternative for it to be usable to you, all it needs is the ability to let you run the software you find useful. So this post isn't about why Linux is better. It is about knowing that there is something better than the software you have got accustomed to. If someone is adamant on continuing with the software they have fallen in love with, there is always WINE / Virtualbox but if you have opened to the idea of new OS but you are taking baby steps software like yEd can help you take a giant leap. yEd is written in Java and can run on Windows, Mac and of-course Linux. Before we move into the steps of how to get it and use it let me bore you little with what are the other alternatives I explored. During my quest I came across two other useful candidates Activiti 5.6, ARIS Express 2.3. What went against these and in favour of yEd? Read on: Ease of installation First on the list is ARIS Express 2.3. Now this requires registration which is my first gripe. I could have lived with that but as claimed on their website the product is meant for Windwos and is reported to be working fine for Linux. What they forgot to mention is on linux using Wine or atleast that is what it did on my set-up. Now am not sure if it has something to do with my installing JRE in wine for using Open Workbench (see last post) or it is because the product works on similar lines as Open Workbench installer but eighther way it does not run natively on Linux and for that reason alone it is unreliable and looses points even to Activiti. For easiest installation, Activiti 5.6 can be added into Eclipse but that results in a bit complicated and not so user friendly user-experience. You will at-least need to have one Activiti project created in eclipse before you can draw using Activiti Diagram. (Check Screenshot) Above might be circumvented by installing standalone Activiti bit that involves configuring ANT and other stuff. While guide is there, it is not very straight forward and considering we want to win new users not scare them, it is best left as untouched topic. Ease of Use - While all the three products yEd, Activiti and ARIS are superior to Visio, in terms of ease of use I think it's yEd which wins hands down even to Visio. The one aspect of this software that won me over was it's ability to auto align the whole flowchart / diagram with just one click and it can do it in several layouts. OK, now that I have covered comparison, let's get down to how we install it on our beloved Linux Mint. It's really very simple. Step 1: Go to this website - http://www.yworks.com/en/products_yed_download.html Step 2: Download yEd for your platform. In our case for Linux Mint the 43 MB sh file in front of Linux. Step 3: a) Go to the folder where it is downloaded, select the yEd-3.7.sh file and right click on it. b) In the right click menu select Properties (last entry). This will open the yEd-3.7.sh properties box. c) On the Properties box, click on Permissions tab. d) Click the checkbox in front of Execute Allow executing file as program. e) Click Close. f) Double click on the yEd-3.7.sh file. It will display a dialogue box with four options Run in terminal, Display, Cancel, Run. Select Run in terminal g) yEd will now install, it may give one small error but it did not affect anything at all so ignore it if you get it. h) Follow the wizard and leave default options. i) Once done, you will have yEd successfully installed and can be found in MENU ALL APPLICATIONS-OTHER. j) Create a shortcut of yEd by dragging yEd from MENU ALL APPLICATIONS-OTHER onto desktop. You may need to make this dragged link executable by right clicking the link and following steps b,c and d. All Done !!! A quick tutorial from yWorks: Find more on http://www.yworks.com/en/products_yed_videos.html Having seen, how nice and easy it is to create the flowchart, let's also see the best feature of the product that is one click alignment.

Visio Alternative on Linux - Business Process Model and Notation Tool

UPDATE: PENCIL is an opensource software which is a pretty good alternative as well with a smaller learning curve and is Opensource. I was recently looking for Visio alternatives on Linux and while Dia is good it lacks the oomph of Visio and hence not an easy sell for new