![]() The Nexus 3 startup script is a good example of such a script. Often, all the same, notorious PID files are used, either explicitly or implicitly, and, nohup, special TCP ports and other tricks from the last century (see Karaf example) Collect the Java-command, as a result, it is necessary to execute, from listed aboveĪnd, finally, execute this Java command.The parsing arguments to the command line: start|stop|restart|reload|status|.Generate a CLASSPATH loop of type: for f in $ path/*.Configure the environment: ulimits, environment variables, etc.Finds their components, libraries, paths to them by surrounding directories, configuration files, etc.Optimize the JVM via -XX-parameters taking into account the specificity of the selected version of the JRE/JDK.Calculate the numerical parameters of the JVM, for example, the memory size (-Xms, -Xmx), the number of GC streams, etc.Look for JRE/JDK in the secluded corners of the file system and choose the most appropriate version by tricky rules, sometimes even specific for each OS.Determine the version and release of the OS via uname, /etc/* release, etc.Use the POSIX shell syntax with all its crutches for UNIX/Linux portability.Typically, these scripts do something like: So, if you look closely at the above-mentioned startup-scripts in Java-projects, you can see in the obvious signs of this prehistoric approach, including even mentioning SunOS, HP-UX and other UNIX-s. The approach is simple and straightforward, but these scripts stop working with every non-standard situation, requiring manual measurement, do not allow running several copies of the process.but not the point. Init scripts set the necessary environment settings, which in different UNIX-s were their own, and, depending on the arguments, they started the process or restarted/stopped it using the ID from the PID-file. To manage the processes, we used portable shell scripts (init scripts) and PID-files. In a nutshell, in ancient times, when UNIX was not interrogated at the mention of "in the sense of Linux?", there were no Systemd and Docker, etc. In short, let's look at the example of the Nexus 3 mentioned above, how to return from the labyrinth of shell scripts to something more similar to java -jar, given the convenient modern DevOps-tools. And now imagine that the set of such components and services needs to be packaged in a Docker container, simultaneously writing another layer of abstraction for more or less adequate orchestration, deployed in the Kubernetes cluster and implemented this process in the form of CI / CD-payline. Opacity, redundancy, entanglement of startup scripts creates problems even when manually installing one component on the local system. Our current "patient" in this series, inspired us to write this article - the repository of Nexus OSS 3 artifacts, the launch script which takes ~ 400 lines of code. At a minimum, these were multi-line shell scripts, as in Tomcat, and even entire frameworks, as in Hadoop. ![]() ![]() He used to work with many systems based on the Java-stack: from small (like Tomcat) to large ( Hadoop, Cassandra, etc.).Īlmost every such system, even the simplest, for some reason had a complex unique launch system. One of our colleagues works as the DevOps-engineer, and he often deals with the automation of the installation and configuration of a variety of IT-systems in various environments, from containers to the cloud.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |