Setting up Git with 1&1

Next in my quest to move my website design to a more professional workflow is using version control more thoroughly.

For me this means getting to grips with a little app that I’ve been avoiding for a few years – GIT!

So what’s my goal….
Basically I want a local development server that links to a remote ‘live’ server – giving me the ability to test content and develop apps, whilst being able to go back a few steps and branch my development.

This post will track my first attempt – so I’ll probably tidy up things in a guide later…

As a first attempt I’m going to follow this guy:-

…and as this is a little bit of an experiment I’ll be attempting it first on the section.

  • Open SSH session
  • cd to root folder
  • create two new directories:-
    • …/dev/live (live site)
    • …/dev/repo (git repository to store all the changes)
  • Next create the local folder to develop in (part of the WAMP Server folder structure)
  • right click in folder > select ‘git bash here’ > type ‘git init’
  • Back to SSH
  • Change directory to the repo directory > ‘cd ./dev/repo’
  • type ‘git init –bare’ > message “Initialized empty Git repository…”

The next step is slightly different from the guide I’m following….

  • ‘vim ./hooks/post-receive’ (opens vim with a blank new document ‘post-recieve’
  • ‘i’ to insert text into the new file, typing:-
    • #!/bin/sh
    • GIT_WORK_TREE=”../live” git checkout -f
  • ‘esc’ to exit insert mode > ‘:’ > wq (save and quit)

Next we need to make it executable…and back to the guide…

  • chmod +x ./hooks/post-receive

### so far so good – but the next stage (establishing a SSH link) is causing problems ###

The solution to my SSH headache was turning to GUI tool – SourceTree

It was a simple install and when pointed at the local dev folder it piked everything up.

But the SSH issue…

  • Tools > Options > General
  • I took the opportunity to ad in my name and email in the global settings…
  • set SSH Client to Putty/Pink – leaving the tick in Auto start SSH agent > ok
  • Tools > Create or Import SSH Keys
  • I decided to create a new key…
    • Click ‘Generate’, then move your mouse randomly while it generates a key for you
  • Once created I saved private and public versions in my user folder
  • Tools > Options > General
  • SSH Client Configuration > SSH Key > navigate to, and select the new private key > ok

Thats the key configured, now the connection

  • Still in SourveTree > ‘Settings’ > ‘Add’
  • ‘Remote name:’ > enter an identifier name
  • ‘URL / Path’ > ‘ssh://[username] @ [host] / [remote repo folder]
  • ‘Host Type’ > Unkown > ok > ok

Finally test the connection using ‘push’…password entered and it all works ūüôā





WordPress migration to a new host ‚Äď Part 2

Preparing the new platform

  1. Create a new directory
  2. Create a new SFTP account
  3. Create a new mySQL DB and user
  4. Update wp-config.php
  5. Update DNS to point to the new folder

Create a new directory

Just one minor rant before I get started – 1&1 your cPanel replacement is rubbish!!!

Anyway job number 1 is creating a folder on the server for everything to be dumped into.

  • Log into 1&1 admin page > left-hand menu¬†‘Web Hosting Overview’ > WebspaceExplorer

This brings up a new page with an embedded folder view.

  • ‘New folder’ icon or¬†select ‘file’ > ‘New folder’
  • type the folder name > ok

Create a new SFTP account

  • Left-hand panel ‘Secure FTP account’
  • Select ‘New user’ button
  • Complete desired:-
    • User name – or more precisiely the second half of the desired username as it uses the main account name as the first half.
    • Password, also with a ‘Repeat password’
    • Description – one habbit I’ve made myself get into is always writing meaningful descriptions to my future self
    • Directory – point this at the newly created directory above
  • click the ‘save’ button

Rather than creating a global account and using this for all sites I’m compartmentalising everything – to keep it all segregated and in order.

Create a new mySQL DB and user

  • Left-hand panel ‘MySQL¬†Database’
  • Select ‘New database’ button
  • Complete the desired info:-
    • Description of the new database
    • Version of the new database : MySQL 5.5
    • Password &¬†Repeat password
  • Click ‘set up’
  • Note down the details of the database
  • Click ‘Go To Overview’

Update wp-config.php

Next the new database settings need to be added tot he wp-config file.

  • In the root¬†directory of the downloaded site open¬†wp-config.php with a text editor – Notepad++ for me.
  • Change the following, to the values from above:-
    • define(‘DB_NAME’, 1&1databasename’);
    • define(‘DB_USER’, 1&1username’);
    • define(‘DB_PASSWORD’, 1&1password);
    • define(‘DB_HOST’, 1&1hostname’);
  • Save this

Update DNS to point to the new folder

  • Left-hand panel > Domains
  • Click ‘Transfer domain from another provider’
  • ‘Domain check’ > type in the domain > select the right top level endind > click ‘check’
  • select/check ‘Point DNS to 1&1 name servers and keep your current registrar.’ > ‘next’
  • select ‘Use the 1&1 mail servers.’ > next
  • Note down the details > click ‘order’

Next the new domian needs to be pointed at the right folder

  • Left-hand panel > Domains > ‘Manage domains’
  • Select the relevant domain > ‘Edit Destination’
  • In the Webspace section select the desired folder > ‘save’


WordPress migration to a new host – Part 1

I intend to do the move in three stages:-

  1. Export and download the current site – files and DB
  2. Prepare the new platform
  3. Upload and Import the content and DB
  4. Alter domain details to point to the correct nameservers

Simple…I hope

First up – which on first look at the admin section reminds me how infrequently I use this blog, kill the spam from the comments section (243 waiting approval) or update things (20 updates pending).

So pre-step 1  is getting it all updated so everything it going across clean.

Export and download the current site

  1. Grab a WordPress export of the site
  2. Export the MySQL Database
  3. Download all WordPress files via SFTP

Grab a WordPress export of the site

Time to grab an export of the site which will contain the posts, pages, comments, custom fields, categories, and tags

  • Log into the admin section -> Tools -> Export
  • Select ‘All content’
  • Click ‘Download Export File

Doing this just highlights my frustration with my current hosting package as several times I ran into ‘502 bad gateway’ error messages. However I still ended up with a fairly hefty xml file.

The above phase isn’t 100% necessary as I’m going to take an extract of the database but I like the ‘belt and braces’ approach.

Export the MySQL Database

So onto the database extract and for this I need to log into cPanel.

  • From the home screen > Database section > phpMyAdmin

This step again highlighted an important lesson I need to bear in mind on the new platform – keeping database naming conventions in mind and relevant to the site/project. Fortunately I had named this sites DB something relevant – more by luck than judgement.

  • In phpMyAdmin select the database from the left-hand panel
  • Then in the right-hand panel click ‘export’
  • Select the option ‘Quick ‚Äď display only the minimal options’
  • Select the ‘SQL format’
  • Click ‘OK’

This downloads an sql file with all the DB content.

Download all WordPress files via SFTP

Now it’s time to grab the files from my current host via good old ftp.

For this I chose to use WinSCP, having not used ftp clients in many years it seemed to have the best reviews and least malware.

One thing to note here, I grabbed everything rather than getting picky over which files I might need.

So while that transfers I’m going to get some sleep.



Moving time…

The time has arrived where the old EUK hosting package I’m on is no longer big enough for all the work/interest/plans ahead.
Their upgrade plans just didn’t give me what I needed going forward, namely:-

  • SSH acces
  • git
  • unlimited space and websites
  • ruby on rails

So having looked around 1&1 seemed on balance the best choice… and now just the headache of moving everything over.

Luckily there are plenty of support guides around and more than a few low priority blogs that aren’t critical if things go wrong…



It’s been a bad few days on the market…

…and consequently a lot of the minor gains I’d started to make have been reversed. However, I’ve not hit any of my stops yet and there is some better economic data around…so fingers crossed things should start heading up.

Admiral – still holding up but the ‘talk’ seems to be edging more on the sell side of¬†things, with the question now being should I take the little profit or is there more to go? So the reason I bought into Admiral was their recent expansion plans locally – these are still on course and they are still recruiting a lot of jobs. This was always going to be a long burn for me – and given where the rest of the market is I think there is scope for it to improve. So I’m going to sit tight.

Breedon Aggregates Ltd – since buying at the end of Jan there was a brief spike before falling back off – with the general trend being lower not higher. Currently I’m down 2% but looking at some of the advice the consensus is a buy. So it seems worth sitting tight again – especially as most of the investment firms holding this have a 75.50 target point.

Xaar plc – overall this is down 3% but again the talk is of potentially higher prices. If anything the last 3 weeks have been fairly flat so again a hold as there’s no sign of bad news.

Dart Group plc – has taken quite a hit recently and currently in my portfolio down 5.8% with very little talk around it. I’m going to watch this closely for the next couple of trading days and cut my losses if something positive doesn’t happen soon.

EasyJet –¬†this was another gut feel buy based on a few articles I’d read and so far (again) the talk is glowing and the performance lacking – down 2.7% but I’m going to sit tight for now.

Fusionex International¬†plc – So these shares crashed from a fairly solid, long term, level of around 330…mainly due to some supplier cash flow issues and some bad comms. The news is positive and the company still seems solid – so again sit tight.

I hate sitting tight!



Musical interlude – Goldblade Psycho

Man posting about shares can lead to boring walls of words and numbers…so as a palate cleanser here’s bouncy-jumpy-punk…

It brings back memories of seeing them perform this at TJs in the Square – where they stopped the gig half way through to give the bouncers a hard time for stopping some kids moshing.





Trading tool-set for newbies

One thing that has struck me in the world of shares is there is very little around that gets recommended without an angle.¬†Lots of places and people will offer up their preferred tool-set/forum/font of knowledge but you can bet there’s a registration or referral involved.

So just to track where I am and what I’ve found here are three great sites that have really helped me…

The Share Centre Рbest place to trade

So when I started out on this roller coaster (or other travel metaphor) I was looking around at trading sites that offered up practice accounts.¬†Probably for it’s clear/no clutter/lack of adds, stood heads and shoulders above many of its competitors.¬†The practice account lured me in, the features and friendly advice and support kept me coming back.

Although I’m just learning via the practice account, eventually trading through then is probably an option – supported by the numerous recent awards they’ve won.

Things I like…

  • Modern clean/crisp feel to the site
  • Lack of cheap looking adverts
  • Lots of support and friendly advice/articles

Google Finance Рbest place to get the latest portfolio news

For me this has been a recent discovery and probably one that I should have engaged my brain around and checked out sooner. I’d played around with getting news on my shares and watch lists on a few different sites but nothing hit the mark…I thought about setting up google alerts (and still probably will for IPO news) and then I stumbled across Google’s finance section. Login and give it your portfolio and immediately it brings up all the latest news on your shares. Of course the news feeds are detailed and comprehensive but then it’s google – who better for trawling the internet for new articles.

One very nifty feature is that any upcoming events linked to your shares can be added to your calendar at the click of a button – but then I am a sad google fan-boy.

Things I like…

  • Simple interface for reviewing portfolio performance
  • Comprehensive news listing
  • Integration with calendars so no big event is missed

Hargreaves Lansdown Рbest place to look for shares

Another recent discovery, although it’s cropped up in a few articles I’ve read – so I probably should have checked it out sooner.¬†Hargreaves Lansdown have a great site that I’ve only started getting into but what has really stood out has been their stock screener. It’s comprehensive and detailed with many options for filtering shares based on a multitude of indicators. Ok,some of the cool slider things sometimes get in the way – but all in all it’s a great tool.

Things I like…

  • Lack of adverts getting in the way (take note ADVFN)
  • Detailed filter options for shares