From 6c9bf6b4bb120b26c1d2c094dc421aecb5fb4597 Mon Sep 17 00:00:00 2001 From: John Dulaney Date: Jan 30 2016 20:01:04 +0000 Subject: [PATCH 1/2] Add requirement for mod_ssl Signed-off-by: John Dulaney --- diff --git a/files/pagure.spec b/files/pagure.spec index 0e87181..23f58b8 100644 --- a/files/pagure.spec +++ b/files/pagure.spec @@ -72,6 +72,7 @@ Requires: python-straight-plugin Requires: python-wtforms Requires: python-munch Requires: python-redis +Requires: mod_ssl Requires: mod_wsgi # No dependency of the app per se, but required to make it working. From 4116b7541e7f6c5bb3a2cd5caa822ac76a1c7f46 Mon Sep 17 00:00:00 2001 From: John Dulaney Date: Jan 31 2016 01:36:33 +0000 Subject: [PATCH 2/2] Update documentation Signed-off-by: John Dulaney --- diff --git a/doc/install.rst b/doc/install.rst index 996de56..b0f3ced 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -122,6 +122,15 @@ Set-up pagure Once pagure's files are installed, you still need to set up some things. +* Setup gitolite + +We want to use git@host rather than gitolite3@host, so let's move the +gitolite3 user to git. +:: + + usermod --move-home --login git --home /srv/git/ gitolite3 + groupmod --new-name git gitolite3 + * Create the folder release @@ -152,10 +161,27 @@ You would then create the folders with: :: mkdir /srv/git/repositories/{docs,forks,tickets,requests,remotes} + mkdir -p /srv/git/.gitolite/{conf,keydir,logs} + chown -R git:git /srv/git/.gitolite/ + chown -R git:git /srv/git/repositories * Configure apache +Generate SSL certificates + +If you wish to use a self-signed certificate +:: + + genkey --makeca pagure.io + +If you wish to use letsencrypt +:: + dnf -y install letsencrypt + letsencrypt --text --email py_pagure@pingoured.fr \ + --domains pagure.pingoured.fr \ + --agree-tos --renew-by-default --manual certonly + If installed by RPM, you will find an example apache configuration file at: ``/etc/httpd/conf.d/pagure.conf``. @@ -174,8 +200,16 @@ for the doc server. If you did not install by RPM, these files are present in the sources at: ``files/pagure.wsgi`` and ``files/doc_pagure.wsgi``. -Adjust them for your needs +Uncomment the following lines: +:: + import os + os.environ['PAGURE_CONFIG'] = '/etc/pagure/pagure.cfg' +and +:: + + from pagure import APP as application + application.debug = True * Give apache permission to read the repositories owned by the ``git`` user. @@ -188,7 +222,7 @@ To give apache this permission (required to make git clone via http work), we use file access control lists (aka FACL): :: - setfacl -m user:apache:rx --default + setfacl -m user:apache:rx --default /srv/git setfacl -Rdm user:apache:rx /srv/git setfacl -Rm user:apache:rx /srv/git @@ -214,6 +248,50 @@ work with: `PostgreSQL `_, would like to invite you to consult the documentation of your database system for this operation. + +If you choose to use postgresql: +:: + + dnf -y install postgresql-server python-psycopg2 + postgresql-setup --initdb + +Change the authentiation method to md5 +:: + + vi /var/lib/pgsql/data/pg_hba.conf + # TYPE DATABASE USER ADDRESS METHOD + host all all 127.0.0.1/32 md5 + host all all ::1/128 md5 + +Start the database service +:: + + systemctl enable postgresql.service + systemctl start postgresql.service + +Create database and user +:: + + sudo -u postgres psql + CREATE DATABASE pagure; + CREATE USER pagure; + ALTER USER pagure WITH ENCRYPTED PASSWORD '--'; + GRANT ALL PRIVILEGES ON DATABASE pagure to pagure; + GRANT ALL PRIVILEGES ON ALL tables IN SCHEMA public TO pagure; + GRANT ALL PRIVILEGES ON ALL sequences IN SCHEMA public TO pagure; + +Configure the sqlalchemy uri +:: + + vi /etc/pagure/alembic.ini + +Choose one of: +:: + + #sqlalchemy.url = postgres://user:pass@localhost/dbname + #sqlalchemy.url = mysql://user:pass@localhost/dbname + sqlalchemy.url = sqlite:////var/tmp/pagure_dev.sqlite + Once you have specified in the configuration file the to url used to connect to the database, and create the database itself, you can now create the tables, the database scheme. @@ -229,3 +307,25 @@ For example: This will tell ``/usr/share/pagure/pagure_createdb.py`` to use the database information specified in the file ``/etc/pagure/pagure.cfg``. + +Complete alembic setup +:: + + cd /etc/pagure + alembic stamp $(alembic heads |awk '{ print $1 }') + + +Open up the firewall for http and https traffic + +On Fedora: +:: + + firewall-cmd --permanent --add-service=http + firewall-cmd --permanent --add-service=https + firewall-cmd --reload + +Start and enable httpd +:: + + systemctl restart httpd + systemctl enable httpd diff --git a/files/alembic.ini b/files/alembic.ini index e0dc1d2..053708d 100644 --- a/files/alembic.ini +++ b/files/alembic.ini @@ -20,7 +20,8 @@ script_location = /usr/share/pagure/alembic # versions/ directory # sourceless = false -#sqlalchemy.url = driver://user:pass@localhost/dbname +#sqlalchemy.url = postgres://user:pass@localhost/dbname +#sqlalchemy.url = mysql://user:pass@localhost/dbname sqlalchemy.url = sqlite:////var/tmp/pagure_dev.sqlite diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index 1025205..8a948fe 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -12,8 +12,8 @@ ADMIN_SESSION_LIFETIME = timedelta(minutes=20) SECRET_KEY='' ### url to the database server: -#DB_URL=mysql://user:pass@host/db_name -#DB_URL=postgres://user:pass@host/db_name +#DB_URL='mysql://user:pass@host/db_name' +#DB_URL='postgres://user:pass@host/db_name' DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite' ### The FAS group in which the admin of pagure are @@ -44,42 +44,42 @@ GIT_URL_GIT = 'git://pagure.io/' ### Folder containing to the git repos GIT_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'repos' ) ### Folder containing the forks repos FORK_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'forks' ) ### Folder containing the docs repos DOCS_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'docs' ) ### Folder containing the tickets repos TICKETS_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'tickets' ) ### Folder containing the pull-requests repos REQUESTS_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'requests' ) ### Folder containing the clones for the remote pull-requests REMOTE_GIT_FOLDER = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'remotes' ) @@ -87,26 +87,26 @@ REMOTE_GIT_FOLDER = os.path.join( ### Configuration file for gitolite GITOLITE_CONFIG = os.path.join( os.path.abspath(os.path.dirname(__file__)), - '..', + '/srv/git', 'gitolite.conf' ) ### Home folder of the gitolite user ### Folder where to run gl-compile-conf from -GITOLITE_HOME = None +GITOLITE_HOME = '/srv/git' ### Version of gitolite used: 2 or 3? GITOLITE_VERSION = 3 ### Folder containing all the public ssh keys for gitolite -GITOLITE_KEYDIR = None +GITOLITE_KEYDIR = '/srv/git/keys' ### Path to the gitolite.rc file -GL_RC = None +GL_RC = '/srv/git/' ### Path to the /bin directory where the gitolite tools can be found -GL_BINDIR = None +GL_BINDIR = '/usr/bin/' # SSH Information