How can I serve HTML files for development using maven? - maven-3

I'm working on a scala app (building with maven) where the UI is html and javascript and the back end is a REST API. For deployment, the html/javascript will just get thrown into nginx as static resources, but for development I just want something that serves up the files from local disk. Other teams use gulp-connect for this, but I'm hoping to avoid adding a second build tool (i.e., gulp) to my stack if I can avoid it.
What are my options for going about this? I see there's an nginx plugin for maven, but it's poorly documented. NanoHttpd seems promising, but it looks like I'd have to write my own maven plugin.

Related

Fitnesse wiki file persistence options

What are the persistence options for fitnesse files? So far it seems like a file system is the only thing supported. There does appear to be an out of date database plugin. Is there anything else that is supported (S3, database, etc.)? Is there a way to control where files are persisted if using the filesystem?
I believe there is very little in that area. The location of the files can be controlled using a command line option. See http://fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.QuickReferenceGuide#FitNesseCommandLINE
-d /path/to/fitnesse/root
How I've used the FitNesse wiki is as a local development tool, with the pages on the file system. Once I'm satisfied with the tests I commit them to version control (e.g. git) so that they become part of the (integration) test pipeline setup (e.g. they are run as part of the CI/CD pipeline of the project).
There is a plugin I believe that will automatically commit any save actions to Git, but I've never used that. Saving each edit action just pollutes version control in my opinion. I only want to see tests after they have been checked/completed, and that tends not to be each save.
Working on a shared wiki environment (where I would expect a non-file system approach would fit in) you run into the same problem, I expect. Developing automated tests is a development task that requires some iterations before it is 'done', and not all attempts reach that 'done' state. So using shared storage for wiki persistence creates 'noise' in the test-set: which are the tests that form the current reference set that should pass and what is work in-progress.
If you are working on a larger project where new features are developed together with their automated tests it becomes even more important to know which test changes belong to which features/changes. Having tests on the file system, in version control, allows you to develop test in sync with code changes in the same branch. This is what I would recommend.

How to delete page from an Eleventy website?

I want to remove a page I created in my Eleventy-generated website, let's call it a-post.md. And I don't know what's the right way to do it.
I just remove the "source" page and, sure enough, it disappeared from the site. However, the files it generates in the _site directory are still there. Am I supposed to "clean" these by hand or am I doing something wrong?
I know this kind of stuff shouldn't be a question on Stackoverflow ― but as a newbie in the world of Eleventy (and static sites generators), I was baffled by the lack of newbie-friendly documentation on the matter. There are also a lot of articles and posts on how to create and customize pages, but not on how to dispose of them correctly.
The problem you're describing usually only happens during development on your local machines, where the site output sticks around in between builds. SSG are heavily geared towards atomic deploys. This means every deployment will be executed in it's own temporary container environment and the generated site will completely replace the previous build. This means that the newly deployed build will never contain files from a previous build. This is true for all SSG hosting providers like Netlify or Vercel.
The problem you're describing usually only occurs locally during development and if you're deploying new versions of your site manually by uploading it over SFTP or something like this.
Local development
It's best practice to remove your output folder before the build step so your local build matches the atomic deploy you will get in the live environment. You can put the clear command in your build script, this way you never have to think about it (assuming your output directory is dist):
"scripts": {
"build": "rm -rf dist/ && eleventy"
}
Manual deploys
This is really not the best way to deploy your site, but if you're doing this I would try to mimic an atomic deploy:
Upload the new build next to the webroot of your live site. For example, if your live site lives in htdocs, upload the new site as htdocs-new
Delete the htdocs folder.
Rename htdocs-new to htdocs.
This way, you will never get any remnants of previous builds sticking around. The downside is that between steps 2 & 3 your site will be unavailable, whereas atomic deployments on Netlify or Vercel have zero downtime.

Is there a way to track usage of a global shared library in Jenkins?

Context:
At my work most developers are free to write their own Jenkinsfile for their own team's projects.
As the Jenkins admin, I provide developers with a global shared library.
Most projects are using either v1 or v2 or v3 or another version of this library, using the idiom library("theSharedLib#v#").
Question: Is there a way for me to find out which Jenkinsfile is using which version of the shared library without having to actually lookup into all those Jenkinsfile files (50+ files in as much git repos)?
What I would see best is some mechanism that write up (into a file on the Jenkins master or in a DB) which project/Jenkinsfile is using which version at the time the library is loaded.
A possible solution would be to add some code to every function inside the library that will actually do this reporting. I could then see which function is used by who. Any better solution?
I wrote https://github.com/CiscoDevNet/es-logger to gather information such as this from Jenkins. It has a plugin that will run a regex against the console log of a completed job and can then post events to elastic search.
Jenkins helpfully posts library loads at the start of the log such as:
Loading library sharedLib#version
So a simple regex like
"^Loading library\S+(?P<library_name>.*?)#(?P<library_version>.*?)\S+$"
added to the console_log_events plugin would generate events in an elastic search for each usage and each version.

Does Jenkins have anything like TeamCity's service messages?

TeamCity has a feature that (as near as I can figure) is called "service messages". You can see the documentation here. Essentially, it lets me write things like
##teamcity[publishArtifacts '<path>']
to tell the build server to do things. I like this feature. It lets me include the build server steps in my build scripts (and thus in source control) rather than as a configuration on the server. This makes migrating to a different server or recovering from disaster more reliable, "documents" this behavior, and allows multiple builds to leverage it without additional configuration. It's several less things people have to remember to set up when they make new build configurations, and it's much easier to write print '<message>' than it is to load the build server's web interface and drill through several pages looking for the right configuration page.
I've looked around, but I haven't been able to find anything that does this for Jenkins. Does Jenkins have anything similar?

Create a Glassfish 3 domain as part of ant build?

I have a JEE6 project based on Glassfish 3.1.1 that is moving beyond the "one developer prototype" stage to being developed by a team.
Each member of the team will have their own local glassfish server. I don't want each of them to have to go through all the manual steps of setting up the JDBC connection pool, JMS services, jdbc security realm, etc via the admin console, as I did when first developing the prototype. It is error prone, and plus if I want to change something I have to tell everyone what to do. I want it to be done as part of the ant build, so that it is a one-clicker, and then if I have to change something I can just tell them to do a clean to blow away the domain and then run it again. So there would be an ant task to "config-glassfish" that would somehow configure the domain for them.
Despite extensive searching, I can't seem to find any step-by-step guide of how best to accomplish this. Anyone have a link?
Would it be best to attempt to capture the fully configured domain and store that in our src repository?
Or should I instead have ant issue "asadmin" commands to create and configure the domain?
You can do all of this with the sun-appserv-admin ant task. You can find more information here: http://docs.oracle.com/cd/E19316-01/820-4336/beaev/index.html
We struggle with this kind of thing at my work too, but only with a few developers. One thing I really like is that Glassfish has the concept of a resources.xml which will cover a lot of the config. I use this to pass around connection pool configs and JMS queues and it works really well, but it might not cover all your config needs. The contents of the file are pretty much snippets from the domain.xml, and I haven't figured out everything it can do yet. http://docs.oracle.com/cd/E19798-01/821-1751/ggoeh/index.html http://javahowto.blogspot.com/2011/02/sample-glassfish-resourcesxml.html
I haven't tried other ideas since the resources.xml solves my major pain points, but you could take your domain.xml and work through any issues brought up by copying it to another developer's domain, then do variable replacement on the part of the file that need it. That way you could have ant create the domain, then overwrite the domain.xml with the newly filled out one.
Maybe there is a way you could use asadmin backup-domain
One other idea would be Chef. http://wiki.opscode.com/display/chef/Home
I ended up just putting the domain.xml into the src repository, making an ant task to copy it over to the glassfish directory, and instructing other developers that when running that ant task, they should make sure glassfish is not running.
This worked for my case...

Resources