{"id":24362888,"url":"https://github.com/johnbedeir/nexus-project","last_synced_at":"2026-02-07T03:02:00.547Z","repository":{"id":271663934,"uuid":"914172165","full_name":"johnbedeir/Nexus-project","owner":"johnbedeir","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-11T15:56:12.000Z","size":404,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-24T15:11:42.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnbedeir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-09T04:44:54.000Z","updated_at":"2025-01-11T15:56:15.000Z","dependencies_parsed_at":"2025-01-09T06:38:45.963Z","dependency_job_id":"49d5cce9-5f26-4b21-a6f9-fe9931fb8072","html_url":"https://github.com/johnbedeir/Nexus-project","commit_stats":null,"previous_names":["johnbedeir/nexus-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johnbedeir/Nexus-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2FNexus-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2FNexus-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2FNexus-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2FNexus-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnbedeir","download_url":"https://codeload.github.com/johnbedeir/Nexus-project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnbedeir%2FNexus-project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29185112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T00:44:15.062Z","status":"online","status_checked_at":"2026-02-07T02:00:07.217Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-18T22:54:12.917Z","updated_at":"2026-02-07T03:02:00.519Z","avatar_url":"https://github.com/johnbedeir.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nexus-Project\n\nThis project automates the deployment of a Nexus VM on Azure using Terraform, builds a Java web application, and facilitates deployment using Docker and Kubernetes. It also integrates CI/CD pipelines with GitHub Actions for streamlined image building and pushing to Nexus.\n\n---\n\n## Prerequisites\n\n- **Azure Subscription**: Ensure you have access to an Azure account.\n- **Terraform**: Install Terraform CLI ([Download Terraform](https://www.terraform.io/downloads)).\n- **Docker**: Install Docker ([Install Docker](https://docs.docker.com/get-docker/)).\n- **Minikube** (or a Kubernetes cluster): Install Minikube ([Install Minikube](https://minikube.sigs.k8s.io/docs/start/)).\n- **Java \u0026 Maven**: Install Java Development Kit (JDK) and Maven.\n\n---\n\n## Steps to Deploy\n\n### **1. Configure Azure Infrastructure**\n\n#### **Set Up Terraform Variables**\n\n1. Add your Azure subscription ID to `terraform/subscription.txt`:\n\n   ```bash\n   4b0000b-cxxx-40000-bxxxx-b8xxxxxx6a\n   ```\n\n2. Configure `terraform/terraform.tfvars` with the following:\n   ```bash\n   subscription_id=\"4b0000b-cxxx-40000-bxxxx-b8xxxxxx6a\"\n   location=\"East US\"\n   tenant_id=\"6fxxxxxf-2xxx-4xxxx-8xxd-1fxxxxxxxxx6\"\n   vmuser=\"\u003cVM_USERNAME\u003e\" # Your VM SSH username\n   ```\n\n#### **Build the Infrastructure**\n\nRun the provided script to build the Azure infrastructure:\n\n```bash\ncd terraform/\n./build.sh\n```\n\n#### **Outputs**\n\nOnce completed, you’ll receive the public IP of the Nexus VM:\n\n```bash\nvm_public_ip = \"13.82.212.227\"\n```\n\n---\n\n### **2. Connect to the Nexus VM**\n\n- SSH into the Nexus VM using the public IP and the username configured in `terraform.tfvars`:\n\n`The Script will do this step for you and echo the admin password in the console.`\n\n```bash\nssh \u003cVM_USERNAME\u003e@13.82.212.227\n```\n\n- Retrieve the Nexus password for initial login.\n\n---\n\n### **3. Configure Nexus**\n\nNavigate to `Nexus` using the Public IP of the Nexus VM and the port `13.82.212.227:8081`\n\nSign in using the username `admin` and the password (that will be shown in your terminal).\n\nCreate a repository for your docker image, make sure it is `docker-hosted`\n\n### **4. Run the Java Application Locally**\n\n#### **Build the Application**\n\nNavigate to the `app` directory and package the Java web app:\n\n```bash\ncd app/\nmvn package\n```\n\n#### **Run the Application**\n\nRun the packaged `.jar` file:\n\n```bash\njava -jar target/demo-0.0.1-SNAPSHOT.jar\n```\n\nAccess the application at `http://localhost:8080`.\n\n---\n\n### **5. Run the Application Using Docker**\n\n#### **Build the Docker Image**\n\n```bash\ncd app/\ndocker build -t javawebapp-img .\n```\n\n#### **Run the Docker Container**\n\n```bash\ndocker run --name javaapp-container -p 8080:8080 javawebapp-img:latest\n```\n\nAccess the application at `http://localhost:8080`.\n\n---\n\n### **6. Configure Nexus for Docker**\n\n#### **Enable HTTP Port**\n\n1. Log in to Nexus.\n2. Navigate to **Settings \u003e Repositories**.\n3. Select the repository or create a new one (e.g., `docker-hosted`).\n4. Enable **HTTP Port** (e.g., `8082`) and **Docker V1 API**.\n\n\u003cimg src=imgs/http.png\u003e\n\n#### **Update Docker Daemon**\n\nEdit the `daemon.json` file on your system to include the Nexus registry:\n\n```bash\n{\n  \"insecure-registries\": [\"13.82.212.227:8082\"]\n}\n```\n\nRestart Docker:\n\n```bash\nsudo systemctl restart docker\n```\n\n### Also Navigate to `Nexus` go to `Settings` then choose `Realms` and set `Docker Bearer Token` to be `Active`\n\n\u003cimg src=imgs/docker.png\u003e\n\n---\n\n### **7. Deploy the Application Using Kubernetes**\n\n#### **Start Kubernetes**\n\nStart Minikube or your local Kubernetes cluster:\n\n```bash\nminikube start\n```\n\n#### **Create a Namespace**\n\nCreate a namespace for the application:\n\n```bash\nkubectl create ns javawebapp-namespace\n```\n\n#### **Deploy the Application**\n\nApply the Kubernetes manifests:\n\n```bash\nkubectl apply -n javawebapp-namespace -f k8s\n```\n\n---\n\n### **8. CI/CD with GitHub Actions**\n\n#### **Configure GitHub Secrets**\n\n1. Navigate to **Settings \u003e Secrets and Variables \u003e Actions** in your GitHub repository.\n2. Add the following secrets:\n   - `NEXUS_REGISTRY` (e.g., `13.82.212.227:8082`)\n   - `NEXUS_USERNAME` (e.g., `admin`)\n   - `NEXUS_PASSWORD` (e.g., `\u003cyour-nexus-password\u003e`)\n\n#### **Trigger CI/CD**\n\nCommit your changes to the repository. This triggers the GitHub Actions workflow to:\n\n1. Build the Docker image.\n2. Push the image to the Nexus registry.\n\n\u003cimg src=imgs/github-actions.png\u003e\n\n\u003cimg src=imgs/nexus.png\u003e\n\n### **9. Deploy Monitoring**\n\nDeploy Monitoring stack using Helm\n\n```bash\nhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts\n\nhelm repo update\n\nhelm install kube-prometheus-stack prometheus-community/kube-prometheus-stack\n```\n\nUsing `k9s` Navigate to `svc` and at the service `kube-prometheus-stack-grafana` press `shift`+`f` to port forward locally at `http://localhost:3000`\n\n#### Access Grafana\n\n```bash\nUsername: admin\nPassword: prom-operator\n```\n\n\u003cimg src=imgs/grafana.png\u003e\n\n### **10. Deploy ArgoCD**\n\nDeploy ArgoCD using Helm\n\n```bash\nhelm repo add argo https://argoproj.github.io/argo-helm\n\nhelm repo update\n\nhelm install argo argo/argo-cd\n```\n\nPort forward to localhost\n\n```bash\nkubectl port-forward service/argo-argocd-server -n default 8080:443\n```\n\n### Create a New Application in ArgoCD\n\n1. **Navigate to Applications**:\n\n   - After adding your repository, go to the **Applications** section from the left sidebar.\n\n2. **Create a New Application**:\n\n   - Click the **New App** button.\n\n3. **Application Configuration**:\n\n   - **Application Name**: Provide a name for your application, e.g., `my-app`.\n   - **Project**: Select `default` unless you've set up a custom project.\n   - **Sync Policy**: Set to manual or automatic depending on your needs.\n   - **Repository URL**: Choose the repository you added earlier.\n   - **Path**: Specify the path to the directory where your Kubernetes manifests or Helm chart are located, e.g., `k8s/`.\n   - **Cluster**: Choose the cluster where you want to deploy the application (usually the in-cluster Kubernetes context).\n   - **Namespace**: Enter the Kubernetes namespace where the application should be deployed, e.g., `default`.\n\n4. **Sync Options**:\n\n   - You can enable auto-sync to automatically deploy changes from the repository to the cluster.\n   - Optionally, enable self-heal and prune resources.\n\n5. **Create the Application**:\n   - Once all the fields are configured, click **Create** to create the application.\n\n### 5. Sync and Deploy the Application\n\n1. After the application is created, you will be redirected to the application dashboard.\n2. If you've set up auto-sync, ArgoCD will automatically deploy the application based on the configurations in the repository.\n3. If manual sync is enabled:\n   - Click on the **Sync** button to manually trigger the deployment.\n   - Monitor the sync status and logs to ensure the application is deployed correctly.\n\n### **10. Destroy the Nexus VM**\n\nTo destroy the whole terraform environment that was created for the `Nexus VM` just run the following script:\n\n```\n./destroy.sh\n```\n\nThis should destroy the environment and make sure nothing is left on the Azure cloud.\n\n## Notes\n\n- **Security**: Enable HTTPS on Nexus for secure communication.\n- **Customizations**: Modify `terraform.tfvars` and Kubernetes manifests (`k8s`) to fit your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fnexus-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnbedeir%2Fnexus-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnbedeir%2Fnexus-project/lists"}