From 9c34c465fdf7fb6a67bcad14ee9669d883954e39 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Jun 05 2018 11:50:00 +0000 Subject: Change the default and sample configuration to point to localhost-friendly resources This makes Pagure actually work out of the box by default outside of the Pagure.io deployment. Signed-off-by: Neal Gompa --- diff --git a/doc/configuration.rst b/doc/configuration.rst index d85940a..96fab5b 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -51,7 +51,7 @@ APP_URL This configuration key indicates the URL at which this pagure instance will be made available. -Defaults to: ``https://pagure.org/`` +Defaults to: ``http://localhost.localdomain/`` EMAIL_ERROR @@ -72,7 +72,7 @@ the git repos hosted on pagure via `SSH '/srv/git/repositories' + GL_REPO_BASE => '/path/to/git/repositories' # default umask gives you perms of '0700'; see the rc file docs for # how/why you might change this diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index 2c15a37..0e37824 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -30,7 +30,7 @@ ADMIN_GROUP = ['sysadmin-main'] PAGURE_ADMIN_USERS = [] ### The email address to which the flask.log will send the errors (tracebacks) -EMAIL_ERROR = 'pingou@pingoured.fr' +EMAIL_ERROR = 'root@localhost' ### SMTP settings SMTP_SERVER = 'localhost' @@ -42,20 +42,20 @@ SMTP_USERNAME = None SMTP_PASSWORD = None ### Information used to sent notifications -FROM_EMAIL = 'pagure@pagure.io' -DOMAIN_EMAIL_NOTIFICATIONS = 'pagure.io' +FROM_EMAIL = 'pagure@localhost.localdomain' +DOMAIN_EMAIL_NOTIFICATIONS = 'localhost.localdomain' SALT_EMAIL = '' ### The URL at which the project is available. -APP_URL = 'https://pagure.io/' +APP_URL = 'http://localhost.localdomain/' ### The URL at which the documentation of projects will be available ## This should be in a different domain to avoid XSS issues since we want ## to allow raw html to be displayed (different domain, ie not a sub-domain). -DOC_APP_URL = 'https://docs.pagure.org' +DOC_APP_URL = 'http://docs.localhost.localdomain' ### The URL to use to clone git repositories. -GIT_URL_SSH = 'ssh://git@pagure.io/' -GIT_URL_GIT = 'git://pagure.io/' +GIT_URL_SSH = 'ssh://git@localhost.localdomain/' +GIT_URL_GIT = 'git://localhost.localdomain/' ### Folder containing to the git repos GIT_FOLDER = os.path.join( diff --git a/files/pagure.conf b/files/pagure.conf index 7bcf99b..150997c 100644 --- a/files/pagure.conf +++ b/files/pagure.conf @@ -8,19 +8,19 @@ #WSGIDaemonProcess paguredocs user=git group=git maximum-requests=1000 display-name=pagure processes=4 threads=4 inactivity-timeout=300 # - #ServerName pagure.io - #Redirect permanent / https://pagure.io/ + #ServerName localhost.localdomain + #Redirect permanent / https://localhost.localdomain/ # # - #ServerName docs.pagure.org - #Redirect permanent / https://docs.pagure.org/ + #ServerName docs.localhost.localdomain + #Redirect permanent / https://docs.localhost.localdomain/ # # - #ServerName docs.pagure.org + #ServerName docs.localhost.localdomain #WSGIScriptAlias / /usr/share/pagure/doc_pagure.wsgi @@ -51,7 +51,7 @@ # - #ServerName pagure.io + #ServerName localhost.localdomain #WSGIScriptAlias / /usr/share/pagure/pagure.wsgi @@ -68,7 +68,7 @@ #Alias /releases /var/www/releases ## Section used to support cloning git repo over http (https in this case) - #SetEnv GIT_PROJECT_ROOT /srv/git/repositories + #SetEnv GIT_PROJECT_ROOT /path/to/git/repositories #AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /path/to/git/repositories/$1 #AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /path/to/git/repositories/$1 diff --git a/pagure/default_config.py b/pagure/default_config.py index 2cdc436..9fb8a55 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -44,10 +44,10 @@ PAGURE_ADMIN_USERS = [] EMAIL_SEND = False # The email address to which the flask.log will send the errors (tracebacks) -EMAIL_ERROR = 'pingou@pingoured.fr' +EMAIL_ERROR = 'root@localhost.localdomain' # The URL at which the project is available. -APP_URL = 'https://pagure.org/' +APP_URL = 'http://localhost.localdomain/' # Enables / Disables tickets for project for the entire pagure instance ENABLE_TICKETS = True @@ -86,8 +86,8 @@ DEPLOY_KEY = True SHOW_PROJECTS_INDEX = ['repos', 'myrepos', 'myforks'] # The URL to use to clone the git repositories. -GIT_URL_SSH = 'ssh://git@pagure.org/' -GIT_URL_GIT = 'git://pagure.org/' +GIT_URL_SSH = 'ssh://git@localhost.localdomain/' +GIT_URL_GIT = 'git://localhost.localdomain/' # Default queue names for the different services WEBHOOK_CELERY_QUEUE = 'pagure_webhook' @@ -195,9 +195,9 @@ SMTP_PASSWORD = None # Email used to sent emails -FROM_EMAIL = 'pagure@pagure.org' +FROM_EMAIL = 'pagure@localhost.localdomain' -DOMAIN_EMAIL_NOTIFICATIONS = 'pagure.org' +DOMAIN_EMAIL_NOTIFICATIONS = 'localhost.localdomain' SALT_EMAIL = '' # Specify which authentication method to use. diff --git a/tests/test_pagure_flask_api_pr_flag.py b/tests/test_pagure_flask_api_pr_flag.py index 9aed6a2..ac11e8b 100644 --- a/tests/test_pagure_flask_api_pr_flag.py +++ b/tests/test_pagure_flask_api_pr_flag.py @@ -228,7 +228,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): mock_email.assert_called_once_with( '\nJenkins flagged the pull-request `test pull-request` ' 'as pending: Tests running\n\n' - 'https://pagure.org/test/pull-request/1\n', + 'http://localhost.localdomain/test/pull-request/1\n', 'PR #1 - Jenkins: pending', 'bar@pingou.com', in_reply_to='test-pull-request-' + pr_uid, diff --git a/tests/test_pagure_flask_api_project.py b/tests/test_pagure_flask_api_project.py index 8719c6f..4faa79f 100644 --- a/tests/test_pagure_flask_api_project.py +++ b/tests/test_pagure_flask_api_project.py @@ -184,8 +184,8 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertEqual(output.status_code, 200) expected_rv = { 'urls': { - 'git': 'git://pagure.org/test.git', - 'ssh': 'ssh://git@pagure.org/test.git' + 'git': 'git://localhost.localdomain/test.git', + 'ssh': 'ssh://git@localhost.localdomain/test.git' }, 'total_urls': 2 } @@ -224,8 +224,8 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertEqual(output.status_code, 200) expected_rv = { 'urls': { - 'git': 'git://pagure.org/test.git', - 'ssh': 'ssh://git@pagure.org/test.git' + 'git': 'git://localhost.localdomain/test.git', + 'ssh': 'ssh://git@localhost.localdomain/test.git' }, 'total_urls': 2 } @@ -3078,7 +3078,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): '\nJenkins flagged the commit ' '`' + commit.oid.hex + '` as success: ' 'Tests passed\n\n' - 'https://pagure.org/test/c/' + commit.oid.hex + '\n', + 'http://localhost.localdomain/test/c/' + commit.oid.hex + '\n', 'Coommit #' + commit.oid.hex + ' - Jenkins: success', 'bar@pingou.com', in_reply_to='test-project-1', diff --git a/tests/test_pagure_flask_form.py b/tests/test_pagure_flask_form.py index 02d6366..7c9c028 100644 --- a/tests/test_pagure_flask_form.py +++ b/tests/test_pagure_flask_form.py @@ -33,7 +33,7 @@ import tests class PagureFlaskFormTests(tests.SimplePagureTest): """ Tests for forms of the flask application """ - @patch.dict('pagure.config.config', {'SERVER_NAME': 'pagure.org'}) + @patch.dict('pagure.config.config', {'SERVER_NAME': 'localhost.localdomain'}) def setUp(self): super(PagureFlaskFormTests, self).setUp() diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index 8080235..bc3065a 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -1788,8 +1788,8 @@ class PagureFlaskIssuestests(tests.Modeltests): # below self.assertIn( '

Metadata Update from '\ - ''\ -'''@pingou:
+ ''\ +'''@pingou:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

''', output_text) diff --git a/tests/test_pagure_flask_ui_plugins_pagure_ci.py b/tests/test_pagure_flask_ui_plugins_pagure_ci.py index 9a87481..344a986 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_ci.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_ci.py @@ -131,7 +131,7 @@ class PagureFlaskPluginPagureCItests(tests.SimplePagureTest): '', output_text) self.assertIn( - '
\nhttps://pagure.org/api/0/ci/jenkins/test/',
+                '
\nhttp://localhost.localdomain/api/0/ci/jenkins/test/',
                 output_text)
 
             # De-activate the hook
@@ -263,7 +263,7 @@ class PagureFlaskPluginPagureCItests(tests.SimplePagureTest):
                 '', output_text)
             self.assertIn(
-                '
\nhttps://pagure.org/api/0/ci/jenkins/somenamespace/test3/',
+                '
\nhttp://localhost.localdomain/api/0/ci/jenkins/somenamespace/test3/',
                 output_text)
 
 
diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py
index 70697fa..ad42375 100644
--- a/tests/test_pagure_flask_ui_repo.py
+++ b/tests/test_pagure_flask_ui_repo.py
@@ -5074,7 +5074,7 @@ index 0000000..fb7093d
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn('',
                       output_text)
 
diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py
index e92729b..8b2b780 100644
--- a/tests/test_pagure_lib.py
+++ b/tests/test_pagure_lib.py
@@ -4100,8 +4100,8 @@ class PagureLibtests(tests.Modeltests):
         watch_list = [obj.name for obj in watch_list_objs]
         self.assertEqual(watch_list, [])
 
-    @patch('flask.request.url', 'http://pagure.org/test/issue/69')
-    @patch('flask.request.url_root', 'http://pagure.org/')
+    @patch('flask.request.url', 'http://localhost.localdomain/test/issue/69')
+    @patch('flask.request.url_root', 'http://localhost.localdomain/')
     @patch('flask.request.args.get', return_value=None)
     @patch('flask.request')
     @patch('flask.g')
@@ -4109,7 +4109,7 @@ class PagureLibtests(tests.Modeltests):
     def test_text2markdown(self, g, req, reqget):
         ''' Test the test2markdown method in pagure.lib. '''
         pagure.config.config['TESTING'] = True
-        pagure.config.config['SERVER_NAME'] = 'pagure.org'
+        pagure.config.config['SERVER_NAME'] = 'localhost.localdomain'
         pagure.SESSION = self.session
         pagure.lib.SESSION = self.session
 
@@ -4266,51 +4266,51 @@ class PagureLibtests(tests.Modeltests):
         ]
         expected = [
             # 'foo bar test#1 see?',
-            '

foo bar foo bar test#1 see?

', # 'foo bar pingou/test#2 I mean, really', -- unknown namespace '

foo bar pingou/test#2 I mean, really

', # 'foo bar fork/pingou/test#2 bouza!', - '

foo bar ' 'pingou/test#2 bouza!

', # 'foo bar forks/pingou/test#2 bouza!', -- the 's' doesn't matter - '

foo bar ' 'pingou/test#2 bouza!

', # 'foo bar ns/test3#4 bouza!', - '

foo bar foo bar ns/test3#4 bouza!

', # 'foo bar fork/user/ns/test#5 bouza!', -- unknown fork '

foo bar user/ns/test#5 bouza!

', # 'foo bar fork/pingou/ns/test#7 bouza!', - '

foo bar ' 'pingou/ns/test#7 bouza!

', # 'test#1 bazinga!', - '

test#1 bazinga!

', # 'pingou opened the PR forks/pingou/test#2' - '

pingou opened the PR pingou/test#2

', # 'fork/pingou/ns/test#8 is private', - '

pingou/ns/test#8 is private

', # 'implicit link to #1', - '

implicit link to #1

', + '

implicit link to #1

', # 'implicit link .#1. with non-whitespace, non-word characters', - '

implicit link .#1. with non-whitespace, non-word characters

', + '

implicit link .#1. with non-whitespace, non-word characters

', # '#2 - implicit link at start of line', - '

#2 - implicit link at start of line

', + '

#2 - implicit link at start of line

', # '#2. implicit link at start of line with no whitespace after', - '

#2. implicit link at start of line with no whitespace after

', + '

#2. implicit link at start of line with no whitespace after

', # '#regular header', '

regular header

', # '#34 looks like an implicit link, but no issue 34', '

34 looks like an implicit link, but no issue 34

', # 'pingou committed on test#9364354a4555ba17aa60f0dc844d70b74eb1aecd', - '

pingou committed on test#9364354a4555ba17aa60f0dc844d70b74eb1aecd

', @@ -4348,9 +4348,9 @@ class PagureLibtests(tests.Modeltests): # '~~foo bar~~ and ~~another ~~', '

foo bar and another

', # 'lets mention @pingou', - '

lets mention @pingou

', + '

lets mention @pingou

', # '@pingou at start of line', - '

@pingou at start of line

', + '

@pingou at start of line

', # 'but not someone@pingou.com', '

but not someone@pingou.com

', # '[![Fedora_infinity_small.png]' @@ -5638,7 +5638,7 @@ foo bar self.assertTrue(pagure.lib.filter_img_src( 'src', '/path/to/image')) self.assertTrue(pagure.lib.filter_img_src( - 'src', 'http://pagure.org/path/to/image')) + 'src', 'http://localhost.localdomain/path/to/image')) self.assertFalse(pagure.lib.filter_img_src( 'src', 'http://foo.org/path/to/image')) diff --git a/tests/test_pagure_lib_notify.py b/tests/test_pagure_lib_notify.py index cc117e3..1b94d75 100644 --- a/tests/test_pagure_lib_notify.py +++ b/tests/test_pagure_lib_notify.py @@ -353,7 +353,7 @@ class PagureLibNotifytests(tests.Modeltests): # Due to differences in the way Python2 and Python3 encode non-ascii # email headers, we compare the From and To headers separately from the # rest of the message. - self.assertEqual(email["From"], "Zöé ") + self.assertEqual(email["From"], "Zöé ") self.assertEqual(email["To"], "zöé@foo.net") del email["From"] del email["To"] @@ -361,16 +361,16 @@ class PagureLibNotifytests(tests.Modeltests): MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: =?utf-8?b?W25hbWVzcGFjZS9wcm9qZWN0XSBFbWFpbCDigJxTdWJqZWN04oCc?= -mail-id: test-pull-request-2edbf96ebe644f4bb31b94605e-1@pagure.org -Message-Id: -In-Reply-To: +mail-id: test-pull-request-2edbf96ebe644f4bb31b94605e-1@localhost.localdomain +Message-Id: +In-Reply-To: X-Auto-Response-Suppress: All -X-pagure: https://pagure.org/ +X-pagure: http://localhost.localdomain/ X-pagure-project: namespace/project List-ID: namespace/project -List-Archive: https://pagure.org/namespace/project -Reply-To: reply+819debcaa294a19ddedd9cfe0cb8faebb50d126adda0f02f203fce83824add55f2e640b75691d4a57cb95b25cc856b0815d1ad2a35ab358cda9de42e2b021957@pagure.org -Mail-Followup-To: reply+819debcaa294a19ddedd9cfe0cb8faebb50d126adda0f02f203fce83824add55f2e640b75691d4a57cb95b25cc856b0815d1ad2a35ab358cda9de42e2b021957@pagure.org +List-Archive: http://localhost.localdomain/namespace/project +Reply-To: reply+ddd73d6bcace71598118ece5808b9c1b8e68c73e1acc4302538257a0951bb920ea0765d3f262ddb3725e9369519b086a7873cb65fbfceb1a2a25897f8e2a54fa@localhost.localdomain +Mail-Followup-To: reply+ddd73d6bcace71598118ece5808b9c1b8e68c73e1acc4302538257a0951bb920ea0765d3f262ddb3725e9369519b086a7873cb65fbfceb1a2a25897f8e2a54fa@localhost.localdomain RW1haWwgY29udGVudA== ''' @@ -385,7 +385,7 @@ RW1haWwgY29udGVudA== project_name='namespace/project', user_from='Zöé', ) - self.assertEqual(email["From"], "Zöé ") + self.assertEqual(email["From"], "Zöé ") self.assertEqual(email["To"], "zöé@foo.net") del email["From"] del email["To"] diff --git a/tests/test_pagure_lib_notify_email.py b/tests/test_pagure_lib_notify_email.py index 265d21a..d832bd5 100644 --- a/tests/test_pagure_lib_notify_email.py +++ b/tests/test_pagure_lib_notify_email.py @@ -113,7 +113,7 @@ Test comment `` To reply, visit the link below -https://pagure.org/test/issue/1 +http://localhost.localdomain/test/issue/1 """ pagure.lib.notify.notify_new_comment(self.comment1) (_, args, kwargs) = fakemail.mock_calls[0] @@ -150,7 +150,7 @@ a bug report on a namespaced project `` To reply, visit the link below -https://pagure.org/somenamespace/test3/issue/1 +http://localhost.localdomain/somenamespace/test3/issue/1 """ pagure.lib.notify.notify_new_issue(self.issue2) (_, args, kwargs) = fakemail.mock_calls[0] @@ -182,7 +182,7 @@ https://pagure.org/somenamespace/test3/issue/1 exptext = """ The issue: `forked project issue` of project: `test` has been assigned to `pingou` by foo. -https://pagure.org/fork/foo/test/issue/1 +http://localhost.localdomain/fork/foo/test/issue/1 """ pagure.lib.notify.notify_assigned_issue(self.issue3, self.user1, self.user2) (_, args, kwargs) = fakemail.mock_calls[0] @@ -223,7 +223,7 @@ abcdefg Cecil Cõmmîttër We love Motörhead To view more about the commits, visit: -https://pagure.org/test/commits/master +http://localhost.localdomain/test/commits/master """ # first arg (abspath) doesn't matter and we can use a commit # ID that doesn't actually exist, as we are mocking