<commit_before>from fabric.api import sudo, cd, task, prompt, run
from fabric.contrib import files
from fabtools import require, python, supervisor

# Variables
newebe_dir = "/home/newebe/newebe"
newebe_process = newebe_user = "newebe"
newebe_user_dir = "/home/newebe/"
python_exe = newebe_dir + "/virtualenv/bin/python"
newebe_exe = newebe_dir + "/newebe_server.py"

# Helpers
import random
import string
 
def random_string(n):
    """Create n length random string"""

    chars = string.letters + string.digits
    code = ''.join([random.choice(chars) for i in range(n)])
    return code

def newebedo(cmd):
    """Run a commande as a newebe user"""

    sudo(cmd, user=newebe_user)

def delete_if_exists(filename):
    """Delete given file if it already exists"""

    if files.exists(filename):
        newebedo("rm -rf %s" % filename)

# Install tasks

@task()
def setup():
    """Deploy the whole newebe stack"""

    install_deb_packages()
    create_user()
    install_newebe()
    make_dirs()
    build_configuration_file()
    build_certificates()
    setup_supervisord()
    set_supervisord_config()

@task()
def install_deb_packages():
    """Install required deb packages"""

    require.deb.packages([
        'python',
        'python-setuptools',
        'python-pip',
        'python-pycurl',
        'python-imaging',
        'couchdb',<commit_msg>add packages as requirement to fabfile installation<commit_after>from fabric.api import sudo, cd, task, prompt, run
from fabric.contrib import files
from fabtools import require, python, supervisor

# Variables
newebe_dir = "/home/newebe/newebe"
newebe_process = newebe_user = "newebe"
newebe_user_dir = "/home/newebe/"
python_exe = newebe_dir + "/virtualenv/bin/python"
newebe_exe = newebe_dir + "/newebe_server.py"

# Helpers
import random
import string
 
def random_string(n):
    """Create n length random string"""

    chars = string.letters + string.digits
    code = ''.join([random.choice(chars) for i in range(n)])
    return code

def newebedo(cmd):
    """Run a commande as a newebe user"""

    sudo(cmd, user=newebe_user)

def delete_if_exists(filename):
    """Delete given file if it already exists"""

    if files.exists(filename):
        newebedo("rm -rf %s" % filename)

# Install tasks

@task()
def setup():
    """Deploy the whole newebe stack"""

    install_deb_packages()
    create_user()
    install_newebe()
    make_dirs()
    build_configuration_file()
    build_certificates()
    setup_supervisord()
    set_supervisord_config()

@task()
def install_deb_packages():
    """Install required deb packages"""

    require.deb.packages([
        'python',
        'python-dev',
        'build-essential',
        'python-setuptools',
        'python-pip',
        'python-pycurl',
        'python-imaging',
        'couchdb',
{'fraction_non_alphanumeric': 0.12194257355547679, 'fraction_numerical': 0.0, 'mean_word_length': 3.5296950240770464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '461352', 'n_tokens_mistral': 955, 'n_tokens_neox': 917, 'n_words': 233}