Demo of platform

Member_2_8034623
Member_2_8034623 used Ask the Experts™
on
I have an application built using php/mariadb

i want to create a demo of the site that has standard data in it. A user can then play around with the data.

I do not want the new data entered by the demo user to exist for another user

what are my opions?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
What I do is use code like below where I am using 2 databases.  As your pages are being updated from test to live, this ensures you are using test data for your test site and live database for your live site.  I also but an ugly color background in the same manner on the demo site so you can easily tell you are in the test site.  This allows you to duplicate your site/app and use both live and test data.

if($_SERVER["SERVER_NAME"]==="live.server.com" ){


    $db_host   = "localhost";
    $db_user  = "liveuser";
    $db_word  = "abc123";
    $db_name = "live_database_name";

} else {

    $db_host  = "localhost";
    $db_user  = "demouser";
    $db_word  = "abc123";
    $db_name = "demo_database_name";
}

Open in new window

David FavorLinux/LXD/WordPress/Hosting Savant
Distinguished Expert 2018

Commented:
Two simple ways come to mind...

1) Spin up an LXD container for each client, if your data is big.

If you require individual IPs for a high speed App, use an OVH machine + 254 IPs.

If speed's not an issue, use one public IP + HAProxy to split up site requests.

2) Spin up a new demoX site using a different database name to match each demo site.

This is how WordPress works. You can run 1000s of WordPress sites on one machine, as they all have different databases.

Same table names across all sites, just different database names.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Is your question about how to isolate demo data from one demo user to another?

If so - are your demo users logging in with a common ID?

If so then you will need to implement a session based storage mechanism where the data in the DB is linked to a sessionID that has a specific lifespan.

User "logs in" and gets a unique ID for their session.
All data they add / change is linked to that ID
Every 24 hours (or whenever) you run a cron JOB that cleans up old data

Without know more about your application it is difficult to give more specific answers.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Author

Commented:
hi

each user logs in with their own unique user and pass.

for the demo I was going to use a generic user name and pass and use a separate login form for the demo

i fully intended on using separate databases for the live and demo
 only problem is I don't really want other demo users to see what other demo users are doing.

a virtual machine would be a good idea in this respect as I could just spin it up when. a new user logs in and remove it once the user.times out or.logs off

however, I think I would need to.worry about system resources for that.

thoughts?

Author

Commented:
I am also using plesk to manage my server
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
VM - what if you are really successful and you have 100's or 1000;s of users hitting your site and testing out the demo - will the VM approach still be viable?

What about the time for the VM to start up?

I am not discounting the VM idea (I don't have enough experience with the current VM on demand setup) however the above questions are what I would try to answer before going ahead.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013
Commented:
For the demo, why not create a new database on the fly for each user.   For the database, perhaps use the session id for the database name. when a new demo starts, generate the db, populate data, let them in. Every night delete the prior days databases.
David FavorLinux/LXD/WordPress/Hosting Savant
Distinguished Expert 2018
Commented:
Ditto on what Scott said, which matches one of my suggestions.

I run a similar system, except real sites rather than demo sites.

I have a template set of files + database .sql file.

My case template is WordPress. Any set of files + .sql file will work.

When a new site spins up, the entire template is rsync'ed to new site DocumentRoot, database is loaded, wp-cli run to change site name from template to new real site, use a wildcard cert to cover all host names.

Takes <1 minute to generate a new real site.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
@Scott - why bother with the creation - if you use the session based solution I suggested earlier it amounts to the same thing without the overhead of generating the DB each time.

Again I would ask if you have multiple users hitting the site simultaneously are you going to create a new db for each one of them - and what are the efficiencies around that - as opposed to a single database where records are partitioned by a session_id - which gives the impression of exclusive access.

Author

Commented:
The system is based on user IDs stored within the session

When a new user creates an account there would be no data to view. As they dive in deeper the user would begin to add things such as task, images, posts etc.

BUT, i wouldnt want an empty demo. I would want basic demo information to showcase all the workings of the site.

I could create a table whereupon login, the user is given a unique id but also is associated to a non-unique demo user id in which case all the create/update data would be associated to the unique_id. Therefore, other users wouldnt see the changes but this seems like a lot of work to get something as insignificant as a demo. At which point, i wonder if a demo would be better suited in the form of videos.

Thanks
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
Not sure if this is what you were saying (I am assuming it was) - to paraphrase.

You setup a demo account with static data - when a user is in demo mode he / she gets a combined data set of the static data and the data associated with their account. All new data they create goes against their own account - but they see the data from both.

That would work.

This is obviously predicated on them having their own id to begin with - which implies your requirement is not to provide demo access without first registering an account - is that correct?
There is another solution that you may want to consider and it request no code modification and easy to maintain / update.

The company I work with, sell medium to expensive application.
They schedule a live demo using Gotomeeting remotely, this let the client play with the application for a while.
By doing this is sales rep can answer client questions and it is easier for the sales rep to close the deal or offer services/ or other applications.
When the session end the data is reset for the next demo.

For serious client or big organisation they also offer one month testing demo, to play safe, each client have their own installation with their own DB. After that period, they reset the DB, disable the account or activate the account depending if the client decide to use it or not.

To my opinion this take less time to do it like this and you don't need to change the code.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial