Link to home
Start Free TrialLog in
Avatar of Member_2_8034623
Member_2_8034623

asked on

Demo of platform

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
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

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

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.
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.
Avatar of Member_2_8034623
Member_2_8034623

ASKER

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?
I am also using plesk to manage my server
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.
SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@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.
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial