1.0.1 • Published 9 months ago

server-control v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 months ago

server-control

  • create AMI with supervisor, git and node
  • create user node with home in /var/node
  • add an ssh pull only key to the node user in /var/node/.ssh/id_rsa
  • clone your project

sample config to add to your app:

sc.init(app, {
	prefix: '/',
    repo_url: 'git@github.com:user/project.git',
    repo_dir: '/var/node/project',
    service_port: port,
    secret: "update-secret"
});
  • npm install jim-lake/server-control --save
  • cp node_modules/server-control/git_update_to_hash.sh /var/node/project/git_update_to_hash.sh
  • chmod +x git_update_to_hash.sh
  • cp node_modules/server-control/api_update.sh /var/lib/cloud/scripts/per-instance/api_update.sh
  • chmod +x /var/lib/cloud/scripts/per-instance/api_update.sh

  • create an Autoscale group with that AMI.

  • pass the project dir and git HASH in your user datain the user-data:
PROJECT_DIR=/var/node/project
API_GIT_HASH=6c3xxx12348e2e97560e0081d3bf44bdbfb8ifn3
  • assign an IAM role with the following configuration:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1412101976000",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "Stmt1412101976001",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeLaunchTemplateVersions",
        "ec2:ModifyLaunchTemplate",
        "ec2:CreateLaunchTemplateVersion"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "Stmt1412102095000",
      "Effect": "Allow",
      "Action": [
        "autoscaling:DescribeAutoScalingGroups"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}
  • If your config has a role, you'll also need to add passrole
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": "arn:aws:iam::<account>:role/<role>"
        }
    ]
}
  • launch!
1.0.1

9 months ago

1.0.0

9 months ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.15

5 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

9 years ago

0.0.4

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago