How to install stage_file_proxy on Drupal 8

Tips and tricks

Aug
22
Posted by Paul Costan at 9:43 am

First, you need to install stage file proxy with composer, note –dev is flagged to ensure this is available for development and not used for production.

composer require drupal/stage_file_proxy --dev

Next, jump to your Drupal site docroot/ and enable stage_file_proxy

drush pm-enable --yes stage_file_proxy

Finally, you want to set the origin of where files/asset are hosted.

drush config-set stage_file_proxy.settings origin https://www.example.com

And clear site cache.
drush cr

This is the issue I was getting when trying to update plugins:

Using WP 4.9.6 I update a plugin resulting in:
Updating Plugin Akismet Anti-Spam (1/1)
Downloading update from https://downloads.wordpress.org/plugin/akismet.4.0.7.zip…
Unpacking the update…
Installing the latest version…
Removing the old version of the plugin…
Plugin update failed: Could not remove the old plugin.

And this was the error I was getting when trying to update WordPress:

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

First, you need to ssh in your Synology box

This login as your superadmin
sudo -i

Then you need to change your WordPress site folder group/user
chown -R http:http volume1/web/your-wp-site

Finally you need to add the below line to `wp-config.php`
/** Set up ‘direct’ method for wordpress, auto update without FTP **/
define(‘FS_METHOD’, ‘direct’);

And that’s it! Good luck! If updates still fail, check your site file/folder permissions.

Apr
12

Before you can consider replacing you Linx 10 screen, you first need to ask yourself is it worth doing? and can I live with the crack screen since I can still navigate Windows via keyboard and mouse? I know it can be annoying seeing crack screen but it also depends how badly. In my case the crack was on the top right and using the touch screen became obsolete. With this tablet, I mainly use for testing and general surfing.

Before we can begin you need to purchase Linx 10 replacement screen from here:

https://www.ebay.co.uk/itm/263106532516

I would highly recommend the screen replacement as they are genuine. Next, I would recommend purchasing Screen screw set. Ideally, you need to find the cheapest set with a screw head H1.3 a hexagon shape required unscrew 4 screws under the kickstand. What I also found handy was the screen pick which helps separate plastic back and screen.

Once you have these tools you are good to go!

There are for screw you need to unscrew behind the kickstand, two at the bottom and two under the hinge.

I would highly recommend too pre-warm plastic backing around the tablet, this will avoid cracking. To do this use a blow hair dryer and go around the device edges for 5 minutes. With the screen pick slowly prie around the screen starting from top right to left. Be forceful as the table is well put together and you should feel the tabs clicks.

Please note to remove the micro memory card as this was my mistake and nearly broke the card.

Once you have the top part detached from backing done pull up from the bottom as shown in the picture.

Next, you want to detach screen data ribbon from the board, to do this flip the screen flat down located data ribbon as shown picture below. You will need to gently peel back sellotape back and left the black tab or otherwise slowly pull on data ribbon away from you. You will see the black tab should left.

Next, flip the screen over again and with the hair dryer heat around the edges.
Slowly you can pull the glass out starting from any corner, the heat of the dryer should soften the glue. Eventually, you should just the frame and LCD, like have this:

Finally, clean screen and surroundings making sure there is no fluff then apply new glass by removing all the protective film etc. Place new glass firmly, feed screen data through the slot and back into the board by folding down the black flap.

Once you have done this I would recommend to power up the device to test the screen is working as excepted, if not working double check you have inserted screen data cable correctly.

And that’s it! If all is well, put everything back together again.

Mar
11
Posted by Paul Costan at 10:59 pm

sudo openvpn filename

dig +short myip.opendns.com @resolver1.opendns.com

You first need to ssh in to your RaspberryPi and run the following command lines.

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install samba samba-common-bin

Then you and to create a shared folder:

sudo mkdir -m 1777 /share

Next you want to edit Samba config file to include shared folder:

sudo nano /etc/samba/smb.conf

Insert the below settings to the bottom of the page:

[share]
Comment = Pi shared folder
Path = /share
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes

Press `ctrl` + `x` to close file and press `y` to save and hit enter.

Next you want to create a password for Samba:

sudo smbpasswd -a pi

Here it will prompt you to insert password. This is separate to you Pi login but there is no harm inserting the same password if you like.

Final you need to reboot Samba:

sudo /etc/init.d/samba restart

Now you should find that your RaspberryPi is discoverable on your next work.

Mar
08
Posted by Paul Costan at 10:17 am

Step 1. DNS
First you need to visit your host provider and go to Manage your Domain Name System (DNS) settings. For example I use Cloudflare to manage DNS. There you will need to add a new CNAME record. So for example I want a subdomain http://helloworld.yourdomainname.com.

To do this you add new DNS Records:

TYPE – CNAME
NAME – helloworld
VALUE – @
TTL – Automatic
Status – DNS Only

Step 2. Router
Make sure your router is setup with port forwarding point to your Synology server.
ie `192.168.100.47:80,443`

Step 3. Synology server
Finally login to you Synology box and go to Control Panel > Application Portal > Reverse Proxy. Here you will need to add new Revers Proxy Rules. The rest is straight forward. So now you can check is your new domain URL works. If not, go back and check all three setting are correct.

Aug
26

If you are like me bought a NAS drive and want to build up storage over time due to the high expense of hard drives. The best way is to start off with 2 Hard disks as Raid 1. Then if you have enough money later on to buy the 3rd Expanding your 3rd drive a Raid 5. Depending how big your hard drives this process of expanding with Synology NAS can be a long process which can take days before you can see changes. I understand why, because anyone on your network will not be interrupted if the server is down, So it will be business as usual. But what if you need the extra space urgently hence the purchase of the third drive? Well, you come to the right place. Here is how to speed up expanding NAS.

Open terminal on you mac Putty for windows,

Type in the following to see progress:

cat /proc/mdstat

You should see something like this:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md3 : active raid5 sdc6[2] sdb6[0] sda6[1]
7657726592 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]
[============>........] reshape = 61.6% (4722524224/7657726592) finish=402.6min speed=121486K/sec

md2 : active raid5 sdc5[3] sda5[2] sdb5[1]
151459776 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]
resync=DELAYED

md1 : active raid1 sdc2[2] sda2[0] sdb2[1]
2097088 blocks [4/3] [UUU_]

md0 : active raid1 sdc1[2] sda1[0] sdb1[1]
2490176 blocks [4/3] [UUU_]

Here is what you need to look for:

reshape = 61.6% (4722524224/7657726592) finish=402.6min speed=121486K/sec

If you go here and type in the mins to finish you can work out how long roughly to complete expanding process.

The first this you need to do is switch over to ‘root’ user. To do this type in:

Sudo -i

Next set speed NAS speed

speed_limit_min
cat /proc/sys/dev/raid/speed_limit_min
10000

cat /proc/sys/dev/raid/speed_limit_max
20000

cat /sys/block/md3/md/stripe_cache_size
256

Copy and paste the following make increases:

echo 250000 > /proc/sys/dev/raid/speed_limit_min

echo 250000 > /proc/sys/dev/raid/speed_limit_max

echo 32768 > /sys/block/md3/md/stripe_cache_size

finally checkout the speed now and on your Resource monitor gui:

cat /proc/mdstat

Aug
21
Posted by Paul Costan at 11:47 pm

First of all you need to enable NFS on your Mac, to do this type this command
sudo nfsd enable
next
$ cd /etc/
Then you have to edit if not create file called ‘exports’
$ sudo nano exports
path to your directory you want to mount follow by “-alldirs -mapall=501”
"/Volumes/LaCie" -alldirs -mapall=501
List show user ID (Commonly you want 501)
$ id
Every time you make a change to this file you need to restart NFS services.
$ sudo nfsd restart
Confirm your NFS paths
$ showmount -e

Finally Login to your Synology server, go to ‘File station’ > ‘Tools’ > ‘Mount remote Folder’ > ‘NFS Shared Folder’
In the Folder files put in your Mac’s IP follow by the path
192.168.1.30:/Volumes/LaCie/Plex/plex-movies

– First login into your synology NAS server.
– Go to Package Centre.
– Click on ‘Settings’ button and select the ‘Beta’ tab.
– Tick the checkbox ‘Yes, I want to see beta versions!’.
– Next, go to ‘Utilities’ and find ‘Virtual Machine Manager’.
– Click on ‘Virtual Machine Manager’ and hit the ‘Install’ button.
– Once installed, Launch the app.

Install guest-agent
open terminal in Ubuntu and run the following command:
sudo apt-get install qemu-guest-agent

Jul
26
Posted by Paul Costan at 11:41 am

If you have installed jmeter with homebrew can run these commands in terminal

brew install jmeter

or

brew install jmeter --with-plugins
with plugins

If you are running jmeter 3.2, you can found your jmeter CA Certificate here.

/usr/local/Cellar/jmeter/3.2/libexec/bin

The simplest way to installing this certificate is by opening the directory and double clicking on the file. By default it will be added to your list for certificate but not trusted. If you right click you will have the option to trust where you will need to type in your machine password.

Jul
17

In ‘phpMyAdmin’ under sql tab copy and paste below script and hit go!.

UPDATE wp_options SET option_value = replace(option_value, 'http://old-url', 'http://new-url') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://old-url', 'http://new-url');

UPDATE wp_posts SET post_content = replace(post_content, 'http://old-url', 'http://new-url');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://old-url', 'http://new-url');