【问题标题】:Deploying EmberJS to AWS using SSH + RSync使用 SSH + RSync 将 EmberJS 部署到 AWS
【发布时间】:2016-07-08 00:01:30
【问题描述】:

我已经成功地使用这个站点将一个简单的 todo 应用程序部署到了带有 S3 的 AWS http://emberigniter.com/deploy-ember-cli-app-amazon-s3-linux-ssh-rsync/

但是,当我尝试按照教程执行此操作(使用 SSH 和 Rsync 部署)时,我遇到了以下错误:

  • 压缩**/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf,woff,woff2}
  • 忽略null
  • ✔ 资产/ember-user-app-d41d8cd98f00b204e9800998ecf8427e.css
  • ✔ 资产/供应商-d41d8cd98f00b204e9800998ecf8427e.css
  • ✔ 资产/ember-user-app-45a9825ab0116a8007bb48645b09f060.js
  • ✔ crossdomain.xml
  • ✔ robots.txt
  • ✔ assets/vendor-d008595752c8e859a04200ceb9a77874.js
  • gzip 6 个文件正常 | +- 上传 | | | +- rsync

- 使用 rsync 上传...

- 权限被拒绝(publickey、gssapi-keyex、gssapi-with-mic)。

rsync:连接意外关闭(到目前为止已收到 0 个字节)[sender]

rsync 错误:/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6. 9]

以下是我的 config/deploy.js

module.exports = function(deployTarget) {
    var ENV = {
        build: {
        environment: deployTarget
    },

    's3-index': {
        accessKeyId: "<myKeyID>",
        secretAccessKey: "<mySecret>",
        bucket: "emberjsft",
        region: "ap-southeast-1",
        allowOverwrite: true
    },
    's3': {
        accessKeyId: "<myKeyID>",
        secretAccessKey: "<mySecret>",
        bucket: "emberjsft",
        region: "ap-southeast-1"
    },

    'ssh-index': {
        remoteDir: "/var/www/",
        username: "ec2-user",
        host: "ec2-<elastic-ip>.ap-southeast-1.compute.amazonaws.com",
        privateKeyFile: "/Users/imac/MY_AWS_PEMFILE.pem", 
        allowOverwrite: true
    },
    rsync: {
        dest: "/var/www/",
        username: "ec2-user",
        host: "ec2-<elastic-ip>.ap-southeast-1.compute.amazonaws.com",
        delete: false
    }
    // include other plugin configuration that applies to all deploy targets here
    };

    if (deployTarget === 'development') {
        ENV.build.environment = 'development';
    // configure other plugins for development deploy target here
    }

    if (deployTarget === 'staging') {
        ENV.build.environment = 'production';
    // configure other plugins for staging deploy target here
    }

    if (deployTarget === 'production') {
        ENV.build.environment = 'production';
    // configure other plugins for production deploy target here
    }

    // Note: if you need to build some configuration asynchronously, you can return
    // a promise that resolves with the ENV object instead of returning the
    // ENV object synchronously.
    return ENV;
};

我应该如何解决这个问题?

谢谢

【问题讨论】:

    标签: ember.js amazon-s3 amazon-ec2 ember-cli


    【解决方案1】:

    我刚刚花了最后一个小时来解决与您相同的问题。我能够某种通过使用ssh-add /home/user/.ssh/example-key.pem 并删除privateKeyFile 来修复它。

    传输结束后我仍然收到错误消息,但可以确认所有文件已成功传输到我的 EC2 盒子,尽管出现错误..

    deploy.js

    module.exports = function (deployTarget) {
    
      var ENV = {
        build: {
          environment: deployTarget
        },
        'ssh-index': {
          remoteDir: "/var/www/",
          username: "ubuntu",
          host: "52.xx.xx.xx",
          allowOverwrite: true
        },
        rsync: {
          host: "ubuntu@52.xx.xx.xx",
          dest: "/var/www/",
          recursive: true,
          delete: true
        }
      };
    
      return ENV;
    
    };
    

    【讨论】:

    • 太棒了,试试这个,我会赞成它,因为它看起来完全可行和合理
    【解决方案2】:

    在您的 deploy.js 文件中,您需要放置 accessKeyId 的信息。您在 accessKeyId 的位置留下了“”。你需要把你的信息放在那里。 secretAccessKey、accessKeyId 和你的 host 也是一样,你需要输入你的 elastic-ip 地址。

    【讨论】:

    • 在真实文件中,我已经包含了实际必要的信息,只是在这里,我省略了放入真实数据。
    【解决方案3】:

    myKeyIDmySecret 应存在于 .env 文件中,然后由 process.env.myKeyIDprocess.env.mySecret 在此处访问

    deploy.js 文件中硬编码密钥不是一个好习惯。 最佳实践将使用Consul 阅读它

    【讨论】:

    • 抱歉,我看不出将其放入外部文件如何有助于解决目前比说可维护性更重要的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    相关资源
    最近更新 更多