20180923 – Getting set up online

20180923 – Getting set up sees the first efforts to get a platform to develop on up and running.

To that end the result is there is a local and a hosted solution up and running by the end of this article.

https://philipalacey.com/project/project.php

Whilst I understand not everyone may have a technical interest in this kind of article it may hopefully encourage others to try build their own or even give this project a hand.

  • Project Jargon
  • Building the initial environment.
  • The databases
  • Communication
  • Wrap Up

[read more=”Read more” less=”Read less”]

Project jargon

The first build

It may not appear much but there is now a platform which can be developed into.  You’ve gotten the foundation built, now to put up some walls and make some rooms.

So how do you get a LAMP / WAMP stack up and running.

I’ve documented the evolution of building an infrastructure and now I’m going to document working through it to show how this project is built piece by piece.

This article goes through the how to get to a starting point for learning and participation reasons.

 

Naming of events such as 20180923

Date and time formats vary wildly. American and European dates can become easily confused when used in Excel or other tools which think they’re being used on a different continent.

Throughout my work date time references use Universal Date Time format. (UDT) This means YYYY-MM-DD HH:mm:SS

  • Y : Year
  • M : Month
  • D : Day
  • H : Hour
  • m : minute
  • S : Second

Universal Date Time format has a number of distinct advantages.

  • It’s unambiguous.
  • When ordered by a database and the contents are a string (as opposed to a date time field), they will order correctly

To explain this last point. You have two dates 29/01/2017, which is the 29th of January 2017. You also have the 01/09/2017, the 1st of September 2017. In an ordered list you would expect this to be

  • 29/01/2017
  • 01/09/2017

Unfortunately by default when this data is text, 0 is < 2 so the list actually outputs as

  • 01/09/2017
  • 29/01/2017

With UDT, even if the data is text and not a date time field, it will always sort correctly.

  • 2017-01-29
  • 2017-09-01

Date and time referencing in projects helps greatly with understanding versioning.

 

Technology Stacks

I decided to go with a WAMP stack.

I am a Windows user and getting a stack up and running locally was first on the job list.

Also all of the software choices are free.  These amazing tools are all FREE!!!

 

Building the initial environment

Setting up the initial stack

20180923 – Total time 1.5 hours of setup and writing.

To save time I downloaded Wampserver.

https://sourceforge.net/projects/wampserver/

Two config options in the middle.

I chose Chrome as the browser and Notepad++ as the text editor, as I prefer them for a project like this.

 

 

Development environment

Next was a full on dev environment which for me is Microsoft Visual Studio Code. 

https://code.visualstudio.com/download

I added a workspace and pointed it at the default.

C:\wamp64\www

I then tweaked the settings to allow it use the PHP engine for checking.

 

Local environment check and hosting

So with that up and running, let’s make sure we can run something…

After a bit of installing Visual C++ redistributables I got the service started.

Added wampapache to the firewall on the machine to allow it chat to the browser.

IIS was stopped as I had an instance running and wampapache the service started

Created a file called project.php

Threw in a little php code to test

And hey presto… we have our first living page

So I have a hosting solution set up with WordPress on which is this blog.

 

It’s not all smooth sailing

To make life a little quicker I tried installing the sftp sync extension for VS from liximomo.

Control Shift P and enter the command SFTP: config

Used this link to provide some background helpful reading and got the details in there.

https://stackoverflow.com/questions/46852476/visual-studio-code-sftp-extension-using-ssh-authentication

Had a bit of trouble with security, so disabled it.  Hey, all part of the learning experience.

It never works perfectly first time.  The knack is recognising where you could lose hours over something small when you’re getting something started.

 

Hello world!

Created a folder off the root called /project/

Filezilla’d up the files and instant success.

The project has joined the world!

https://philipalacey.com/project/project.php

 

 

The databases

Summary

We need to get somewhere for the data for our project to live.  This is the databases

20180923 – Total time 1 hour of setup and initial connection testing.

 

Starting the Db server

I’m chose MySQL as I know it very well.  If its strong enough to run YouTube and Wikipedia… it’ll be strong enough here.

I had the MySQL workbench up and running beforehand so that was a quick enough transition to get in there.

Not going anywhere near hardening or optimising just yet… some table building will be the starting point.

For security I created dedicated “project” username with a good strong password on each.  May as well start strong even if we harden the security later.

Yet every table needs a database.  So using Workbench to locally create a database called project, I then used my web based remote control to create a database called project.  Now we can play with tables.

 

 

ODBC connections

So we have MySQL running locally and remotely.  Next we need to be able to get into and out of those databases so we need our ODBCs running.

The idea here is to get it operationally tested.  The easiest way I know how is to run it through a basic CRUD suite.  (Create, Read, Update, Delete)

  • Create a table
  • Populate it
  • Retrieve and list the contents
  • Update a record
  • Delete the last row
  • Retrieve and list the contents
  • Drop the table.

To do that I need PHP to connect to the database hence the earlier testing.

 

Somewhere to live

Remotely I have less control over MySQL but if wordpress was working my headaches were reduced.

Standard mysql ODBC is

Server=127.0.0.1;Database=project;Uid=project;Pwd=wouldntyouliketoknow;

Now creating a database on the remote host was a bit more challenging than I’m used to as sensibly my hosting provider puts some interface restrictions on it.  I love the guys at Hosting Ireland.  Using the web interfaces puts some manners on the project… sensibly.

So new user, new database and explicit permission setting.  Naming was a bit forced… so am just going to refer to “project” as the Db for remote security reasons.

I then mirrored the user, permissions and database locally.

 

Hooking in the ODBC

So we need to get the right connection string into the databases.  This means knowing which ODBCs are installed and available and which versions.

My old friend www.connectionstrings.com always ready and on hand to provide the right string for the right version.

3.51, 5.0, 5.1, 5.3 and 8 were available locally to use.  No idea what was available remotely so went with the generic settings.

Long live w3schools for just the simplest way of reminding you how to connect things up!

So there we go… we now have a home for the data to live in

 

Communication

The PHP script.

20180923 – Total 1 hour script writing.

 

CRUDy heck!

Now to dev and run the scripts.  This leads into a conversation about my style of coding and some of my reasoning which I’ll deal with in a separate article.

I’ve redacted some of the code to hide the settings but you can get the code from a text file here for running on your own stack.

examplePHP

However with a little tweaking and about an hours work, we can confirm we have a full stack up and running.

CRUD confirmed.

Wrap up

So the work on this article was done on 20180923 but published on 20180924.

I must admit I’m pleased to have accomplished all the technical setup in a day to get something up and going.

From here there is a host of work to do technically and administratively but there is now something upon which to build.

Also there is an environment to develop it in.

Technical to do list:

  1. Libraries and abstraction of major functions
  2. Compliance with HTML standards
  3. Hardening of the server
  4. Consideration of accessibility guidelines
  5. Git hub establishment
  6. Backup schedule
  7. Password and security cycling schedule
  8. Database server optimization
  9. Version management and updates

Administrative to do list:

  1. Explanation of naming approach and coding style.
  2. Formal “development manual” page on the blog
  3. Risk management and review process

As is stated universally, this project is free and for all.  I still don’t have a name for the project… roll on 20180924.

Not bad for a launch weekend!

[/read]

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.