Java Offline Construction
After delivering many enterprise-level users, we found that many users' environments are offline. We have been exploring solutions for implementing source code construction in an offline environment, so that these enterprise users can and can experience the convenience brought by Kato’s source code construction function.
So, what are the difficulties in implementing source code construction in an offline environment? In fact, the answer to this question is which points in the entire source code construction process are dependent on the Internet:
Code Repository: The starting point of the source code construction process is an available code repository. In an offline environment, we cannot use Internet-based code repositories such as Github and Gitee. Private code repositories such as Gitlab and Gogs have become the best choice. Some users already have their own private code repository. In this case, ensure that the server where the Kato management node is located can access the code repository normally; for users who have not built their own private code repository, how to quickly Building a Gitlab or Gogs is the first hurdle that needs to be overcome when building offline source code.
**Building a private server: **Building a private server refers to obtaining a repository of dependent packages during the source code building process. Common ones include Nexus, Artifactory, etc. Some users already have their own private server to manage their own dependency packages. In this case, we provide a solution to allow Kato to directly connect to the private server; for users who have not yet built their own private server, Kato comes with The rbd-repo component can be used as a local repository.
**Application runtime: **Application runtime refers to the environment on which the service runs. For example, for Java applications, the runtime is the Jdk installed in the environment. For users, how to configure the application runtime in an offline environment is the biggest challenge for offline source code construction.
After clarifying the above difficulties, the next article will take Java application construction as an example to guide users to overcome these difficulties step by step, and finally achieve the goal of offline source code construction.
Offline Deployment Code Repository
In an offline environment, it is recommended to use the application offline import function of the platform to quickly import Gitlab applications and install them.
Visit Kato application management platform and import offline application package
Gogs offline import method is the same as Gitlab.
At this point, we have a privatized code repository. You can use it to host the code, and you can use it to achieve auto-build.
Offline docking/deployment to build a private server
The Java source code is based on Maven. During the build process, the dependencies are parsed according to the
pom.xml file and go to the specified private server to pull the dependent packages. In Kato, the default source code build package repository
rbd-repo is installed. This component can be used as an agent for an existing private server, or it can be used to build a local private server to meet the needs of different users.
[Build a local repository and import the jar package](../connection-maven-repository/#Use the built-in maven repository of Gridworkz)
Offline configuration application runtime
This section provides a solution for offline installation of runtime (Jdk) in the application. This solution will run a private server repository service, which can be responsible for installing the Jdk environment required for java operation.
Download offline resource mirroring in an online environment
docker pull kato/buildpack:java-v5.1.5 docker save kato/buildpack:java-v5.1.5> kato-buildpack-java-v5.1.5.tgz
Put the saved image compressed file on the first management node, and then import the image:
docker load -i kato-buildpack-java-v5.1.5.tgz docker tag kato/buildpack:java-v5.1.5 gridworkz/buildpack:java-v5.1.5 docker push gridworkz/buildpack:java-v5.1.5
Run private server repository service
docker run -d -p 2017:2017 -i gridworkz/buildpack:java-v5.1.5 --name java-offline
Docking rbd-repo and modify remote repository
All nodes rbd-repo need to be adjusted
Modify the URL of the remote repository
http://<first management node IP>:2017/lang/
At this point, the Java source code build environment in the offline environment is configured.