How can I speed up page load times while developing a Confluence macro with the Atlassian SDK? batch.js and batch.css taking up to 50 seconds - confluence

I've gone through the Confluence "Hello World" tutorial (https://developer.atlassian.com/server/framework/atlassian-sdk/create-a-confluence-hello-world-macro) and have a working macro.
But every page refresh takes up to 50 seconds, due to batch.css and batch.js probably being regenerated.
I've already tried a couple of suggestions given in different Atlassian forum threads.
Currently pom.xml looks the following
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
...
<extensions>true</extensions>
<configuration>
...
<enableQuickReload>true</enableQuickReload>
<!-- make AMPS faster -->
<enableDevToolbox>false</enableDevToolbox>
<enablePde>false</enablePde>
...
<properties>
<confluence.version>6.14.0</confluence.version>
<confluence.data.version>6.14.0</confluence.data.version>
<atlassian.dev.mode>false</atlassian.dev.mode>
<amps.version>8.0.2</amps.version>
...
I've tried disabling batching with a quickreload.properties file in the plugin home directory with the following content
# non-filepath directive to quickreload to turn off batching (note the qr: prefix)
qr:webresourcebatching=false
But that only moves the issue to having hundreds of single files all together taking 40-50 seconds.
And I tried using ATLAS_OPTS="-Datlassian.dev.mode=false" as environment settings.
Screenshot of Firefox developer tools network tab

Related

Why won't the Keycloak with Spring Boot tutorial work?

I've been trying to follow the Keycloak tutorial from DZone (EDIT: which seems to be a nearly verbatim repost from the tutorial on the official Keycloak blog, apparently by the same author), but I've run into the following problems:
index.html not being found
when clicking on the link to the interior page, the error
We're sorry...
Page not found
on that same page, the error
javax.servlet.ServletException: Circular view path [products]: would dispatch back to the current handler URL [/products] again.
the Keycloak admin panel appearing instead of the sample app
What am I doing wrong?
There are a number of subtle but significant inconsistencies/typos in that tutorial. In order of appearance:
Main tutorial
the location of index.html is given as /src/resources/static. If you are using Spring Initializr, the pre-made code will have both main and test directories under src, so the correct location will instead be src/main/resources/static.
In the code for the controller, line 9 is
return "products";
This tells Spring to use products.html. The actual HTML file will be product, singular, because it is generated from product.ftl. Take the 's' off of the return value.
In the application.properties file, one of the lines given is
keycloak.realm=springboot
Earlier, when in the Keycloak admin panel, the guide suggested naming the realm "SpringBoot". These values need to match, and they are case-sensitive. Change either one.
After setup is complete, the instructions say
Now browse to “http://localhost:8080”
The correct URL is http://localhost:8081, since server.port was set to 8081 in application.properties. Port 8080 should still be in use by the admin console.
With these changes, the test app should load and behave as described.
Adding Spring Security
Be careful not to reintroduce the products/product typo when copying in the new getProducts() method.
Nowadays, to make the official documentation work, you can use the answer from SOLO and complement with the following code:
Add keycloak to POM
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-boot-starter</artifactId>
</dependency>
Add dependency management to POM
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.keycloak.bom</groupId>
<artifactId>keycloak-adapter-bom</artifactId>
<version>10.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Change .ftl format to .ftlh and use like this:
<html>
<h2>My products</h2>
<ul>
<#list products as product>
<li>${product}</li>
</#list>
</ul>
<p>
Logout
</p>

Unexpected element '{urn:jboss:domain:keycloak:1.0}subsystem

Happy New Year to all.
I have a keycloak/wildfly question.
I am attempting to secure my war for WildFly 9.0.2.Final deployment. I follow the directions in section 7.2.1 of http://docs.jboss.org/keycloak/docs/1.0.4.Final/userguide/pdf/keycloak-reference-guide-en-US.pdf
I get the error Unexpected element '{urn:jboss:domain:keycloak:1.0}subsystem
I have carefully followed each step as listed below.
cd $WILDFLY_HOME
unzip keycloak-wildfly-adapter-dist.zip
edit the standalone.xml and add the following:
<server xmlns="urn:jboss:domain:1.4">
<extensions>
<extension module="org.keycloak.keycloak-wildfly-subsystem"/>
...
</extensions>
<profile>
<subsystem xmlns="urn:jboss:domain:keycloak:1.0"/>
...
</profile>
It is the line subsystem xmlns="urn:jboss:domain:keycloak:1.0 that is flagged in the error.
What am I missing? Thank you in advance.
May be it's a little bit too late. I think the problem could be that you forget to merge modules, bins folder from key-cloak into Jboss, so that the container itself doesn't recognize the keycloak.

How to get a stable release of Spring Batch Admin

Here is what I've tried from their getting started page...
The SpringSource Community Download links to a page that has no mention of Spring Batch Admin. Looks like the original link is either dead or now redirects to something else.
I get connection timeouts for the S3Browse App link
The source building process just fails and every fix leads to a new failure. Started with missing artifacts/repositories and now looks to be related to Maven 3 vs Maven 2?
The maven build process seems to pull down a jar instead of a war
Google searches for download links keep referring me back to this page. What am I missing? There has to be some publicly available download page with prebuilts .war somewhere.
If you're looking to just test drive the app as I was, you can follow these steps:
Check out the source from github at https://github.com/spring-projects/spring-batch-admin. Next step is to go to the spring-batch-admin-sample directory and use maven/jetty to run it.
mvn jetty:run
Now in your browser, go to:
http://localhost:8080/spring-batch-admin-sample
My guess is documentation wasn't all updated (sigh).
SNAPSHOT builds aren't something that should be used somewhere serious, apart from no-other-way-out situations. Try either 1.2.2.RELEASE (not on github somewhy) or 1.2.1.RELEASE.
http://mvnrepository.com/artifact/org.springframework.batch/spring-batch-admin-manager/1.2.2.RELEASE
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-manager</artifactId>
<version>1.2.2.RELEASE</version>
</dependency>
https://github.com/spring-projects/spring-batch-admin/releases
Disclaimer - too lazy to try it out myself.

Can Nexus or Artifactory store simple tar.gz artifacts?

I have cloud servers located in separate data centers across the world. Each data center is separate from the others.
I'm looking for an easy way to deploy artifacts to individual clusters of servers (that may be running different versions of software i.e. a dev, test, and production cluster) in each of these regions with ease and consistency. It seems to me that an artifact server is what I need because I could execute an install script on the cloud server, which pulls down the correct software artifact.
Now, I work on the operations side. I don't care about doing builds, or managing software build dependencies. I simply want an artifact server where I can store all the different versions of my packages for access at a later time. The kicker, is that I have several different types of artifacts to store.
Shell scripts
Python scripts
Puppet manifests
Debian files (often delivered as a tar.gz file of multiple debians)
Can Nexus or Artifactory manage all of these types of packages, or should I be looking in a different direction? I'm not opposed to adding make files to my shell script projects that simply generate tar.gz files. I just don't want to go down the path of setting up an artifact repository, when ultimately, a little scripting, wget, and an apache server would work just fine.
Both Artifactory and Nexus can handle any type of file, as they both are "Binary Repository Managers".
Albeit that, Nexus can technically store any file, but lacks support for binaries that do not adhere to the Maven repository layout. For example, such files will not be indexed and cannot be retrieved in searches; Also, if non-Maven artifacts encumber module information in their path, then currently Artifactory is the only repository that can make use of that and allow version based operations on artifacts (e.g., download latest version query)
Although both of these tools have started out by solving a problem in the Maven world, the need for smart binary management has been recognized in many other fields, operations included.
Binaries do need a specialized manager, and although network shares/SCM/file servers seem like a viable option in the beginning; they just don't scale.
Also see my answer to a similar question for some of the benefits of a manager over the other ad-hoc solutions.
Yes, you can upload non-jar files. For example:
mvn deploy:deploy-file -DgroupId=org.group.id -DartifactId=artifact-id -Dversion=0.0.0.1-SNAPSHOT -Dpackaging=tar.gz -DrepositoryId=repository-id -Durl=http://url -Dfile=localfile-0.0.0.1-SNAPSHOT.tar.gz
Newer versions of Nexus will handle certain files like tar, swf, and others by validating that they are properly formed. This may cause unexpected or unwanted behavior, though.
Is this the best way to go... only you can say based on your use cases. Factors like how often artifacts change, network latency, and others can make or break a strategy.
refs:
https://stackoverflow.com/a/33311645/32453
http://betterlogic.com/roger/2012/04/mavennexus-upload-tgztar-gz-file/
If you want to do it with curl, try this approach: https://support.sonatype.com/entries/22189106-How-can-I-programatically-upload-an-artifact-into-Nexus-
You can (see the other answers). You can also refer to them for instance like this (though an example would be nice):
You can refer to/use them like this plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache</groupId>
<artifactId>activemq-distro</artifactId>
<version>5.7.0</version>
<type>gz</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
Solution for Nexus 3.
Start by creating a raw repository in Nexus:
Then you can use it in maven or via curl for example.
Example via curl:
curl -v --user '$NEXUS_REGISTRY_USER:$NEXUS_REGISTRY_PASSWORD' --upload-file ./my_artifact.tar.gz $NEXUS_GENERAL_REPOSITORY_URL/general-raw/my-project/my_artifact.tar.gz
More information here.

how to run application of spring batch using CommandLineJobRunner

I am creating an application using spring batch in which i am reading data from database and populate it in a file placed in D drive. My application does not have any errors but when i run my app, the console does not show any exceptions. In fact, the console is blank completely. I am not able to figure out if the app is actually getting executed or not.
I am using CommandLineJobRunner class for executing my job.
All your comments would be of great help.
Thanks
Reading data from database and populate it in a file placed in D drive
I am not able to figure out if the app is actually getting executed or not
Did you check the D drive? Is the file there? Was it populated as expected?
As a rule of thumb => write a test, that would make sure the file is there on the D drive, and that it has all the data expected. But as a start, you can just check it manually.
As to your question => The reason that you do not see anything, is most likely related to the logging misconfiguration.
If you use log4j / slf4j / etc, make sure to place a default (for a start) lo4j.properties / lo4j.xml file in your class path [e.g. root of your project]. If you use logback, make sure a logback.xml is in your classpath with (for a start) default configuration:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<logger name="org.root.level.package" level="debug"/>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
Did you develop your application using an IDE like Eclipse? If so, you might try debugging your code so that you can find out the reason why your application is not working as you expected it to be.