librelist archives

« back to archive

Fabrik: issue with authentication and uncompression

Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-01 @ 18:53
Hi,

I am having two issues with the basic example [1] of fabrik:

1) It does not seem to "cd" into the directory after uncompressing the
tarball on the server, namely after this command:

run('tar xzf /tmp/yourapplication.tar.gz')

How is supposed to succeed with the setup.py run afterwards? I am
getting a parent folder in the tarball with the procedure in the
example which the setup.py resides in.

2) When I add an explicit cd, I am getting a prompt for the password,
most probably for the server, but no matter what password, I am always
getting the prompt back, no matter if it is the correct or incorrect
password. I also tried to hard code the password in the fabrik file
similarly to the user name in the example, but I observe the same
behavior. How am I supposed to get it work?

Cheers,
Laszlo

Re: Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-01 @ 18:59
On Sun, Dec 1, 2013 at 6:53 PM, Laszlo Papp <lpapp@kde.org> wrote:
> Hi,
>
> I am having two issues with the basic example [1] of fabrik:
>
> 1) It does not seem to "cd" into the directory after uncompressing the
> tarball on the server, namely after this command:
>
> run('tar xzf /tmp/yourapplication.tar.gz')
>
> How is supposed to succeed with the setup.py run afterwards? I am
> getting a parent folder in the tarball with the procedure in the
> example which the setup.py resides in.
>
> 2) When I add an explicit cd, I am getting a prompt for the password,
> most probably for the server, but no matter what password, I am always
> getting the prompt back, no matter if it is the correct or incorrect
> password. I also tried to hard code the password in the fabrik file
> similarly to the user name in the example, but I observe the same
> behavior. How am I supposed to get it work?
>
> Cheers,
> Laszlo

[1] http://flask.pocoo.org/docs/patterns/fabric/#creating-the-first-fabfile

Re: [flask] Fabrik: issue with authentication and uncompression

From:
gioi
Date:
2013-12-01 @ 19:09
Il 01/12/2013 19:53, Laszlo Papp ha scritto:
> Hi,
>
> I am having two issues with the basic example [1] of fabrik:
>
> 1) It does not seem to "cd" into the directory after uncompressing the
> tarball on the server, namely after this command:
>
> run('tar xzf /tmp/yourapplication.tar.gz')
>
> How is supposed to succeed with the setup.py run afterwards? I am
> getting a parent folder in the tarball with the procedure in the
> example which the setup.py resides in.
Gimme some code ;-)
> 2) When I add an explicit cd, I am getting a prompt for the password,
> most probably for the server, but no matter what password, I am always
> getting the prompt back, no matter if it is the correct or incorrect
> password. I also tried to hard code the password in the fabrik file
> similarly to the user name in the example, but I observe the same
> behavior. How am I supposed to get it work?
SSH password, I suspect. Please triple check whether SSH is correctly
configured...

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-01 @ 19:16
On Sun, Dec 1, 2013 at 7:09 PM, gioi <g@gioi.tk> wrote:
> Il 01/12/2013 19:53, Laszlo Papp ha scritto:
>> Hi,
>>
>> I am having two issues with the basic example [1] of fabrik:
>>
>> 1) It does not seem to "cd" into the directory after uncompressing the
>> tarball on the server, namely after this command:
>>
>> run('tar xzf /tmp/yourapplication.tar.gz')
>>
>> How is supposed to succeed with the setup.py run afterwards? I am
>> getting a parent folder in the tarball with the procedure in the
>> example which the setup.py resides in.
> Gimme some code ;-)
>> 2) When I add an explicit cd, I am getting a prompt for the password,
>> most probably for the server, but no matter what password, I am always
>> getting the prompt back, no matter if it is the correct or incorrect
>> password. I also tried to hard code the password in the fabrik file
>> similarly to the user name in the example, but I observe the same
>> behavior. How am I supposed to get it work?
> SSH password, I suspect. Please triple check whether SSH is correctly
> configured...

I forgot to write that, it works fine if I do the procedure manually,
so it must be a fabrik issue either internal, or a configuration on my
side.

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 11:52
Ping?

On Sun, Dec 1, 2013 at 7:16 PM, Laszlo Papp <lpapp@kde.org> wrote:
> On Sun, Dec 1, 2013 at 7:09 PM, gioi <g@gioi.tk> wrote:
>> Il 01/12/2013 19:53, Laszlo Papp ha scritto:
>>> Hi,
>>>
>>> I am having two issues with the basic example [1] of fabrik:
>>>
>>> 1) It does not seem to "cd" into the directory after uncompressing the
>>> tarball on the server, namely after this command:
>>>
>>> run('tar xzf /tmp/yourapplication.tar.gz')
>>>
>>> How is supposed to succeed with the setup.py run afterwards? I am
>>> getting a parent folder in the tarball with the procedure in the
>>> example which the setup.py resides in.
>> Gimme some code ;-)
>>> 2) When I add an explicit cd, I am getting a prompt for the password,
>>> most probably for the server, but no matter what password, I am always
>>> getting the prompt back, no matter if it is the correct or incorrect
>>> password. I also tried to hard code the password in the fabrik file
>>> similarly to the user name in the example, but I observe the same
>>> behavior. How am I supposed to get it work?
>> SSH password, I suspect. Please triple check whether SSH is correctly
>> configured...
>
> I forgot to write that, it works fine if I do the procedure manually,
> so it must be a fabrik issue either internal, or a configuration on my
> side.

Re: [flask] Fabrik: issue with authentication and uncompression

From:
gioi
Date:
2013-12-04 @ 16:13
Il 04/12/2013 12:52, Laszlo Papp ha scritto:
> Ping?
>
> On Sun, Dec 1, 2013 at 7:16 PM, Laszlo Papp <lpapp@kde.org> wrote:
>> On Sun, Dec 1, 2013 at 7:09 PM, gioi <g@gioi.tk> wrote:
>>> Il 01/12/2013 19:53, Laszlo Papp ha scritto:
>>>> Hi,
>>>>
>>>> I am having two issues with the basic example [1] of fabrik:
>>>>
>>>> 1) It does not seem to "cd" into the directory after uncompressing the
>>>> tarball on the server, namely after this command:
>>>>
>>>> run('tar xzf /tmp/yourapplication.tar.gz')
>>>>
>>>> How is supposed to succeed with the setup.py run afterwards? I am
>>>> getting a parent folder in the tarball with the procedure in the
>>>> example which the setup.py resides in.
>>> Gimme some code ;-)
The fact that a password is asked makes me believe that something
between fabric and the server is broken. It could be a password to
decode SSH or host misconfiguration.
As I asked previously, the best way to help you would be to reproduce
your issue by my side, sharing the minimal code to debug.

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 17:05
On Wed, Dec 4, 2013 at 4:13 PM, gioi <g@gioi.tk> wrote:
> The fact that a password is asked makes me believe that something
> between fabric and the server is broken. It could be a password to
> decode SSH or host misconfiguration.

I wonder why it would work when I execute the commands manually as written.

> As I asked previously, the best way to help you would be to reproduce
> your issue by my side, sharing the minimal code to debug.

I have not seen this request yet, but here you can find the fabrik
file of mine. Anything suspicious?

Cheers,
Laszlo

from fabric.api import *

# the user to use for the remote commands
env.user = 'foo'
# the password to use for the remote commands
env.password = 'bar'
# the servers where the commands are executed
env.hosts = ['192.168.X.Y']

def pack():
    # create a new source distribution as tarball
    local('python setup.py sdist --formats=gztar', capture=False)

def deploy():
    # figure out the release name and version
    dist = local('python setup.py --fullname', capture=True).strip()
    # upload the source tarball to thfoo.tar.gz')
    # create a place where we can unzip the tarball, then enter
    # that directory and unzip it
    run('mkdir /tmp/foo')
    with cd('/tmp/foo'):
        run('tar xzf /tmp/foo.tar.gz')
        # now setup the package with our virtual environment's
        # python interpreter
        run('/var/www/foo/env/bin/python setup.py install')
    # now that all is set up, delete the folder again
    run('rm -rf /tmp/foo /tmp/foo.tar.gz')
    # and finally touch the .wsgi file so that mod_wsgi triggers
    # a reload of the application
    run('touch /var/www/foo/foo.wsgi')

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 17:18
I am also attaching now the setup.py code that resides beside the
fabrik python file:

{code}

from setuptools import setup

exec(open('foo/version.py').read())

setup(
    name='Foo',
    version=__version__,
    long_description=__doc__,
    author='Laszlo Papp',
    author_email='lpapp@foo.org',
    url = "http://stuff/Foo",
    packages=['foo'],
    include_package_data=True,
    zip_safe=False,
    install_requires=['Flask']
)

{/code}

and then I have the "foo" package beside these fabrik and setup.py
files with __init__.py, version.py, views.py, etc inside, but I do not
think it is relevant to the package, but let me know if you need those
nitty-gritty details, too.

Re: [flask] Fabrik: issue with authentication and uncompression

From:
gioi
Date:
2013-12-04 @ 17:33
Il 04/12/2013 18:05, Laszlo Papp ha scritto:
> I have not seen this request yet, but here you can find the fabrik
> file of mine. Anything suspicious?
Oh well - I asked "Gimme some code" but I should have been clearer.
I can't find the file upload code...

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 17:41
On Wed, Dec 4, 2013 at 5:33 PM, gioi <g@gioi.tk> wrote:
> Il 04/12/2013 18:05, Laszlo Papp ha scritto:
>> I have not seen this request yet, but here you can find the fabrik
>> file of mine. Anything suspicious?
> Oh well - I asked "Gimme some code" but I should have been clearer.
> I can't find the file upload code...

The file upload should be handled by fabrik, shouldn't it? I thought
that would be the main use case and hence job for it. :-)

I mean if I write my own script in python, I do not need fabrik.

Re: [flask] Fabrik: issue with authentication and uncompression

From:
gioi
Date:
2013-12-04 @ 18:37
Il 04/12/2013 18:41, Laszlo Papp ha scritto:
> The file upload should be handled by fabrik, shouldn't it? I thought
> that would be the main use case and hence job for it. :-)
Oh well - You need to call a function to have it uploaded.
Like this:

def deploy():
    # figure out the release name and version
    dist = local('python setup.py --fullname', capture=True).strip()
    local('python setup.py sdist --formats=gztar', capture=False)
    put('foo.tar.gz', '/tmp/foo/foo.tar.gz')

Re: [flask] Fabrik: issue with authentication and uncompression

From:
gioi
Date:
2013-12-04 @ 18:39
Il 04/12/2013 19:37, gioi ha scritto:
>     put('foo.tar.gz', '/tmp/foo/foo.tar.gz')
http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.put

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 18:45
I have sent this before:

{code}

from fabric.api import *

# the user to use for the remote commands
env.user = 'foo'
# the password to use for the remote commands
env.password = 'bar'
# the servers where the commands are executed
env.hosts = ['192.168.X.Y']

def pack():
    # create a new source distribution as tarball
    local('python setup.py sdist --formats=gztar', capture=False)

def deploy():
    # figure out the release name and version
    dist = local('python setup.py --fullname', capture=True).strip()
    # upload the source tarball to thfoo.tar.gz')
    # create a place where we can unzip the tarball, then enter
    # that directory and unzip it
    run('mkdir /tmp/foo')
    with cd('/tmp/foo'):
        run('tar xzf /tmp/foo.tar.gz')
        # now setup the package with our virtual environment's
        # python interpreter
        run('/var/www/foo/env/bin/python setup.py install')
    # now that all is set up, delete the folder again
    run('rm -rf /tmp/foo /tmp/foo.tar.gz')
    # and finally touch the .wsgi file so that mod_wsgi triggers
    # a reload of the application
    run('touch /var/www/foo/foo.wsgi')

{/code}

This was included at the end of my email, i.e. after the "Cheers,
Laszlo" part. You skipped that? Anyway, anything wrong with this?

On Wed, Dec 4, 2013 at 6:39 PM, gioi <g@gioi.tk> wrote:
> Il 04/12/2013 19:37, gioi ha scritto:
>>     put('foo.tar.gz', '/tmp/foo/foo.tar.gz')
> http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.put
>
>

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-04 @ 18:56
Sorry, it is my mistake about pasting. I do not know what happened but
this is my code:

{code}

def deploy():
    # figure out the release name and version
    dist = local('python setup.py --fullname', capture=True).strip()
    # upload the source tarball to the temporary folder on the server
    put('dist/%s.tar.gz' % dist, '/tmp/configbuilder.tar.gz')
    # create a place where we can unzip the tarball, then enter
    # that directory and unzip it
    run('mkdir /tmp/configbuilder')
    with cd('/tmp/configbuilder'):
        run('tar xzf /tmp/configbuilder.tar.gz')
        # now setup the package with our virtual environment's
        # python interpreter
        run('/var/www/configbuilder/env/bin/python setup.py install')
    # now that all is set up, delete the folder again
    run('rm -rf /tmp/configbuilder /tmp/configbuilder.tar.gz')
    # and finally touch the .wsgi file so that mod_wsgi triggers
    # a reload of the application
    run('touch /var/www/configbuilder/configbuilder.wsgi')

{/code}

On Wed, Dec 4, 2013 at 6:45 PM, Laszlo Papp <lpapp@kde.org> wrote:
> I have sent this before:
>
> {code}
>
> from fabric.api import *
>
> # the user to use for the remote commands
> env.user = 'foo'
> # the password to use for the remote commands
> env.password = 'bar'
> # the servers where the commands are executed
> env.hosts = ['192.168.X.Y']
>
> def pack():
>     # create a new source distribution as tarball
>     local('python setup.py sdist --formats=gztar', capture=False)
>
> def deploy():
>     # figure out the release name and version
>     dist = local('python setup.py --fullname', capture=True).strip()
>     # upload the source tarball to thfoo.tar.gz')
>     # create a place where we can unzip the tarball, then enter
>     # that directory and unzip it
>     run('mkdir /tmp/foo')
>     with cd('/tmp/foo'):
>         run('tar xzf /tmp/foo.tar.gz')
>         # now setup the package with our virtual environment's
>         # python interpreter
>         run('/var/www/foo/env/bin/python setup.py install')
>     # now that all is set up, delete the folder again
>     run('rm -rf /tmp/foo /tmp/foo.tar.gz')
>     # and finally touch the .wsgi file so that mod_wsgi triggers
>     # a reload of the application
>     run('touch /var/www/foo/foo.wsgi')
>
> {/code}
>
> This was included at the end of my email, i.e. after the "Cheers,
> Laszlo" part. You skipped that? Anyway, anything wrong with this?
>
> On Wed, Dec 4, 2013 at 6:39 PM, gioi <g@gioi.tk> wrote:
>> Il 04/12/2013 19:37, gioi ha scritto:
>>>     put('foo.tar.gz', '/tmp/foo/foo.tar.gz')
>> http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.put
>>
>>

Re: [flask] Fabrik: issue with authentication and uncompression

From:
Laszlo Papp
Date:
2013-12-11 @ 13:52
This has now been fixed. The issue is caused by Ubuntu 10.04's
lsh-server rather than openssh-server. I had to use --no-keys (-k) and
--no-pty for the lsh daemon. Also, I had to set up sftp, but in the
end, it was simpler to switch to openssh-server where it just works.
:)

Thanks for the responses though!

On Wed, Dec 4, 2013 at 6:56 PM, Laszlo Papp <lpapp@kde.org> wrote:
> Sorry, it is my mistake about pasting. I do not know what happened but
> this is my code:
>
> {code}
>
> def deploy():
>     # figure out the release name and version
>     dist = local('python setup.py --fullname', capture=True).strip()
>     # upload the source tarball to the temporary folder on the server
>     put('dist/%s.tar.gz' % dist, '/tmp/configbuilder.tar.gz')
>     # create a place where we can unzip the tarball, then enter
>     # that directory and unzip it
>     run('mkdir /tmp/configbuilder')
>     with cd('/tmp/configbuilder'):
>         run('tar xzf /tmp/configbuilder.tar.gz')
>         # now setup the package with our virtual environment's
>         # python interpreter
>         run('/var/www/configbuilder/env/bin/python setup.py install')
>     # now that all is set up, delete the folder again
>     run('rm -rf /tmp/configbuilder /tmp/configbuilder.tar.gz')
>     # and finally touch the .wsgi file so that mod_wsgi triggers
>     # a reload of the application
>     run('touch /var/www/configbuilder/configbuilder.wsgi')
>
> {/code}
>
> On Wed, Dec 4, 2013 at 6:45 PM, Laszlo Papp <lpapp@kde.org> wrote:
>> I have sent this before:
>>
>> {code}
>>
>> from fabric.api import *
>>
>> # the user to use for the remote commands
>> env.user = 'foo'
>> # the password to use for the remote commands
>> env.password = 'bar'
>> # the servers where the commands are executed
>> env.hosts = ['192.168.X.Y']
>>
>> def pack():
>>     # create a new source distribution as tarball
>>     local('python setup.py sdist --formats=gztar', capture=False)
>>
>> def deploy():
>>     # figure out the release name and version
>>     dist = local('python setup.py --fullname', capture=True).strip()
>>     # upload the source tarball to thfoo.tar.gz')
>>     # create a place where we can unzip the tarball, then enter
>>     # that directory and unzip it
>>     run('mkdir /tmp/foo')
>>     with cd('/tmp/foo'):
>>         run('tar xzf /tmp/foo.tar.gz')
>>         # now setup the package with our virtual environment's
>>         # python interpreter
>>         run('/var/www/foo/env/bin/python setup.py install')
>>     # now that all is set up, delete the folder again
>>     run('rm -rf /tmp/foo /tmp/foo.tar.gz')
>>     # and finally touch the .wsgi file so that mod_wsgi triggers
>>     # a reload of the application
>>     run('touch /var/www/foo/foo.wsgi')
>>
>> {/code}
>>
>> This was included at the end of my email, i.e. after the "Cheers,
>> Laszlo" part. You skipped that? Anyway, anything wrong with this?
>>
>> On Wed, Dec 4, 2013 at 6:39 PM, gioi <g@gioi.tk> wrote:
>>> Il 04/12/2013 19:37, gioi ha scritto:
>>>>     put('foo.tar.gz', '/tmp/foo/foo.tar.gz')
>>> http://docs.fabfile.org/en/1.8/api/core/operations.html#fabric.operations.put
>>>
>>>