Skip to content

Commit

Permalink
Merge branch 'develop' into sprint-85-summary
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-jameson authored Nov 17, 2023
2 parents 3887e4a + 619687b commit b614166
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Technical-Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This directory contains system and architecture documentation including diagrams
- [data-file-downloads.md](./data-file-downloads.md) : Provides an architecture-level view of data file storage and downloading.
- [django-admin-logging.md](./django-admin-logging.md) : Outlines sections of the Django Administrator Console and details what should be logged.
- [jwt-key-rotation.md](./jwt-key-rotation.md) : Describes the process for rotating JWT keys in Login.gov.
- [nexus-repo.md](./nexus-repo.md) : Setup, connection information, and how to use our Nexus Artifact Repository
- [openid-connect.md](./openid-connect.md) : Provides an architecture-level view of the OpenID Connect prototocol.
- [rafts-accessibility-dos-and-donts.md](./rafts-accessibility-dos-and-donts.md) : A succint list of UX guidelines for frontend accessibility.
- [remote-development.md](./remote-development.md) : A guide on doing live remote development in Cloud.gov.
Expand Down
68 changes: 68 additions & 0 deletions docs/Technical-Documentation/nexus-repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Nexus Artifact Repository

We are using Nexus as an artifact store in order to retain docker images and other artifacts needed for our apps and pipelines.

Nexus UI can be accessed at [https://tdp-nexus.dev.raftlabs.tech/](https://tdp-nexus.dev.raftlabs.tech/)

## Nexus Image Management

### Host Information

The VM that runs the [Sonatype Nexus Image](https://help.sonatype.com/repomanager3/product-information/download) currently resides at 172.10.4.102 on Raft's internal network. You must first be connected to the labs.goraft.tech Raft Labs VPN before SSHing to the container. Current points of contact for getting setup with the VPN are Connor Meehan and Barak Stout.

### Nexus Container Setup

From our virtual machine, here is how to get Nexus up and running.
Pull and run nexus image:
```
docker pull sonatype/nexus3
docker volume create --name nexus-data
docker run -d -p 8081:8081 -p 8082:8082 -p 8083:8083 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
```

wait for nexus to be running
```
docker logs -f nexus
```

The first time you need to log in as root, you will need the auto-generated admin password that is created upon initialization of the container.
exec into the container and get docker admin.password:
```
docker exec -it nexus /bin/bash
cat /nexus-data/admin.password
```

After logging in as root for the first time, you will be taken to a page to set a new password.

## Hosted Docker Repository

### Setup

In order to use Nexus as a Docker repository, the DNS for the repo needs to be able to terminate https. We are currently using cloudflare to do this.

When creating the repository (must be signed in with admin privileges), since the nexus server isn't actually terminating the https, select the HTTP repository connector. The port can be anything you assign, as long as the tool used to terminate the https connection forwards the traffic to that port.

In order to allow [Docker client login and connections](https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/docker-registry/docker-authentication) you must set up the Docker Bearer Token Realm in Settings -> Security -> Realms -> and move the Docker Bearer Token Realm over to Active.
Also, any users will need nx-repository-view-docker-#{RepoName}-(browse && read) at a minimum and (add and edit) in order to push images.

We have a separate endpoint to connect specifically to the docker repository.
[https://tdp-docker.dev.raftlabs.tech](tdp-docker.dev.raftlabs.tech)

e.g. `docker login https://tdp-docker.dev.raftlabs.tech`

### Pushing Images

Before an image can be pushed to the nexus repository, it must be tagged for that repo:

`docker image tag ${ImageId} tdp-docker.dev.raftlabs.tech/${ImageName}:${Version}`

then you can push:

`docker push tdp-docker.dev.raftlabs.tech/${ImageName}:${Version}`

### Pulling Images

We have set up a proxy mirror to dockerhub that can pull and cache DockerHub images.
Then we have created a group docker repository that can be pulled from. If the container is in our hosted repo, the group will return that container. If not, it will see if we have a cached version of that container in our proxy repo and, if not, pull that from dockerhub, cache it and allow the docker pull to happen.

`docker pull https://tdp-docker-store.dev.raftlabs.tech/${ImageName}:${Version}`

0 comments on commit b614166

Please sign in to comment.