1

是否可以在 Elasticbean Stalk 实例的微型实例上安装 Sonatype Nexus?谁能指出我该怎么做?

4

2 回答 2

1

您可以使用 beanstalk docker stack 并将卷动态附加到它。

Dockerrun.aws.json :

{
    "AWSEBDockerrunVersion": "1",
    "Image": {
      "Name": "sonatype/nexus3:3.21.1",
      "Update": "true"
    },
    "Ports": [
      {
        "ContainerPort": "8081"
      },
      {
        "ContainerPort": 8082,
        "HostPort": 8082
      },
      {
        "ContainerPort": 8083,
        "HostPort": 8083
      }        

    ],
    "Volumes": [
      {
        "HostDirectory": "/media/ebs_volume/nexus-data",
        "ContainerDirectory": "/nexus-data"
      }
    ]
  }

.ebextensions/00_volume.config :

commands:
  01-attach-volume:
    command: aws ec2 attach-volume --region eu-west-1 --volume-id vol-xxxxxxxxxxxxx --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --device /dev/sdh
    ignoreErrors: true
  02-wait:
    command: sleep 30
  03-attach-volume:
    command: |
      aws ec2 modify-instance-attribute --region eu-west-1 --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --block-device-mappings "[{\"DeviceName\": \"/dev/sdh\",\"Ebs\":{\"DeleteOnTermination\":false}}]"
    ignoreErrors: true
  04-mount-volume:
    command: |
      mkdir -p /media/ebs_volume
      mount /dev/sdh /media/ebs_volume
      service docker restart
    test: sh -c "! grep -qs '/media/ebs_volume' /proc/mounts"
  05-create-data-folder:
    command: |
      mkdir -p /media/ebs_volume/nexus-data && chown -R 200:200 /media/ebs_volume/nexus-data  
    ignoreErrors: true

您可能需要调整 nginx 配置(用于上传)

.ebextensions/01_nginx_custom.config :

files:
  "/etc/nginx/conf.d/proxy.conf":
    mode: "000755"
    group: root
    group: root
    content: |
      client_max_body_size 512M;
于 2020-12-25T19:17:52.747 回答
0

Sonatype Nexus 不能部署在 servlet 容器或替代应用服务器 [ 1 ] 中。

所以你必须用 Sonatype Nexus 应用服务器替换默认的 tomcat 服务器。我认为您可以尝试使用自定义弹性 beanstalk AMI来完成它。

于 2013-10-12T10:32:54.337 回答