Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifactory in cloud (in K8 optional) that can communicate with github.com. #4

Closed
2 tasks done
Tracked by #1
pranereddy opened this issue Aug 21, 2021 · 2 comments
Closed
2 tasks done
Tracked by #1
Assignees
Labels
task User story or task

Comments

@pranereddy
Copy link
Contributor

pranereddy commented Aug 21, 2021

What needs to be done?

Deploy artifactory (OSS) in the cloud.

Why is it necessary?

For integrating with github.com

Prerequisites:

  • K8 cluster or VM on the cloud.

Where it needs to be done?

Google cloud either in k8 cluster or Compute Engine

Acceptance Criteria

  • Artifactory is deployed and reachable via internet
@pranereddy pranereddy added the task User story or task label Aug 21, 2021
@pranereddy pranereddy added this to To do in GitHub IssueOps Aug 21, 2021
@pranereddy pranereddy moved this from To do to In progress in GitHub IssueOps Aug 21, 2021
@pranereddy
Copy link
Contributor Author

pranereddy commented Aug 24, 2021

Deploying Artifactory on the Google cloud

  1. Open the cloud shell from the GKE cluster created earlier and connect to the project
    gcloud container clusters get-credentials artifactory-oss-cluster --zone us-central1-a --project infra-inkwell-323006
  2. Download the latest version of artifactory oss from jfrog repository
    docker pull docker.bintray.io/jfrog/artifactory-oss:latest
  3. Now create a repository in gloud for storing container images for deploying to gke
export PROJECT_ID=infra-inkwell-323006
gcloud config set project $PROJECT_ID
gcloud artifacts repositories create devops-tools    --repository-format=docker    --location=us-central1   --description="Docker repository"
docker tag docker.bintray.io/jfrog/artifactory-oss us-central1-docker.pkg.dev/${PROJECT_ID}/devops-tools/artifactory-oss:latest
gcloud auth configure-docker us-central1-docker.pkg.dev
docker images
REPOSITORY                                                                     TAG       IMAGE ID       CREATED       SIZE
docker.bintray.io/jfrog/artifactory-oss                                        latest    5edb92baa394   13 days ago   825MB
us-central1-docker.pkg.dev/infra-inkwell-323006/devops-tools/artifactory-oss   latest    5edb92baa394   13 days ago   825MB
docker push us-central1-docker.pkg.dev/infra-inkwell-323006/devops-tools/artifactory-oss 
  1. Create a Kubernetes Deployment for the above artifactory Docker image.
kubectl create deployment artifactory --image=us-central1-docker.pkg.dev/${PROJECT_ID}/devops-tools/artifactory-oss:latest
kubectl get deployments
NAME          READY   UP-TO-DATE   AVAILABLE   AGE
arti-oss      1/1     1            1           14h
artifactory   1/1     1            1           5s
kubectl get pods
NAME                           READY   STATUS    RESTARTS   AGE
arti-oss-8668c66455-djrz2      1/1     Running   0          14h
artifactory-5c94d6b954-fqrrl   1/1     Running   0          64m
  1. Set the autoscaling if needed
kubectl scale deployment artifactory  --replicas=3
kubectl autoscale deployment artifactory  --cpu-percent=80 --min=1 --max=5
  1. Check the deployment from UI console and expose ports to access artifactory from internet

image

Artifactory service runs on two ports 8081 for RSET Api and 8082 for UI, these will be exposed to internet using Loadbalancer service

image

  1. Access the Artifactory UI by visiting the exposed endpoints

image

image

@pranereddy
Copy link
Contributor Author

pranereddy commented Aug 24, 2021

Creating Persistent Volume Claim

Changes made to the above created artifactory are not permanent as there is no persistent storage attached to the pod. Let's create a PVC and attach to the pod.

  1. Connect to the gcloud shell and create a yaml file for the PVC.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: artifact-storage
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  1. Create the PVC by applying the above yaml.
kubectl apply -f artifactory-pvc.yaml
ctory-pvc.yaml
pranereddy@cloudshell:~ (infra-inkwell-323006)$ kubectl get pvc
NAME               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
arti-storage       Bound    pvc-5480933d-82b6-49b8-a307-a7a3febedde9   10Gi       RWO            standard       15h
artifact-storage   Bound    pvc-b344edd1-7994-4e8d-b9ff-9e089a08abe0   10Gi       RWO            standard       89m
  1. Edit the deployment yaml file from UI console, add the volume details to the yaml

image

image

  1. Now, visit the Artifactory UI endpoint and change default admin password and create sample repositories.

@pranereddy pranereddy self-assigned this Aug 24, 2021
GitHub IssueOps automation moved this from In progress to Done Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task User story or task
Projects
Development

No branches or pull requests

1 participant