Spartacus CCv2 Build process for multiple enviroments - spartacus-storefront

We're currently setting up a Spartacus application running on CCv2 with three different enviroments (dev, stage, prod).
We are struggling to set the right OCC API Urls, within Spartacus, for the enviroment, I guess the way to go are enviroment variables, as this is Angular standard, but we couldn't find a way to match the enviroment vars to the corresponding system.
Is there something we're missing?
Thanks for your help!

The OCC baseUrl can actually be provided by CCv2 automatically. This is described in the docs.
It works like this:
Add a static meta tag in your index.html, with placeholder content
<meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" />
The placeholder will get replaced automatically by CCv2
Remove the static configured baseUrl in the Spartacus configuration, as this will take precedence over the meta tag (we're about to change this)
This is however the only configuration that is environment specific, the ticket referenced by Grin is indeed a feature that we like to add.

We faced the same issue in our project.
It is was already reported as an issue on Spartacus Github page .

Related

Moving Jira Server to https - gadgets and app search no longer working

I have recently moved our Jira Server installation to an https URL - we have a reverse proxy setup and I have configured apache/Jira according to atlassian's docs. https://confluence.atlassian.com/kb/securing-your-atlassian-applications-with-apache-using-ssl-838284349.html
We can access and use Jira with no issues, however the activity feed on the dashboard, and the search function to find new apps is no longer working.
When i look at the console it still appears to be trying to access the http:// version of the URL even though I have updated the base URL to the https version.
When I view source, I can see several references to the old http:// version of the URL. e.g.
WRM._unparsedData["com.atlassian.servicedesk.core-ui:util-base-url.base-url"]="\"http://jira.xxx.xxx\"";
<input type="hidden" id="upmBaseUrl" name="upmBaseUrl" value="http://jira.xxx.xxx">
<input type="hidden" value="http://jira.xxx.xxx/plugins/servlet/upm/marketplace" name="upmUriMarketplace" id="upmUriMarketplace">
Is there some other place where this needs to be updated? I've tried a general search/replace in the database, and i've grepped the installation and application data directories for the old URL.
Could it be a cache issue?
To move the Jira site to a new HTTPS location, you generally need to ensure that you have configured both:
the base URL, and
the proxyName, proxyPort, secure, and the scheme in the <Connector> of Jira's conf/server.xml. Also ensure that you're editing the correct <Connector> (since there are multiple in the default install, some of which are commented out).
You mentioned that you have done both of these, but the symptoms suggest that either #1 or #2 might not be complete or 100% correct.
If you are using a containerized version of Jira, also make sure that any environment variables also correspond to your new setup, since these can override settings in the above places.
For example, if you are using the official Docker image, this means variables such as ATL_TOMCAT_SCHEME, ATL_TOMCAT_SECURE and the like.

How do I use run-modes with context-aware configurations in AEM

We have a multi-tenancy website. We are trying to use social share components where the url needs to be shared. Since we have a dispatcher configured, we are picking up the domain from a context aware configuration. How do we use different domains for environments based on run-modes
I have tried to use different ca-config folder for each environment but this is not ideal.
Sling context aware configurations don't work on run modes. For your current requirement you should be using Externalizer service which works basis sling maps, request origin and OSGI configs based on what method you choose.
https://helpx.adobe.com/in/experience-manager/6-3/sites/developing/using/externalizer.html
https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/Externalizer.html
You can use Day CQ Link Externalizer which is available in the OSGI configurations, http://localhost:4502/system/console/configMgr.
It is an OSGI service that allows you to programmatic-ally transform a resource path into an external and absolute URL. You can configure this configuration for different run modes
You can also use a 2-step approach. 1st you create a Run-Mode dependent OSGi config. 2nd you use the built-in Override via OSGi configuration.
See here: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html#override-via-osgi-configuration

Deploy Odoo with KEYCDN

I want to deploy odoo with KeyCDN.I have properly create pull zone and resource is access via pullzone url.But somehow when I see the path of css or image, It is not change, it comes from server only not from cdn server.I have also add CDN url in odoo configuration.
Am I missing somewhere?
This is most likely a settings issue in Odoo. Double check the settings and paths you are using. Follow the Odoo CDN integration guide. Contact KeyCDN support if you still struggle with the setup.

Servlets, development, and a CDN for static files

I'm working on a Java site (jQuery, Wicket, Maven, Spring, Hibernate) and we have just started using a CDN to serve static files on our production server. We use a placeholder for the CDN domain, and have added it to every static file that references a static file. The placeholder gets replaced by Maven through properties filters with Maven.
So, for every static file served by the CDN, we have something like this:
<img src="${placeholder}/images/dogs/rex.jpg"/>
For production, ${placeholder} is replaced with "http://cdn.com" and for development environments, it is replaced with blank.
...Is there a better way? It seems unusual to globally add a Maven-specific placeholder to the static files themselves. It will need to be added for every new image going forward, as well. In addition, changes to static files MUST go through a Maven build before those changes will show in a browser, and this slows down development in certain environments. This is probably avoidable, but still seems unnecessary in the first place.
When we used to do this kind of thing, we would have the cdn url be a property exposed by an application scoped spring bean, then you can inject this property in your applicationContext.xml and that's where you would replace it with the maven filter. Then we reference an EL expression with that property in the jsps.

Make Maven Proxy/Server settings configurable based on location?

So I'm not sure what the best way to accomplish this is, but basically I have a laptop that I use at work for Maven projects. It works fine when I'm at work, but as soon as I walk out of the door of their corporate proxy and maven server, I often have to do alot of hand-fudging of the settings.xml file when I'm at home if I'm not VPN'ed in:
We have a corporate-installed Maven Repository proxy server to store some of our own artifacts and handle being the middle-man for our commonly used artifacts.
We have an http proxy that we use for connecting to the outside world.
Both configurations have been handled by my settings.xml file for setting a single Nexus group and maven proxies. If I'm not connected to the VPN while away from the office, I have to muck around with the settings.xml each time I'm not on it, then switch it back when I am on it.
What solutions have anyone else found to handle this? I've been trying profiles to manage the proxy, but I can't seem to get it to work correctly, and it's starting to look pretty ugly. Are there some settings configurations that can detect when I'm not behind the proxy at work and not use the corporate proxy server or Maven server?
While I can think of some profile based solution to handle the proxy (basically, reading the <active> value from a property defined in a profile), this wouldn't be fully automated (the profile activation do not support network based stuff) unless you can find a file that is present or not depending on your location (in which case, you could use an existing/missing file trigger but this is kinda hacky). Anyway, this would solve only one part of the problem because mirrors can't be declared in profiles (see MNG-3525).
So, instead of trying to control this with a profile, my suggestion would be to use two settings.xml and to pass your settings-home.xml file with the -s command line option when you're at home.
Another option would be to automate the changes in your settings.xml with a script (Groovy would be a good choice as someone reported in MNG-3525).
I found a use environment variables to set nonProxyHosts together with proxy and noproxy shell aliases to be the most convenient solution when switching between networks with proxy and without it.
In settings.xml, configure proxy with
<host>proxy.corporation.int</host>
<port>8080</port>
<nonProxyHosts>${env.MAVEN_NONPROXY}</nonProxyHosts>
Then in ~/.profile set
export MAVEN_NONPROXY_PROXY='*.corporation.int|local.net|some.host.com'
export MAVEN_NONPROXY_NOPROXY='*'
alias proxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_PROXY\" && export all_proxy=http://proxy.corporation.int:8080"
alias noproxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_NOPROXY\" && unset all_proxy"
To do the switch when roaming, you would just execute from a shell:
[me#linuxbox me]$ proxy
or
[me#linuxbox me]$ noproxy
Obviously, both aliases proxy and noproxy can include much more changes than just setup of MAVEN_NOPROXY and all_proxy.
I was frustrated by the same problem: having to manually edit settings.xml when roaming between networks. So much in fact, that I wrote a Maven plugin that enables automatic discovery of proxy settings. The current implementation uses the proxy-vole library written by Bernd Rosstauscher to detect proxy settings based on OS configuration, browser, and environment settings.
I've just released the source code of the plugin on Github, under an Apache 2.0 license: https://github.com/volkertb/autoproxy-maven-plugin
You're welcome to give it a try and to see if it meets your needs. Any feedback or contributions are welcome!
(Note: you don't necessarily have to add the plugin to your project's POM. You can invoke it from the command line as well, after you've installed it. See the README on the site for more details.)
You can set MAVEN_OPTS when you need to activate a proxy:
export MAVEN_OPTS="-Dhttp.proxyHost=my-proxy-server -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=*.my.org -Dhttps.proxyHost=my-proxy-server -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=*.my.org"