Skip to content

Commit

Permalink
Merge pull request #29 from Diesel-Net/development
Browse files Browse the repository at this point in the history
Update nexus and experimenting with different nfs settings
  • Loading branch information
tomdaley92 authored Jun 7, 2023
2 parents 4712c88 + e5ab004 commit bf421e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .ansible/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'
services:

main:
image: sonatype/nexus3:3.42.0
image: sonatype/nexus3:3.55.0
volumes:
- /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt
{% if nfs_host is defined %}
Expand Down Expand Up @@ -31,7 +31,7 @@ volumes:
driver: local
driver_opts:
type: nfs
o: addr={{ nfs_host }},soft,nolock,rw,nfsvers=4,async
o: addr={{ nfs_host }},rw,nfsvers=4,async
device: :{{ nfs_path }}
{% endif %}

Expand Down
48 changes: 0 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,3 @@

# nexus
[SonaType Nexus Repository Manager 3](https://help.sonatype.com/repomanager3) on docker swarm.


## Notes on the REST API

### Authentication
The API permits `Basic-Auth` so we just need to include the Authorization header with value `Basic username:password` where the part `username:password` is base64 encoded on every request.

e.g. `Authorization: Basic YWRtaW46bmV4dXM=`


The `-u` flag can be used with `curl` to auto-encode the correct Basic-Auth headers for you. This is a great way to play around with the API and get familiar. The command below illustrates how to change the admin password programatically (usually prompted on the first login through the WebUI).

```bash
curl -u admin:nexus3 'https://nexus.dev.diesel.net/service/rest/v1/security/users/admin/change-password' \
-X 'PUT' \
-H 'content-type: text/plain' \
--data-raw 'newpass' \
--compressed \
--insecure \
-v
```

### Creating Repositories
Below is an example of how to create a `hosted apt` repository.

```bash
curl -u admin:nexus3 'https://nexus.dev.diesel.net/service/rest/v1/repositories/apt/hosted' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data-raw $'{\n "name": "internal-apt",\n "online": true,\n "storage": {\n "blobStoreName": "default",\n "strictContentTypeValidation": true,\n "writePolicy": "allow_once"\n },\n "cleanup": {\n "policyNames": [\n "string"\n ]\n },\n "component": {\n "proprietaryComponents": true\n },\n "apt": {\n "distribution": "bionic"\n },\n "aptSigning": {\n "keypair": "string",\n "passphrase": "string"\n }\n}' \
--compressed \
--insecure \
-v
```

### Cleanup Policies
`Cleanup Policies` CRUD operations seem to be missing from the Open API specification at the time of this writing. Maybe I missed it or they are adding it in a future release? Anywho, I was able to reverse ingineer the API calls from chrome dev tools and it is working with basic auth, per usual. Just note the slightly different path.


```bash
curl -u admin:nexus3 'https://nexus.dev.diesel.net/service/rest/internal/cleanup-policies' \
-H 'accept: application/json, text/plain, */*' \
-H 'content-type: application/json;charset=UTF-8' \
--data-raw '{"name":"cleanupRoutine","notes":"Remove docker images older than 90 days","format":"docker","criteriaLastBlobUpdated":"90"}' \
--compressed \
--insecure \
-v
```

0 comments on commit bf421e9

Please sign in to comment.