- This tutorial guides the user through setting up a server-side database and requires some broad knowledge of Information Technology terminology and confidence/resilience against things not going as planned!
- You may need the assistance of an IT professional in order to navigate firewall and other security considerations.
- Payment to third party web hosting companies may be required.
Time to Complete
- The duration of this aspect is not definable as it relies on third party web-hosting and payment transaction completion. It can take 30 minutes for hosting to become active, so allow a few hours to complete this tutorial.
Who Should Read This Document
This tutorial, along with Web Send and Web Print focus on getting the Pipsta to act as a basic web printer, and –as such—web hosting is required.
This document is intended for use by those wishing to work through the web printing tutorials to deliver a fully-working (albeit light implementation) web printer. It is necessary to complete this tutorial, Web Send and Web Print in sequence to deliver a working system.
This document may also serve as a guide to those interested in using Python to send data from point
to point via a MySQL database in the ‘Cloud’.
There are a number of ways of implementing M2M (machine to machine) or IoT (Internet of Things) systems to send data from one device, via the web, to another device. There are many service providers already catering to this requirement and some of these will be covered in future Pipsta tutorials.
In this tutorial, you will be guided through setting up your own system from first principles. As well
as serving as a useful grounding in the ins and outs of web hosting, it is hoped that this approach will allow you to tailor your system to your particular requirements rather than coerce your system into meeting the standard interfaces and protocols of specific providers. It is also hoped that this will
then allow your system to be readily ported between providers without too much re-engineering effort, mitigating long-term risk.
You will not require your Pipsta for this tutorial. You may wish to use a full-sized desktop computer in order to work effectively and quickly, and to make secure payments if these are required by the web hosting company you select.
Picking a Web Hosting Company
There are many web hosting companies that offer free services, which can be particularly helpful when experimenting. If you have already paid for a domain, some providers will permit you to use this. If not, you can often buy a domain through the web hosting company for a more seamless experience.
In this example, we will use the web hosting company FreeHostia as their Chocolate Plan meets the following essential and/or desirable requirements:
- Essential: MySQL database (a single 10MB database, adequate for demonstration purposes),
- Essential: Python support (for writing server-side scripts).
- Desirable: No monthly fee
- Desirable: Free setup
- Desirable: Scalable (for larger or more databases should these be needed later)
- Desirable: phpMyAdmin for setting up the database
Setting-Up a FreeHostia Account
1) Go to www.freehostia.com
2) Select the ‘Chocolate’ option from the home page:
3) Select ‘Take it now’:
4) Set-up the domain name to host. If you do not have an existing domain name, or are unsure about setting the DNS (Domain Name System) to FreeHostia’s requirements, the simplest option is to select a new domain and pay for this. This can cost ~$10 for a year.
5) Fill-in all pertinent information on the account holder and progress through to the payment screen.
6) Once you have paid, there will be a delay whilst your hosting provision is created. This delay could be considerable!
7) Once you receive notification that your domain is active, follow the link emailed to you and set your password.
8) Now log in to the control panel:
9) Click the Databases tab at the top of the screen, and select MySQL Databases.
10) Select ‘Create a New Database’:
11) Assign the database a name by appending “db” to the end of your user name, and provide a password that is different to your login password:
12) You should now have a database set-up as follows:
13) Click phpMyAdmin, then ‘Databases’
14) Click the database link
15) Once the database view appears, click ‘Create Table’
16) Create a table named “printdata”, and assign 4 columns.
17) Now add the following fields and types:
18) Now click ‘Save’
19) On the top bar, you should see something like the following. There are 3 important fields here:
- host (in the form n.n.n.n)
- port (the number following the colon (:))
- db (the name you created above, ending in “_db”
20) Make a note of all of these parameters, including the password for the database, and keep these safe for the next tutorial.
21) You have now done all the preparatory work you need to start working with your own web- hosted database.
The next step of the Web-printing system is to complete the following tutorial:
Shutting Pipsta Down Safely
If you did setup your web hosting provision using the Raspberry Pi, please follow the instructions below.
Whilst the printer is resilient when it comes to powering down, the Raspberry Pi must undergo a strict shutdown process to avoid corrupting the Micro SD card. The most straightforward method of doing this is to double-click the ‘Shutdown’ icon on the desktop.
If you are already in LXTerminal, type sudo shutdown –h now
to shut-down the Raspberry Pi immediately.
Always make sure ALL activity on the Raspberry Pi'’s green LED
(the LED on the right) has stopped before removing the power!
End of Document