docker 部署 nexus

docker 安装 nexus

#!/bin/bash

docker run -d --user root -p 8081:8081 -v /opt/nexus-data:/nexus-data --name nexus3 sonatype/nexus3:latest

数据目录映射到主机的 /opt/nexus-data,容器的/nexus-data

配置签名

本来不知道有这步的,但是偶然点进了system status界面,看到一个红叉和Nexus was not configured with an encryption key and is using the Default key.

签名配置是一个json文件,默认没有生成(起码我没找到),格式如下

{
  "active": "key-id",
  "keys": [
    {
      "id": "key-id",
      "key": "base64 key"
    }
  ]
}

这个key可以通过 openssl rand -base64 16 生成

有两种方式指定配置文件路径,一种是使用环境变量,另一种是nexus配置文件(/opt/nexus-data/etc/nexus.properties),我使用的是nexus配置文件,在配置文件添加一行

nexus.secrets.file=/nexus-data/secrets.json

关闭central

因为我的nexus搭建在家里云,本身上行带宽就不高,不希望跑太多流量

取消勾选 repository > centralonline

安全

禁用admin用户

因为admin用户名是默认的管理员账号,所以禁用之,然后创建子管理用户,给管理角色,并保存

创建ci用户并分配权限

准备后续使用ci推送构件到nexus,所以专门分配一个ci用户

给了如下权限

  • nx-repository-view-maven2-maven-central-add
  • nx-repository-view-maven2-maven-central-browse
  • nx-repository-view-maven2-maven-central-edit
  • nx-repository-view-maven2-maven-central-read
  • nx-repository-view-maven2-maven-public-add
  • nx-repository-view-maven2-maven-public-browse
  • nx-repository-view-maven2-maven-public-edit
  • nx-repository-view-maven2-maven-public-read
  • nx-repository-view-maven2-maven-releases-add
  • nx-repository-view-maven2-maven-releases-browse
  • nx-repository-view-maven2-maven-releases-edit
  • nx-repository-view-maven2-maven-releases-read
  • nx-repository-view-maven2-maven-snapshots-add
  • nx-repository-view-maven2-maven-snapshots-browse
  • nx-repository-view-maven2-maven-snapshots-edit
  • nx-repository-view-maven2-maven-snapshots-read

尝试推送

招了一个gradle项目,配置publish

publishing {
    repositories {
        maven {
            name = "snapshot"
            url = uri("http://localhost:8081/repository/maven-snapshots/")
            isAllowInsecureProtocol = true
            credentials {
                username = "homo"
                password = "114514"
            }
        }
    }
}

注意此处推送的是snapshot,需要在项目version后添加后缀-SNAPSHOT,否则推送响应400

总结

还没有使用所以没有总结(咕咕咕

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇