leftblank Posted February 13, 2014 Share Posted February 13, 2014 Hi, Is there any problem with having staging and production sites sharing the same database? If content is updated in the shared database, then I'd know that the two system's content were in sync with each other, and code changes in files would be the only difference between the two. And I'd just keep new content unpublished or hidden until it was due to go live. Could anyone let me know what the would be the benefit of separate staging and production databases? Cheers! Link to comment Share on other sites More sharing options...
diogo Posted February 13, 2014 Share Posted February 13, 2014 Well, it's not that simple. You also have the files that ProcessWire creates like images, logs, sessions, etc. So you would have to make sure you keep those in sync also. Link to comment Share on other sites More sharing options...
Fokke Posted February 14, 2014 Share Posted February 14, 2014 I'm using rsync to keep development and production sites ~in sync I have two separate commands to pull assets from server and then finally pushing the whole site directory back in, excluding some files/dirs if needed. It's not beautiful, but it works.. for now : ) Link to comment Share on other sites More sharing options...
teppo Posted February 14, 2014 Share Posted February 14, 2014 My solution for the issues mentioned by @diogo above is a simple script that syncs (via rsync) contents of /site/assets/files/ between dev and production sites ("two-way sync"), but that's just about it. Not a perfect solution, but works mostly just fine. Certain things (such as modules cache) still need to be cleared on a per-environment basis when making changes there (adding modules etc.) I wouldn't worry about logs, sessions or cache files -- it's actually better that they're environment-specific -- which leaves "files" only thing you'll need to keep in sync. One drawback is the situation where you have assets in both versions and then remove them via admin UI from one version; those assets will stay in other version of the site and you'll have to figure out a way to remove them from there too. This thread provides some helpful code samples for doing exactly that and you could also create a simple module that triggers one-way sync operation (rsync, for an example, has the ability to remove extra files from target directory) every time an asset is removed. If anyone has a better solution in place, I'd be happy to hear about it. I've been considering various options starting from shared directories, but haven't found anything solid yet (it'd be easier if both sites lived on same server, but generally dev environment shouldn't exist on same server as production one IMHO..) 1 Link to comment Share on other sites More sharing options...
ryan Posted February 17, 2014 Share Posted February 17, 2014 rsync can also be used with the --delete option, which will synchronize deletions as well. rsync --archive --rsh=/usr/bin/ssh --verbose --delete account@domain.com:www/site/assets/files/* /path/to/domain.com/site/assets/files/ Link to comment Share on other sites More sharing options...
Noel Boss Posted January 15, 2018 Share Posted January 15, 2018 I'm using mod_rewrite to link to files on the live system if they are not found on the development systems: # file: .htaccess <IfModule mod_rewrite.c> RewriteEngine On # Get all asset files from remote if localy not available RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_URI} ^/www/site/assets/files/ RewriteRule ^(.*)$ https://www.live.com/$1 [L] </IfModule> 4 Link to comment Share on other sites More sharing options...
dragan Posted January 15, 2018 Share Posted January 15, 2018 wp-content? 1 2 Link to comment Share on other sites More sharing options...
Noel Boss Posted January 16, 2018 Share Posted January 16, 2018 17 hours ago, dragan said: wp-content? Wooohaaa, caught me! Used this on an wp installation previously but the technique should work on PW as well… You should be happy that I moved on from wp – and even more happy that I learned ONE thing I can use for PW Not looking back to wp a single second. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now