Dexter_X Posted October 31, 2017 Posted October 31, 2017 (edited) After a few trials I've finally succeed on creating a sandbox copy of our comunity. It allows us to make some development, modules or functionalities tests before setting them into the production one. Our need was to create a copy into the same hosting space without polluting the production one. So here is how I made it : I - Copy Files First of all you need to create a copy of your community files, in our hosted space the files where located into the /www/ folder, so I simply ssh loged in and ran a : copy -aR ./www ./sandbox It is the fastest way to create a local copy, but you can also FTP-download your community files then FTP-upload them again into the new folder : Depending on the size of your community it can take very long to perform in that way. To ensure there is no damage done to the original community, we move it to a new folder during the time the sandbox is created (and set-up an apologize under maintenance page during this time), something like : mv ./www ./protect . So the sandbox will not be able to overwrite anything into the original files path considering it'll not be able to find them... DataBase You'll also need to create a copy of your community database : 1) Create an empty new MySQL database ; 2) I use MySQLDumper to create a database backup file from the production community database ; 3) Then I set up MySQLDumper to connect into the new empty MySQL database and restore the database. If you've a big database like us, you may consider to ignore the forum_core_search_index table, some logs tables and private messages tables, depending on your needs. II - Setup For the moment you just have some kind of a "raw copy" of your community, but you can't use it : dont even try, you may damage your original community if you do. So don't try to access your copy sandbox before step III-Final Adjustments here below. Access For our needs I've created a subdomain to access the sandbox content, something like sandbox.mycommunity.com, pointing to the new ./sandbox copy folder just created before. I suppose it may work in a subfolder of your main website too, but I considered it too risky before even try it. Files As usually when moving a CMS to another place, the first file to set up is conf_global.php , you'll need to set-up your new database name, user and password. But don't forget to change the "board_url" field in order to set the access url to access your sandbox copy. You'll also need to modify the .htaccess file at the root folder of your community to set the right (sub)domain name or path into the rewrite rules. Database Now we're gettin' into the serious part of this. You'll need to modify "by hand" your new database : I use phpMyAdmin, kindly provided by our hosting company as a standard service. But you can install it by yourself or even use MySQLDumper just after the restoration to perform these modifications. So here are the list of the tables and fields you'll need to fix by setting your access url and most important of all : the absolute storage path of your sandbox copy. Through an ssh access just type pwd and you'll see where you are... (example : original /home/me/www -> sandbox /home/me/sandbox ) . In table forum_core_sys_conf_settings, update the conf_value field, for the following conf_key values - sitemap_url - posts_add_nofollow_exclude - home_url - theme_disk_cache_path - board_name (optional) - home_name (optional) . In table forum_core_file_storage, for the field ID=1, update the configuration field value ; III - Final Adjustments Now you can access to your copy sandbox through your navigator : but try to connect directly to the APC in order to make the final adjustments. . First of all : if you're caching files, you may need to change the cahing files folder : you'll need to download then upload a configuration.php file in order to apply it. . Set a valid licence number : in the APC, go to the licence number menu item then set a valid key distinct from the original community one. We use the -TESTINSTALL key for that (your original key by adding -TESTINSTALL at the end). . Run a support diagnose to reset the theme cache and check everything is ok. If needed fix any encountered problem. . Depending on how you've copied your database, you may need to rebuild the index database by going to the "search" tab (in the APC) then "rebuild search index". If you have a big community, it could take several hours. . Don't forget to create a new cron task if you were scheduling in that way... . Finally, if you've moved your original comunity for a safer copy creation, now you can restore it back. It's done ! You've your full copy sandbox for whatever you may need it ! Thankyou for reading ! Edited November 14, 2017 by Zorro_X DSystem and Meddysong 2
Dexter_X Posted June 25, 2021 Author Posted June 25, 2021 Just a little thing we did not think about at the time : before starting your cron scheduler for the sandbox, don't forget to disable e-mail notifications. We do that by setting a bad password in the e-mail setup (ACP -> System -> Settings -> email settings). If you were using PHP method, change it to SMTP without setting it up (or set an invalid dummy account). If you don't do that, your users will receive double e-mails or even "strange notifications" if you test posting in your sandbox on items users may be subscribed to...
Dexter_X Posted June 25, 2021 Author Posted June 25, 2021 1 minute ago, Nathan Explosion said: Better option: Thankyou, it is better ! 👍
Recommended Posts