def install():
    packages([
        'build-essential',
        'php5',
        'php5-mysql',
    ], update=False)

    mysql(password="******")

    apache()
    stopped('apache2')
    site_disabled('default')
    site(
        'mylampvm.dev',
        template_source=full_path + '/templates/apache2/vhost.tpl',
        port=80,
        server_name='mylampvm.dev',
        document_root='/srv',
    )

    template_file(
        template_source = full_path + '/templates/apache2/envvars.tpl',
        path='/etc/apache2/envvars',
        context = {
            'apache_run_user': '******',
            'apache_run_group': 'vagrant',
        },
        owner = 'root',
        group = 'root',
        use_sudo=True
    )
    directory('/var/lock/apache2', True, 'vagrant', 'vagrant')
    
    # site_enabled('mylampvm.dev')
    restarted('apache2')
Exemple #2
0
def install():
    packages([
        'build-essential',
        'php5',
        'php5-mysql',
    ], update=False)

    mysql(password="******")

    apache()
    stopped('apache2')
    site_disabled('default')
    site(
        'mylampvm.dev',
        template_source=full_path + '/templates/apache2/vhost.tpl',
        port=80,
        server_name='mylampvm.dev',
        document_root='/srv',
    )

    template_file(template_source=full_path + '/templates/apache2/envvars.tpl',
                  path='/etc/apache2/envvars',
                  context={
                      'apache_run_user': '******',
                      'apache_run_group': 'vagrant',
                  },
                  owner='root',
                  group='root',
                  use_sudo=True)
    directory('/var/lock/apache2', True, 'vagrant', 'vagrant')

    # site_enabled('mylampvm.dev')
    restarted('apache2')
Exemple #3
0
def test_apache_can_serve_a_web_page(apache, example_site):

    from fabtools.require.apache import site_enabled, site_disabled

    site_disabled('default')
    site_enabled(example_site)

    with shell_env(http_proxy=''):
        body = run('wget -qO- --header="Host: {0}" http://localhost/'.format(example_site))

    assert body == 'example page'
Exemple #4
0
def test_apache_can_serve_a_web_page(apache, example_site):

    from fabtools.require.apache import site_enabled, site_disabled

    site_disabled('default')
    site_enabled(example_site)

    with shell_env(http_proxy=''):
        body = run('wget -qO- --header="Host: {0}" http://localhost/'.format(
            example_site))

    assert body == 'example page'
def test_apache_can_serve_a_web_page(apache):

    from fabtools.require.apache import site, site_disabled

    site_disabled('default')

    run('mkdir -p ~/example.com/')
    run('echo "example page" > ~/example.com/index.html')

    site(
        'example.com',
        template_contents="""
<VirtualHost *:%(port)s>
    ServerName %(hostname)s

    DocumentRoot %(document_root)s

    <Directory %(document_root)s>
        Options Indexes FollowSymLinks MultiViews

        AllowOverride All

        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
        """,
        port=80,
        hostname='www.example.com',
        document_root='/home/vagrant/example.com/',
    )

    with shell_env(http_proxy=''):
        body = run('wget -qO- --header="Host: www.example.com" http://localhost/')

    assert body == 'example page'
Exemple #6
0
def test_require_site_disabled(apache, example_site):
    from fabtools.require.apache import site_disabled
    site_disabled(example_site)
    assert not is_link(
        '/etc/apache2/sites-enabled/{0}.conf'.format(example_site))
def test_require_site_disabled(apache):
    from fabtools.require.apache import site_disabled
    site_disabled('default')
    assert not is_link('/etc/apache2/sites-enabled/000-default')
Exemple #8
0
def test_require_site_disabled(apache, example_site):
    from fabtools.require.apache import site_disabled
    site_disabled(example_site)
    assert not is_link('/etc/apache2/sites-enabled/{0}.conf'.format(example_site))