Skip to content

Commit

Permalink
Minimal infrastructure documentation updated.
Browse files Browse the repository at this point in the history
The minimal infrastructure documentation now
guides us through setting up all the application
docker containers that host the infrastructure,
the connectivity and application access, the dev
environment, creating a project from archetypes,
running and testing the project locally,
setting up the GitLab CI/CD pipeline, and finally
building, deploying and pushing artifacts.

Shell file removed as it is no longer needed.

docker-compose updated to work with nginx, nexus,
gitlab, and a custom gitlab-runner.

.m2/settings.xml added to the infrastructure
folder.

gitlab-runner Dockerfile added with openjdk,
maven and nodejs on top.

nginx configuration changed.

Fixed #162

Signed-off-by: Ivan Zdravkov <[email protected]>
  • Loading branch information
Ivan Zdravkov committed Aug 9, 2024
1 parent 6de896e commit d15e34e
Show file tree
Hide file tree
Showing 12 changed files with 496 additions and 712 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ typescript/vrotsc-annotations/package-lock.json
.vscode/*

.flattened-pom.xml

infrastructure/.m2/repository
62 changes: 62 additions & 0 deletions infrastructure/.m2/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>VMware1!</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf> <!-- Use '*' for all repositories or 'central,snapshots' to specify -->
<name>Mirror of Central Repository</name>
<url>https://repo1.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>releases</id>
<name>pscoe</name>
<url>http://infra.corp.local/nexus/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>

Check failure

Code scanning / CodeQL

Failure to use HTTPS or SFTP URL in Maven artifact upload/download High

Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://infra.corp.local/nexus/repository/maven-releases/
<repository>
<id>snapshots</id>
<name>pscoe</name>
<url>http://infra.corp.local/nexus/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

Check failure

Code scanning / CodeQL

Failure to use HTTPS or SFTP URL in Maven artifact upload/download High

Downloading or uploading artifacts over insecure protocol (eg. http or ftp) to/from repository http://infra.corp.local/nexus/repository/maven-snapshots/
</repositories>
</profile>
<profile>
<id>packaging</id>
<properties>
<keystoreGroupId>com.vmware.pscoe.build</keystoreGroupId>
<keystoreArtifactId>keystore.example</keystoreArtifactId>
<keystoreVersion>2.41.0</keystoreVersion>
<vroPrivateKeyPem>target/${keystoreArtifactId}-${keystoreVersion}/private_key.pem</vroPrivateKeyPem>
<vroCertificatePem>target/${keystoreArtifactId}-${keystoreVersion}/cert.pem</vroCertificatePem>
<vroKeyPass>VMware1!</vroKeyPass>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
<activeProfile>packaging</activeProfile>
</activeProfiles>
</settings>
109 changes: 56 additions & 53 deletions infrastructure/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,88 @@
version: "3"
services:
# NGINX reverse proxy server
nginx:
image: nginx:1.18.0
image: nginx
container_name: nginx
restart: always
networks:
infranet:
ipv4_address: 172.18.0.10
ports:
- "80:80"
- "443:443"
- 80:80 # Web Interface
hostname: "infra.corp.local"
volumes:
- "./nginx/conf.d:/etc/nginx/conf.d"
- "./nginx/vhost.d:/etc/nginx/vhost.d"
- "./nginx/html:/usr/share/nginx/html"
- "./nginx/certs:/etc/nginx/certs:ro"
- "./nginx/proxy.conf:/etc/nginx/proxy.conf:ro"
- "/var/log/nginx:/var/log/nginx"
# GitLab CE Git repository manager
- "./nginx:/etc/nginx/"
nexus:
image: klo2k/nexus3 # Mac
#image: sonatype/nexus3 # Linux
container_name: nexus
hostname: "nexus.corp.local"
environment:
NEXUS_CONTEXT: nexus
networks:
infranet:
ipv4_address: 172.18.0.11
extra_hosts:
- "gitlab.corp.local:172.18.0.12"
ports:
- 8081:8081 # Web Interface
volumes:
- "nexus-data:/var/sonatype/work"
restart: always
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
gitlab:
image: gitlab/gitlab-ce:12.10.3-ce.0
image: yrzr/gitlab-ce-arm64v8 # Mac
#image: gitlab/gitlab-ce # Linux
container_name: gitlab-ce
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url "http://infra.corp.local/gitlab"
external_url 'http://infra.corp.local/gitlab'
networks:
infranet:
ipv4_address: 172.18.0.11
ipv4_address: 172.18.0.12
extra_hosts:
- "infra.corp.local:<DOCKER_HOST_IP>"
- "infra.corp.local:172.18.0.10"
ports:
- "127.0.0.1:8080:80"
- 8082:80 # Web Interface
- 8022:22 # SSH
hostname: "gitlab.corp.local"
volumes:
- "/srv/gitlab/config:/etc/gitlab"
- "/srv/gitlab/logs:/var/log/gitlab"
- "/srv/gitlab/data:/var/opt/gitlab"
# GitLab CI Runner for CI/CD integration
- "gitlab-config:/var/gitlab/config"
- "gitlab-data:/var/gitlab/data"
- "gitlab-log:/var/gitlab/log"
gitlab-runner:
image: pscoelab/vrbt-gitlab-runner:latest
image: gitlab-runner # Custom image build from the gitlab-runner directory
container_name: gitlab-runner
restart: always
hostname: "gitlab-runner.corp.local"
networks:
infranet:
ipv4_address: 172.18.0.12
extra_hosts:
- "infra.corp.local:172.18.0.10"
- "gitlab.corp.local:172.18.0.11"
- "artifactory.corp.local:172.18.0.13"
volumes:
- "/srv/gitlab-runner/config:/etc/gitlab-runner"
- "/srv/gitlab-runner/m2:/home/gitlab-runner/.m2"
- "/srv/gitlab-runner/opt:/var/opt"
- "/var/run/docker.sock:/var/run/docker.sock"
# JFrog Artifactory OSS for artifact management
artifactory:
image: docker.bintray.io/jfrog/artifactory-oss:6.19.1
container_name: artifactory
hostname: "artifactory.corp.local"
networks:
infranet:
ipv4_address: 172.18.0.13
extra_hosts:
- "gitlab.corp.local:172.18.0.11"
- "infra.corp.local:172.18.0.10"
- "nexus.corp.local:172.18.0.11"
- "gitlab.corp.local:172.18.0.12"
ports:
- 127.0.0.1:8081:8081
- 2811:2811
volumes:
- /data/artifactory:/var/opt/jfrog/artifactory
# Add extra Java options by uncommenting the following lines
# environment:
# - EXTRA_JAVA_OPTIONS=-Xmx4g
restart: always
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
- "./.m2:/home/gitlab-runner/.m2"
- "gitlab-runner-config:/var/gitlab-runner/config"
- "gitlab-runner-opt:/var/gitlab-runner/opt"
- "/var/run/docker.sock:/var/run/docker.sock"
volumes:
nexus-data: {}
gitlab-config: {}
gitlab-data: {}
gitlab-log: {}
gitlab-runner-config: {}
gitlab-runner-opt: {}
networks:
infranet:
external: true
infranet:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/24
6 changes: 0 additions & 6 deletions infrastructure/etc/hosts

This file was deleted.

20 changes: 20 additions & 0 deletions infrastructure/gitlab-runner/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM gitlab/gitlab-runner:latest

RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y openjdk-17-jdk
RUN apt-get install -y software-properties-common
RUN apt-get install -y maven

# Install Node.js (npm is included in the package)
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

# Print the versions
RUN node -v
RUN npm -v
RUN mvn -v
RUN java --version

# Clean up the package lists to reduce image size
RUN rm -rf /var/lib/apt/lists/*
Loading

0 comments on commit d15e34e

Please sign in to comment.