Exemple #1
0
def help():
    out.log(
        "Uploads the database to the production server. Makes a backup of the remote database before overwriting it.",
        'help')
    out.log(
        "Takes a filename as argument. If none given, uploads the local database."
    )
Exemple #2
0
def execute(filename=None):
    if filename is None:
        out.log(
            'no filename specified. Please specify a file to upload as argument.'
        )
    out.log("uploading " + engine.LOCAL_WWW_DIR + '/' + filename + "...")
    transfer.put(engine.LOCAL_WWW_DIR + '/' + filename, filename)
def execute(filename=None):
    out.log("Creating a backup of the remote db...")
    if filename is None:
        filename = engine.get_database_dump_file(compression=True,
                                                 domain='remote')
    remote_dump = mysql.create_remote_dump(compression=True)
    transfer.get(remote_dump, filename)
Exemple #4
0
def execute(arg1 = None, arg2 = None):
    if engine.ENABLE_BUILD_SYSTEM:
        out.log('compiling first...')
        compile.all()

    if arg1 == 'server-owned':
        mode = arg2
        server_owned = True
    elif arg2 == 'server-owned':
        mode = arg1
        server_owned = True
    else:
        mode = arg1
        server_owned = False


    if mode is None:
        mode = 'sync'

    out.log("deploying to server in " + mode + " mode...")
    if server_owned:
        out.log("overwriting server owned files.")
    else:
        out.log("skipping server owned files.")

    if mode == 'mirror':
        sync.upload(True, True, server_owned)
    elif mode == 'clean':
        sync.upload(False, True, server_owned)
    elif mode == 'sync':
        sync.upload(False, False, server_owned)
    elif mode == 'all':
        sync.upload(True, False, server_owned)
    else:
        out.log("invalid mode, did nothing.", 'command', out.LEVEL_ERROR)
Exemple #5
0
def execute(location = None):
    if location is None:
        location = 'local'
    if location != 'local' and location != 'remote':
        out.log(location + ' is not a valid host. Allowed hosts are local and remote.', 'command', out.LEVEL_ERROR)
        engine.quit()
    out.log('allowing read access for all files to all users on ' + location + ' host.')
    apache.allow_read(location)
Exemple #6
0
def execute():
    if engine.LOCAL_DB_NAME is not None:
        out.log("Synchronizing local db...")
        mysql.export_local_db()
        remote_dump = mysql.create_remote_dump(compression=True)
        local_dump = transfer.get(remote_dump)
        mysql.import_local_db(local_dump)
    else:
        out.log('No local database named, nothing to do.')
Exemple #7
0
def execute(mode=None):
    if mode is None:
        mode = 'sync'
    out.log("synchronizing local files (" + mode + " mode)...")

    if mode == 'mirror':
        sync.download(True, True)
    if mode == 'clean':
        sync.download(False, True)
    if mode == 'sync':
        sync.download(False, False)
    if mode == 'all':
        sync.download(True, False)
def execute(argument=None):
    if argument == 'local' or argument == 'remote' or argument is None:
        if argument is not None:
            domaintext = ' matching domain ' + argument
        else:
            domaintext = ''
        out.log('find latest database export in ' + engine.LOCAL_DB_DIR +
                domaintext)
        filename = engine.get_latest_database_dump(argument)
    else:
        filename = argument
    out.log("import database from " + filename)
    mysql.import_local_db(filename)
def execute(types=None):

    #compile all by default
    if types is None:
        types = 'all'

    #compile po
    if types == 'all' or types == 'po':
        out.log('compiling mo files')
        compile.po()

    #if that was our only job we are done here
    if types == 'po':
        return

    #check for enabled build system
    if not engine.ENABLE_BUILD_SYSTEM:
        out.log(
            'The build system is not enabled. Make sure you have set the ENABLE_BUILD_SYSTEM set to True in your config. Also note, that you will have to specify a SRC_URL and a BUILD_URL in you project config.',
            'command', out.LEVEL_ERROR)
        return

    #compile less
    if types == 'all' or types == 'less':
        out.log('compiling less files...')
        compile.less()

    #compile js
    if types == 'all' or types == 'js':
        out.log('compiling js files')
        compile.js()
def execute(domain=None):
    if domain is None:
        domain = engine.REMOTE_ROOT_URL
    if domain is None:
        out.log(
            "REMOTE_HTTP_ROOT not set, cannot crawl online page. Crawling local page instead.",
            'command', out.LEVEL_WARNING)
        domain = engine.LOCAL_ROOT_URL
    if domain is None:
        outt.log(
            "Cannot find LOCAL_HTTP_ROOT. Please provide a domain to crawl as argument.",
            'command', out.LEVEL_ERROR)
    else:
        run.local('node js/crawl.js ' + domain)
Exemple #11
0
def execute(filename=None):

    out.log("making a backup first")
    #make a backup first
    backup_file = engine.get_database_dump_file(compression=True,
                                                domain='remote')
    remote_dump = mysql.create_remote_dump(compression=True)
    transfer.get(remote_dump, backup_file)

    out.log("uploading database...")
    if filename is None:
        #export db, if no filelname is specified
        filename = mysql.export_local_db()
    #upload and import it
    mysql.upload_to_remote_db(filename)
Exemple #12
0
def help():
    out.log(
        "This command downloads all files that are present on the remote. It has four modes:",
        'help')
    out.log(
        'sync: Downloads all outdated files, keeps any additional local files. This is default behaviour.',
        'help')
    out.log(
        'all: Downloads all files regardless, keeps any additional local files.',
        'help')
    out.log(
        'mirror: Downloads all files regardless, deletes all files not present on the remote.',
        'help')
    out.log(
        'clean: Downloads all outdated files, deletes all files not present on the remote.',
        'help')
def help():
    out.log(
        "Reads a Database Dump file and imports it to your local database. Compression is is handled depending on the file ending.",
        'help')
    out.log(
        "The first parameter may be a filename of a .sql or .sql.gz file to import.",
        'help')
    out.log(
        "You can also specify a domain (local/remote) and it will pick the latest dump from that domain in the database directory.",
        'help')
    out.log(
        "If no filename and no domain is specified, the latest export will be taken from the database directory.",
        'help')
Exemple #14
0
def execute():
    out.log("cleaning up the local tmp directory")
    engine.clean_local_tmp_dir()
    out.log("cleaning up the remote tmp directory")
    engine.clean_remote_tmp_dir()
    if engine.ENABLE_BUILD_SYSTEM:
        out.log("cleaning up local build directory")
        engine.clean_build_dir()
Exemple #15
0
def execute(key=None):
    out.log('These are all configuration settings.')
    config_vars = engine.get_config(key)
    if key is None:
        for k in config_vars:
            out.log(k + ' = ' + str(config_vars[k]))
    else:
        out.log(key + ' = ' + config_vars)
Exemple #16
0
def execute(overwrite=None):
    out.log("Creating wordpress config files from local config settings...")
    #do not use overwrite argument
    if overwrite is None:
        #copy wp-config.php
        wp.copy_wp_config()
        #create wp-salt.php
        wp.create_wp_salt()
        #create wp-config-local.php
        wp.create_wp_config_local()
        #create wp-config-live.php
        wp.create_wp_config_live()
        #done
    #use overwrite argument for all
    else:
        #copy wp-config.php
        wp.copy_wp_config(overwrite)
        #create wp-salt.php
        wp.create_wp_salt(overwrite)
        #create wp-config-local.php
        wp.create_wp_config_local(overwrite)
        #create wp-config-live.php
        wp.create_wp_config_live(overwrite)
Exemple #17
0
def help():
    out.log("This command will synchronize your current www-directory with the remote www directory.", 'help')
    out.log('sync: Uploads all outdated files, keeps any additional remote files. This is default behaviour.', 'help')
    out.log('all: Uploads all files regardless, keeps any additional remote files.', 'help')
    out.log('mirror: Uploads all files regardless, deletes all files not present on the local filesystem.', 'help')
    out.log('clean: Uploads all outdated files, deletes all files not present on the local filesystem.', 'help')
    out.log('', 'help')
    out.log('Certain direcories are considered to be server owned. These are directories we expect to change on a live site by user or site owner.', 'help')
    out.log('Those directories will be skipped for uploading modified files. New files will still be uploaded, but overwriting a file is potentially destructive.', 'help');
    out.log('You can force uploading modified fiels to those directories by additionally specifying the argument "server-owned" (without quotation marks).', 'help')
    out.log('You can specify the server-owned argument alone (will default to sync mode) or with one of the other arguments. The order of arguments does not matter.', 'help');
Exemple #18
0
def execute():
    out.log("restarting apache server...")
    apache.restart()
def execute():
    out.log("showing tail of apache error log file...")
    run.local('tail -n 10 ' + engine.LOCAL_APACHE_ERROR_LOG)
def help():
    out.log("Creates a strong random 20 characters password.", 'help')
def execute(command):
    out.log("executing " + command)
    run.remote(command)
def help():
    out.log("This command executes a shell command on the server and prints its output to console.", 'help')
Exemple #23
0
def help():
    out.log("Setup your local domain.", 'help')
Exemple #24
0
def help():
    out.log(
        "This command will print all the variables, that are set in the engines environment that look like config variables.",
        'help')
def help():
    out.log(
        'Search the local database for a given string. Shows a summary at the end of the search. A detailed output is being written to output/search.log',
        'help')
def execute():
    out.log("generating password...")
    run.local('openssl rand -base64 15')
def execute(find):
    out.log('Searching local database for ' + find)
    run.local('php php/search-and-replace-db.php ' + engine.LOCAL_DB_HOST +
              ' ' + engine.LOCAL_DB_USER + ' ' + engine.LOCAL_DB_PASSWORD +
              ' ' + engine.LOCAL_DB_NAME + ' "' + find + '"')
Exemple #28
0
def help():
    out.log("Restarts the apache server.", 'help')
Exemple #29
0
def execute(mode = None):
    out.log('setting up domain lookup and virtual server')
    apache.append_to_hosts()
    apache.append_to_server_config()
    apache.restart()
def help():
    out.log(
        "This command is a more rememberable shortcut for outputting the last 10 lines of the apache error log file.",
        'help')