Mercurial > kallithea
changeset 4185:aaa7c3331186 kallithea-2.2.5-rebrand
Rename paster command setup-rhodecode to setup-db
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:04:00 -0400 |
parents | 48ad84558fb4 |
children | 7e5f8c12a3fc |
files | docs/installation_win.rst docs/setup.rst rhodecode/lib/paster_commands/setup_db.py rhodecode/lib/paster_commands/setup_rhodecode.py rhodecode/tests/scripts/create_rc.sh setup.py |
diffstat | 6 files changed, 119 insertions(+), 119 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/installation_win.rst Wed Jul 02 19:04:00 2014 -0400 +++ b/docs/installation_win.rst Wed Jul 02 19:04:00 2014 -0400 @@ -221,7 +221,7 @@ For the sake of simplicity lets run it with the default settings. After your edits (if any), in the previous Command Prompt, type:: - paster setup-rhodecode production.ini + paster setup-db production.ini (this time a NEW database will be installed, you must follow a different step to later UPGRADE to a newer RhodeCode version)
--- a/docs/setup.rst Wed Jul 02 19:04:00 2014 -0400 +++ b/docs/setup.rst Wed Jul 02 19:04:00 2014 -0400 @@ -26,20 +26,20 @@ postgresql, sqlite and mysql databases. Create the database by running the following command:: - paster setup-rhodecode production.ini + paster setup-db production.ini This will prompt you for a "root" path. This "root" path is the location where RhodeCode will store all of its repositories on the current machine. After -entering this "root" path ``setup-rhodecode`` will also prompt you for a username -and password for the initial admin account which ``setup-rhodecode`` sets +entering this "root" path ``setup-db`` will also prompt you for a username +and password for the initial admin account which ``setup-db`` sets up for you. setup process can be fully automated, example for lazy:: - paster setup-rhodecode production.ini --user=nn --password=secret --email=nn@your.kallithea.server --repos=/home/nn/my_repos + paster setup-db production.ini --user=nn --password=secret --email=nn@your.kallithea.server --repos=/home/nn/my_repos -- The ``setup-rhodecode`` command will create all of the needed tables and an +- The ``setup-db`` command will create all of the needed tables and an admin account. When choosing a root path you can either use a new empty location, or a location which already contains existing repositories. If you choose a location which contains existing repositories RhodeCode will simply @@ -57,7 +57,7 @@ - This command runs the RhodeCode server. The web app should be available at the 127.0.0.1:5000. This ip and port is configurable via the production.ini file created in previous step -- Use the admin account you created above when running ``setup-rhodecode`` +- Use the admin account you created above when running ``setup-db`` to login to the web app. - The default permissions on each repository is read, and the owner is admin. Remember to update these if needed.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/lib/paster_commands/setup_db.py Wed Jul 02 19:04:00 2014 -0400 @@ -0,0 +1,110 @@ +import os +import sys +from paste.script.appinstall import AbstractInstallCommand +from paste.script.command import BadCommand +from paste.deploy import appconfig + +# Add location of top level folder to sys.path +from os.path import dirname as dn +rc_path = dn(dn(dn(os.path.realpath(__file__)))) +sys.path.append(rc_path) + + +class Command(AbstractInstallCommand): + + default_verbosity = 1 + max_args = 1 + min_args = 1 + summary = "Setup an application, given a config file" + usage = "CONFIG_FILE" + group_name = "RhodeCode" + + description = """\ + + Setup RhodeCode according to its configuration file. This is + the second part of a two-phase web application installation + process (the first phase is prepare-app). The setup process + consist of things like setting up databases, creating super user + """ + + parser = AbstractInstallCommand.standard_parser( + simulate=True, quiet=True, interactive=True) + parser.add_option('--user', + action='store', + dest='username', + default=None, + help='Admin Username') + parser.add_option('--email', + action='store', + dest='email', + default=None, + help='Admin Email') + parser.add_option('--password', + action='store', + dest='password', + default=None, + help='Admin password min 6 chars') + parser.add_option('--repos', + action='store', + dest='repos_location', + default=None, + help='Absolute path to repositories location') + parser.add_option('--name', + action='store', + dest='section_name', + default=None, + help='The name of the section to set up (default: app:main)') + parser.add_option('--force-yes', + action='store_true', + dest='force_ask', + default=None, + help='Force yes to every question') + parser.add_option('--force-no', + action='store_false', + dest='force_ask', + default=None, + help='Force no to every question') + parser.add_option('--public-access', + action='store_true', + dest='public_access', + default=None, + help='Enable public access on this installation (default)') + parser.add_option('--no-public-access', + action='store_false', + dest='public_access', + default=None, + help='Disable public access on this installation ') + def command(self): + config_spec = self.args[0] + section = self.options.section_name + if section is None: + if '#' in config_spec: + config_spec, section = config_spec.split('#', 1) + else: + section = 'main' + if not ':' in section: + plain_section = section + section = 'app:' + section + else: + plain_section = section.split(':', 1)[0] + if not config_spec.startswith('config:'): + config_spec = 'config:' + config_spec + if plain_section != 'main': + config_spec += '#' + plain_section + config_file = config_spec[len('config:'):].split('#', 1)[0] + config_file = os.path.join(os.getcwd(), config_file) + self.logging_file_config(config_file) + conf = appconfig(config_spec, relative_to=os.getcwd()) + ep_name = conf.context.entry_point_name + ep_group = conf.context.protocol + dist = conf.context.distribution + if dist is None: + raise BadCommand( + "The section %r is not the application (probably a filter). " + "You should add #section_name, where section_name is the " + "section that configures your application" % plain_section) + installer = self.get_installer(dist, ep_group, ep_name) + installer.setup_config( + self, config_file, section, self.sysconfig_install_vars(installer)) + self.call_sysconfig_functions( + 'post_setup_hook', installer, config_file)
--- a/rhodecode/lib/paster_commands/setup_rhodecode.py Wed Jul 02 19:04:00 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -import os -import sys -from paste.script.appinstall import AbstractInstallCommand -from paste.script.command import BadCommand -from paste.deploy import appconfig - -# Add location of top level folder to sys.path -from os.path import dirname as dn -rc_path = dn(dn(dn(os.path.realpath(__file__)))) -sys.path.append(rc_path) - - -class Command(AbstractInstallCommand): - - default_verbosity = 1 - max_args = 1 - min_args = 1 - summary = "Setup an application, given a config file" - usage = "CONFIG_FILE" - group_name = "RhodeCode" - - description = """\ - - Setup RhodeCode according to its configuration file. This is - the second part of a two-phase web application installation - process (the first phase is prepare-app). The setup process - consist of things like setting up databases, creating super user - """ - - parser = AbstractInstallCommand.standard_parser( - simulate=True, quiet=True, interactive=True) - parser.add_option('--user', - action='store', - dest='username', - default=None, - help='Admin Username') - parser.add_option('--email', - action='store', - dest='email', - default=None, - help='Admin Email') - parser.add_option('--password', - action='store', - dest='password', - default=None, - help='Admin password min 6 chars') - parser.add_option('--repos', - action='store', - dest='repos_location', - default=None, - help='Absolute path to repositories location') - parser.add_option('--name', - action='store', - dest='section_name', - default=None, - help='The name of the section to set up (default: app:main)') - parser.add_option('--force-yes', - action='store_true', - dest='force_ask', - default=None, - help='Force yes to every question') - parser.add_option('--force-no', - action='store_false', - dest='force_ask', - default=None, - help='Force no to every question') - parser.add_option('--public-access', - action='store_true', - dest='public_access', - default=None, - help='Enable public access on this installation (default)') - parser.add_option('--no-public-access', - action='store_false', - dest='public_access', - default=None, - help='Disable public access on this installation ') - def command(self): - config_spec = self.args[0] - section = self.options.section_name - if section is None: - if '#' in config_spec: - config_spec, section = config_spec.split('#', 1) - else: - section = 'main' - if not ':' in section: - plain_section = section - section = 'app:' + section - else: - plain_section = section.split(':', 1)[0] - if not config_spec.startswith('config:'): - config_spec = 'config:' + config_spec - if plain_section != 'main': - config_spec += '#' + plain_section - config_file = config_spec[len('config:'):].split('#', 1)[0] - config_file = os.path.join(os.getcwd(), config_file) - self.logging_file_config(config_file) - conf = appconfig(config_spec, relative_to=os.getcwd()) - ep_name = conf.context.entry_point_name - ep_group = conf.context.protocol - dist = conf.context.distribution - if dist is None: - raise BadCommand( - "The section %r is not the application (probably a filter). " - "You should add #section_name, where section_name is the " - "section that configures your application" % plain_section) - installer = self.get_installer(dist, ep_group, ep_name) - installer.setup_config( - self, config_file, section, self.sysconfig_install_vars(installer)) - self.call_sysconfig_functions( - 'post_setup_hook', installer, config_file)
--- a/rhodecode/tests/scripts/create_rc.sh Wed Jul 02 19:04:00 2014 -0400 +++ b/rhodecode/tests/scripts/create_rc.sh Wed Jul 02 19:04:00 2014 -0400 @@ -1,7 +1,7 @@ #!/bin/sh psql -U postgres -h localhost -c 'drop database if exists rhodecode;' psql -U postgres -h localhost -c 'create database rhodecode;' -paster setup-rhodecode rc.ini --force-yes --user=marcink --password=qweqwe --email=marcin@python-blog.com --repos=/home/marcink/repos --no-public-access +paster setup-db rc.ini --force-yes --user=marcink --password=qweqwe --email=marcin@python-blog.com --repos=/home/marcink/repos --no-public-access API_KEY=`psql -R " " -A -U postgres -h localhost -c "select api_key from users where admin=TRUE" -d rhodecode | awk '{print $2}'` echo "run those after running server" paster serve rc.ini --pid-file=rc.pid --daemon
--- a/setup.py Wed Jul 02 19:04:00 2014 -0400 +++ b/setup.py Wed Jul 02 19:04:00 2014 -0400 @@ -169,7 +169,7 @@ main = pylons.util:PylonsInstaller [paste.global_paster_command] - setup-rhodecode=rhodecode.lib.paster_commands.setup_rhodecode:Command + setup-db=rhodecode.lib.paster_commands.setup_db:Command update-repoinfo=rhodecode.lib.paster_commands.update_repoinfo:Command make-rcext=rhodecode.lib.paster_commands.make_rcextensions:Command repo-scan=rhodecode.lib.paster_commands.repo_scan:Command