使用SSH + RSync将EmberJS部署到AWS

时间:2016-07-08 00:01:30

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

我设法使用此网站将一个简单的todo应用程序部署到AWS的S3 http://emberigniter.com/deploy-ember-cli-app-amazon-s3-linux-ssh-rsync/

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

  • gzipping **/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf,woff,woff2}
  • 忽略null
  • ✔resassets / ember-user-app-d41d8cd98f00b204e9800998ecf8427e.css
  • ✔resassets / vendor-d41d8cd98f00b204e9800998ecf8427e.css
  • ✔resassets / ember-user-app-45a9825ab0116a8007bb48645b09f060.js
  • ✔rossdomain.xml
  • ✔robots.txt
  • ✔resassets / vendor-d008595752c8e859a04200ceb9a77874.js
  • gzipped 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。]无法解释的错误(代码255)。 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;
};

我该如何解决这个问题?

由于

3 个答案:

答案 0 :(得分: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;

};

答案 1 :(得分:-1)

在deploy.js文件中,您需要为accessKeyId提供信息。你离开了&#34;&#34;在accessKeyId的位置。你需要把你的信息放在那里。对于secretAccessKey,acessKeyId和你的主机,你需要输入你的弹性IP地址。

答案 2 :(得分:-2)

myKeyIDmySecret应出现在.env文件中,然后由process.env.myKeyIDprocess.env.mySecret

在此处进行访问

deploy.js文件中的密钥进行硬编码不是一个好习惯。 最佳做法是使用Consul

阅读
相关问题