Skip to content

bliswebagency/Greeny

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

--------------------------
MEET GREENY
--------------------------

Greeny was written to solve a pretty simple problem that occurs when you move an EE2 database from one server environment to another. The problem being the "absolute" upload paths are wrong and you need to manually change them. In that past people tried to get around this using relative paths... but that method really sucked as many addons didn't work well using relative paths.

With Greeny, you can use absolute paths and when you move your site, he'll update them for you AUTOMATICALLY! 

All you have to do is either:

1. Log into the CP or
2. Call the Greeny Action Path (found in the Module settings page)

It's a dead simple "set and forget" system whereby all you have to do is install it. Once it's running you'll only notice Greeny is there when he goes to work after you've moved your DB from your Local environment to Stage or Production.

HOW IT WORKS
Greeny does a couple of things. The first thing he does is remember the root server path to each of your environments. He figures these out himself and saves them all in the DB.

The next thing he does is keep an eye out for any changes to this path. If he finds one, he'll tell you about it. He'll then try to figure out if the paths you have in your Upload Preferences match up with an old environment he knows about. If they do, he'll update your paths for you so everything "just works".

Finally, Greeny can also be called directly from a service like Beanstalk. Beanstalk allows you to poll a URL before or after you deploy a site update. By putting Greeny's URL into these settings, your upload paths will be updated without you having to log into the CP.



--------------------------
USER GUIDE
--------------------------
1. Download
2. Unzip
3. Backup your site
4. Upload the "greeny" folder to /system/expressionengine/third_party/
5. Log in to your CP
6. Make sure you're using absolute upload paths
7. Go to Addons > Modules > Greeny and click Install
8. Make a cup of tea and enjoy


--------------------------
HOW TO DISABLE GREENY
--------------------------
You may have some environments where you don't want Greeny to do his thing. We've added a global variable to get around this issue. To disable Greeny, just set:

$config['greeny_enabled'] = false;

To do this with NSM Config Bootstrap, you'll want to include something like this:

    if (NSM_ENV == 'local') $default_config['greeny_enabled'] = "false";

Above this line:

    $config = array_merge($config, $default_config, $env_config);
    
You'll be able to see if this has worked by checking the Greeny Accessory status. You should see this message:

"Greeny has been disabled in the config settings."


--------------------------
SHARING A REMOTE DB
--------------------------
If any of your environments access the same database and have different filesystems you need to add one step for Greeny to work properly.

The 'greeny_env' config setting should be set in each environment that accesses a remote database. The value should be unique for each environment. A common example of this is having a team of developers working with local files but using a remote database to stay in sync with data. In this scenario each developer would need to use the config setting in their environment.

$config['greeny_env'] = 'unique-key-per-person';

This setting will be save to the database and serves as a "key" per developer. This allows for each developer to have their own upload directory base paths.

This will only work if this setting is unique to each developer. We achieve this by ignoring a developer-specific config override file per team member.
- Erik Reagan (@erikreagan)
Focus Lab, LLC


--------------------------
DISCLAIMER
--------------------------

BACKUP YOUR WEBSITE before installation as there is no warranty.



--------------------------
FAQ
--------------------------

Q. Why Greeny?
A. Because he looks after your environment

Q. What versions of EE2 does Greeny roll with?
A. Greeny's only been tested with EE 2.1.3 to date. We'll post a version update to confirm it also works with 2.2.1. once we've confirmed that's also working.

Q. I have a very important website which needs to stay online or the Queen of England will die. Should I install Greeny?
A. That depends... do you like the Queen? We've been working on making Greeny as stable as possible and to date, it's been just that. However, we always advise you backup and show caution before installing any addon.

Q. I've found a bunch of bugs? Should I tell my mother?
A. No, tell me. Here: https://github.com/bliswebagency/Greeny/issues

Q. I'm not using the "exp_" naming convention for my DB tables - should I install Greeny?
A. No, not yet. Wait long by the river and a new version will float by that you can use.

Q. Why didn't you call it "GreenEE"
A. Ummmm... well... next question.

Have fun. Hope this little guy makes working with EE2 across multiple environments a little easier.

About

An ExpressionEngine 2 addon which will automatically update your absolute upload paths based on your environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages