How to depend on applications?

Enonic version: 6.3.0
OS: El Capitan

I have a website application that depends on your Open Graph SEO application. It works great and all, but today I pushed that code to master.

That causes problems. Now I need to tell the rest of my team to clone this application, build it and deploy it to their local server. When I set up a new environment, I need to remember that I depend on this application, and that it also needs to be deployed.

In my opinion, there should be a way of specifying (in code) that an application depends on another to function properly. For now, I’m simply creating a json file with github links, and then running a script that clones those script to my local machine. When I deploy my application, I have also set up a task deploy:all, which lets me deploy all applications to the server (either local or remote).

My solution is terrible, and it definitely needs some more work. Perhaps it can be integrated as a gradle dependency?

Either way - I would love to hear your thoughts on how to manage this.

1 Like

Hi there!

First of all - if an application depends on another you have a design flaw, and should create a library instead (or just link in that application as a library).

If you are referring to that your site actually uses multiple applications, and “need” them all, that’s a different case - which is what I think you are referring to?

Can you confirm this?

Hi @tsi,

Thank you for your quick reply. We are indeed creating a site that uses several applications. My specific case is this:

We’re creating a new website. This website uses (for now at least) two applications: the site itself and the app-open-graph. It’s highly likely that we’ll add more in the future - either to decorate our site, provide oauth login functionalities or something like that.

The website now uses the open graph application to add a mixin to our site that adds SEO fields. In order to have a consistent development environment for all our developers, we need them all to have this application. Today, I need to tell the developers (via the readme file in our repo) that they need to clone down this application, build it and deploy it locally. When we’re setting up a new environment (i.e. QA or staging), we need to remember to deploy this the SEO application to that environment as well. If we have several load balanced nodes (thanks to the new feature in 6.3.0 :tada: ), we need to remember to deploy that application to every node as well.

This sounds like a good candidate for automation - at least we need to specify this in some way. At the very least, a site should be able to specify what applications it “needs” to function the “correct” way - and make it easy to download and deploy those applications.

In summation:

  • We have a site that uses several applications
  • I can’t see any way of programmatically knowing this
  • Several applications on a site is a problem when programming on a team

First off - the whole idea with sites is that applications can be added at will, so it is actually the site that creates these dependences - not the app, this is an important difference! The Google Analytics App for instance has minimal practical relevance for other applications, and should often not be installed in a development/test environment.

I guess you have also seen the import capabilites, so you can import a test-site for development purposes - apps will have to be installed additionally.

If you want to tie functionality close together within an app, make a library instead - keeping all the best coding practices still. (NB many apps can be used as libraries without any changes).

For clustering, if things go as planned with 6.4, when installing applications they are actually installed in the system repository and available for all nodes in a cluster. Configuration must still be placed on each node (for now).

We are continously working to polish this stuff, so it will work smooth in development, test, qa and production - for small and large installation :slight_smile:

Hi @tsi!

Thanks for the quick and thorough reply.

It seems to me that my particular use case - the adding of SEO fields - might be a candidate for a library then. It would work as an application too, but then I would have to remember to deploy it separately. Seems like something I might forget.

But since libraries are fetched via Gradle, they probably need to be deployed to a nexus server or something like that, am I correct?

Jup, like repo.enonic.com.
Technically you can even use a regular file server I believe, but it must follow maven style structure!

I believe Sonatype offers free FLOSS repo hosting?

A few user scenarios that would improve if apps could depend on each other.

We developed a few sites on test, that the client work on a lot. Before launch we took it all into production, with content and all. Without the SEO app already in test, we would have had to make a lot of content edits in production. So sure, sometimes some apps might not be useful in all stages of development, but apps for SEO data, perhaps Google Analytics settings, and other apps I can’t come to think of right now, would indeed benefit from being there all the time. It also makes testing better/safer in test-environment because the environment there is identical to production in regards to which apps it’s using.

A scenario where App Y is missing in Prod and not added and creates behaviour, like missing meta-tags for Twitter or similar, is avoided if dependencies could be set up.

To come around this we do it manually by passing messages, write wikis, etc. “Hey Ben, before setting up App X, remember to also fetch App Y, Z and U.”. It’s not necessary for our survival, but it would sure be handy to be able to “flag” somehow that one app uses other apps (perhaps in the main apps site.xml).

But indeed, the option of making it a library instead so we could add it to our build.gradle would do exactly what we need. So might be what we need to do then.

BTW, the best free repository service out there is https://bintray.com/.