These are chat archives for shipitjs/shipit

7th
Jul 2015
Tim Kelty
@timkelty
Jul 07 2015 13:01
hmmm...
any luck @w0w?
Can you post your shipit config?
Naveen Singh
@w0w
Jul 07 2015 14:26
yes
module.exports = function (shipit) {
  require('shipit-deploy')(shipit);
  require('shipit-npm')(shipit);
  var fs = require('fs');

  var secret = JSON.parse(fs.readFileSync('secret.json', 'utf8'));

  shipit.initConfig({
    default: {
      workspace: 'deploy',
      repositoryUrl: '',
      ignores: ['.git'],
      keepReleases: 2,
      deleteOnRollback: false,
      shallowClone: true,
      npm: {
        remote: true
        //install npm packages on the server
      }
    },
    staging: {
      servers: secret.staging.host,
      deployTo: '/var/server/',
      branch: 'dev'
    }
  });

  shipit.on('deploy:publish', function () {
    return shipit.remote('pm2 restart server');
    shipit.emit('Restarted server');
  });
};
@timkelty no luck yet
Tim Kelty
@timkelty
Jul 07 2015 14:29
`
that part looks funny...
Naveen Singh
@w0w
Jul 07 2015 14:29
which part?
Tim Kelty
@timkelty
Jul 07 2015 14:29
ec2-54-85-105-137.compute-1.amazonaws.com,54.85.105.137
could it be that secret.staging.host is returning a comma separated string, and not an array?
or is that what the server should look like (with the comma)
Naveen Singh
@w0w
Jul 07 2015 14:31
i guess it is what server should look like
because
in my secret file i only have
{
    "staging": {
        "host": "ec2-54-85-105-137.compute-1.amazonaws.com",
        "username": "ec2-user",
        "port": "22"
    },
    "production": {
        "host": "production-host",
        "username": "",
        "password": "",
        "port": "22"
    }
}
the public dns
Tim Kelty
@timkelty
Jul 07 2015 14:33
and you've done ssh-copy-id ec2-user@ec2-54-85-105-137.compute-1.amazonaws.com
or something similar?
Naveen Singh
@w0w
Jul 07 2015 14:34
yes, i can ssh via terminal to my instance
and have my ssh key in authorized_keys
on the instance
Tim Kelty
@timkelty
Jul 07 2015 14:34
and it doesn't ask you for pw...
right?
Naveen Singh
@w0w
Jul 07 2015 14:34
yes
Tim Kelty
@timkelty
Jul 07 2015 14:35
hmmm
Naveen Singh
@w0w
Jul 07 2015 14:35
it does not ask for password
how can i debug the ssh command
Tim Kelty
@timkelty
Jul 07 2015 14:35
try ssh-copy-id ec2-user@ec2-54-85-105-137.compute-1.amazonaws.com,54.85.105.137
Naveen Singh
@w0w
Jul 07 2015 14:36
ERROR: ssh: Could not resolve hostname ec2-54-85-105-137.compute-1.amazonaws.com,54.85.105.137: nodename nor servname provided, or not known
Tim Kelty
@timkelty
Jul 07 2015 14:36
just wondering where that ,54.85.105.137 is coming from
Naveen Singh
@w0w
Jul 07 2015 14:38
i think it is the ip of the server
i dont think
it is the ip of the server
for sure
Tim Kelty
@timkelty
Jul 07 2015 14:38
can you ssh into the ip directly?
w/o password?
Naveen Singh
@w0w
Jul 07 2015 14:42
yes
Naveen Singh
@w0w
Jul 07 2015 14:53
if i could output the debug log of ssh that might help
instead of ssh xyz@abc.com
i want to do ssh -v xyz@abc.com
@timkelty can you point me to the part of code where i can modify ssh commnads
thanks
chriscdg
@chriscdg
Jul 07 2015 15:29
Hey can anyone help me debug a permissions problem I'm having? When I deploy with shipit deploy production, it does everything correctly, except the files that it copies to the server with git are owned by user 501 instead of root, who should be logged into the server
I guess it's an ownership issue, not so much permissions
I've googled and I know how to reset the owner, but obviously it would be better to just have the owner be set correctly in the deploy process
Naveen Singh
@w0w
Jul 07 2015 17:07
@timkelty thank you
chriscdg
@chriscdg
Jul 07 2015 17:40
I was on my phone earlier... anyone have any ideas on the 501 owner id? I don't see how others wouldn't run into this issue, so I'm sure it's something with my setup, but haven't been able to figure out what
chriscdg
@chriscdg
Jul 07 2015 17:54
@neoziro any chance you could help me debug an ownership error with shipit-deploy? I would super appreciate it!
Naveen Singh
@w0w
Jul 07 2015 17:58
@chriscdg can you share your shipit config file
chriscdg
@chriscdg
Jul 07 2015 17:59
yes, one sec

'''
module.exports = function (shipit) {
require('shipit-deploy')(shipit);

shipit.initConfig({
default: {
workspace: '/tmp/github-monitor',
deployTo: '/var/www/legends',
repositoryUrl: 'https://github.com/chriscdg/pro.git',
ignores: ['.git', 'node_modules'],
rsync: ['--del'],
keepReleases: 2,
key: '~/.ssh/',
shallowClone: true
},
production: {
servers:'root@104.207.158.226'
}
});

shipit.on("published", function () {
shipit.remote("cd /var/www/legends/current && npm install --production");
})
};
'''

hmm
did the markdown wrong
sorry about that
@w0w thanks for responding :)
chriscdg
@chriscdg
Jul 07 2015 18:05
module.exports = function (shipit) {
  require('shipit-deploy')(shipit);

  shipit.initConfig({
    default: {
      workspace: '/tmp/github-monitor',
      deployTo: '/var/www/legends',
      repositoryUrl: 'https://github.com/chriscdg/pro.git',
      ignores: ['.git', 'node_modules'],
      rsync: ['--del'],
      keepReleases: 2,
      key: '~/.ssh/'
      shallowClone: true
    },
    production: {
      servers:'root@104.207.158.227'
    }
  });

  shipit.on("published", function () {
    shipit.remote("cd /var/www/legends/current && npm install --production");
  })
};
oops, there is a comma between key and shallowclone
otherwise this thing wouldn't run...
trying to do 10 things at once
i dont know if i understand your issue correctly
chriscdg
@chriscdg
Jul 07 2015 18:08
so everything works as normal
except when I look inside of var/www/legends/current
Naveen Singh
@w0w
Jul 07 2015 18:08
basically root user does not have permission to create/delete directories in your deploy path ?
chriscdg
@chriscdg
Jul 07 2015 18:09
most of the files inside current or /releases/ are somehow owned by 501 instead of root
-rw-r--r-- 1 501 root 13576 Jul 7 18:07 npm-shrinkwrap.json
-rw-r--r-- 1 501 root 777 Jul 7 18:07 package.json
-rw-r--r-- 1 501 root 1037 Jul 7 18:07 app.js
only the REVISION and node_modules are owned by root
everything else is owned by 501
inside of current
I thought it had something to do with my ssh key, but I don't know why this would be working at all if the ssh key wasn't...
though the command does run even without keys
so maybe that is it?
chriscdg
@chriscdg
Jul 07 2015 18:21
I do get one error in deploy:
Copy "/tmp/github-monitor/" to "root@104.207.158.227:/var/www/legends/releases/20150707182016" via rsync
@104.207.158.227-err Warning: Identity file ~/.ssh not accessible: No such file or directory.
Finished copy.
Naveen Singh
@w0w
Jul 07 2015 18:22
I am very confused
@chriscdg
chriscdg
@chriscdg
Jul 07 2015 18:23
I'm very confused too :(
so I'm running shipit production deploy
which does all the right things as far as I can tell, copying the repo onto the server in the right location
but the files are for some reason owned by "501" instead of "root" which is the user I specified in the shipitfile.js
I don't know why
is that what you're confused about too, or is there something else I can clarify?
chriscdg
@chriscdg
Jul 07 2015 19:05
does that sound plausible?
@w0w this might be an rsync thing, I don't have a "root" user on my local machine, so when it copies the files over, it's copying from my local user (chris)
I didn't make a special deploy user locally, not sure if I was supposed to...
I didn't make a special user locally or remote
thing is I don't know how someone else wouldn't have run into this issue before if I'm right
Naveen Singh
@w0w
Jul 07 2015 19:10
@chriscdg i dont think its ownder by 501
chriscdg
@chriscdg
Jul 07 2015 19:10
oh am I reading it wrong?
[root@vultr ~]# ls -al /var/www//legends/current/
total 64
drwxr-xr-x 6  501 root  4096 Jul  7 18:55 .
drwxr-xr-x 3 root root  4096 Jul  7 18:55 ..
-rw-r--r-- 1  501 root   581 Jul  7 18:55 .gitignore
-rw-r--r-- 1  501 root  2907 Jul  7 18:55 gulpfile.js
drwxr-xr-x 6 root root  4096 Jul  7 18:55 node_modules
-rw-r--r-- 1  501 root 13576 Jul  7 18:55 npm-shrinkwrap.json
-rw-r--r-- 1  501 root   777 Jul  7 18:55 package.json
-rw-r--r-- 1  501 root  1037 Jul  7 18:55 app.js
drwxr-xr-x 4  501 root  4096 Jul  7 18:55 public
-rw-r--r-- 1  501 root    19 Jul  7 18:55 README.md
-rw-r--r-- 1 root root    41 Jul  7 18:55 REVISION
drwxr-xr-x 4  501 root  4096 Jul  7 18:55 src
drwxr-xr-x 2  501 root  4096 Jul  7 18:55 views
Naveen Singh
@w0w
Jul 07 2015 19:16
my bad
no its owned by 501
can you paste full output of shipit production deploy
chriscdg
@chriscdg
Jul 07 2015 19:18
I'm more of a front-end guy, this server stuff is newer for me
yep, sec
it's a little long
so here's a gist...
I'm honestly not sure if I'm doing half of this right, I got another server working manually with some webhooks and bash scripts
but obviously shipit has advantages over all that
Naveen Singh
@w0w
Jul 07 2015 19:26
by this error log
the deployment gets complete
a wild guess though
chriscdg
@chriscdg
Jul 07 2015 19:27
yeah it looks like everything does what it should
except this owner thing
Naveen Singh
@w0w
Jul 07 2015 19:28
sudo chown root:root -R /var/www/legends
chriscdg
@chriscdg
Jul 07 2015 19:31
that fixes it, but obviously every time I deploy, it gets set to 501 again
I thought it was a little hacky to put that into a task
or event listener
I'm just confused how no one else has run into this issue
should I need to setup a user locally that matches the one on the server?
oh interesting
if I run "sudo shipit production deploy"
it does the right thing
Naveen Singh
@w0w
Jul 07 2015 19:35
:clap:
chriscdg
@chriscdg
Jul 07 2015 19:35
maybe it's just the fact that I'm using root on the server
Naveen Singh
@w0w
Jul 07 2015 19:36
I have no idea
chriscdg
@chriscdg
Jul 07 2015 19:36
:)
well at least I have a way to make it work that's not super hacky
@wow thanks for your help!
@w0w thanks for your help! *
Naveen Singh
@w0w
Jul 07 2015 19:37
:+1: