User:Iho jose/gammapeit/phabricator
Manual de instalación de Phabricator, con configuración de repositorios y servidor.
Phabricator es una aplicación web desarrollada en PHP en la que podemos hospedar proyectos y repositorios, sirve para las organizaciones que buscan tener sus repositorios en un servidor propio y no requiere gastos adicionales debido a que la aplicación es gratuita para los que lo instalan manualmente.
NOTA: Este aplicativo no puede ser instalado en hosting compartido si se quiere tener todas las prestaciones del aplicativo.
Instalación de servidor[edit]
Requerimientos[edit]
- Puede ser instalado en cualquier servidor pero es recomendable hacerlo sobre un servidor tipo UNIX como Ubuntu.
- RAM: 512 MB (Se recomienda usar 1 GB).
- SSD/HDD: 20 GB (Para almacenamiento de los repositorios).
- VPS: El servidor debe ser dedicado para tener todas las características de la aplicación.
Instalación de Servidor Apache2/MySQL/PHP7[edit]
Ubuntu 14+[edit]
- Ejecutamos el comando de instalación:
sudo apt-get install apache2
- Habilitamos modulos necesarios para el funcionamiento de phabricator.
sudo a2enmod rewrite sudo a2enmod ssl
- Instalamos servidor de bases de datos MySQL.
sudo apt-get install mysql-server
- Ahora argegaremos el repositorio de PHP al servidor.
sudo apt-get install -y python-software-properties sudo add-apt-repository -y ppa:ondrej/php sudo apt-get update -y
- Instalamos PHP y sus componentes.
sudo apt-get install -y php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mysql php7.1-mcrypt php7.1-zip php7.1-curl libapache2-mod-php7.1
Instalación de phabricator[edit]
- Instalamos algunas herramientas usadas por Phabricator, entraremos al servidor como usuario
root
:root# apt-get install git mercurial subversion python-pygments sendmail imagemagick
- Ahora agregaremos 2 usuarios que serán usados por Phabricator para efectuar acciones en la máquina.
root# adduser phd --home /home/phd root# adduser phd sudo root# adduser git
- Crearemos un directorio para los repositorios:
root# mkdir /var/repo root# chown -R phd /var/repo root# chgrp -R phd /var/repo
- Descargamos Phabricator, (en
/var/www
):git clone https://github.com/phacility/libphutil.git git clone https://github.com/phacility/arcanist.git git clone https://github.com/phacility/phabricator.git
- accedemos al directorio de phabricator:
cd /var/www/phabricator
- Las siguientes son las configuraciones iniciales para Phabricator:
# Generally acceptable settings: ./bin/config set mysql.pass <MYSQL_ROOT_PASSWD> ./bin/config set phabricator.base-uri 'http://phabricator.mydomain.net/' ./bin/config set phd.user phd ./bin/config set environment.append-paths '["/usr/lib/git-core"]' ./bin/config set diffusion.ssh-user git ./bin/config set pygments.enabled true # for local-disk file storage only: mkdir /home/phd/phabricator-files chmod -R 755 /home/phd/phabricator-files ./bin/config set storage.local-disk.path /home/phd/phabricator-files # Set true if you want to allow public http cloning: ./bin/config set policy.allow-public true # Set to true if you want to allow http pushes ./bin/config set diffusion.allow-http-auth false # You most likely want prototype apps, they are very useful: ./bin/config set phabricator.show-prototypes true # You may want this true, depending on your workflow: ./bin/config set differential.require-test-plan-field false # recommended silliness-enabling settings: ./bin/config set files.enable-imagemagick true ./bin/config set remarkup.enable-embedded-youtube true
- Ahora editamos
/etc/sudoers
para los accesos, agregamos la siguiente configuración:git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /usr/bin/hg, /usr/bin/svnserve www-data ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/lib/git-core/git-http-backend, /usr/bin/hg
Configuración de Apache[edit]
- Editaremos (crearemos) el archivo
/etc/apache2/sites-available/phabricator.conf
, y agregamos el siguiente código:Si se tiene un certificado TLS/SSL, entonces agregamos lo siguiente:<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName phabricator.mydomain.net ServerAlias phabricator.mydomain.net ServerAdmin webmaster@example.com DocumentRoot /var/www/phabricator/webroot RewriteEngine on RewriteRule ^/rsrc/(.*) - [L,QSA] RewriteRule ^/favicon.ico - [L,QSA] RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf <Directory "/var/www/phabricator/webroot"> Require all granted </Directory> </VirtualHost>
<IfModule mod_ssl.c> <VirtualHost *:80> ServerName phabricator.mydomain.net Redirect permanent / https://phabricator.mydomain.net </VirtualHost> <VirtualHost *:443> # Change this to the domain which points to your host. ServerName phabricator.mydomain.net SSLEngine on SSLCertificateKeyFile /etc/ssl/private/phabricator.key SSLCertificateFile /etc/ssl/certs/phabricator_mydomain.net.crt SSLCertificateChainFile /etc/ssl/certs/phabricator_mydomain.net.ca-bundle SSLProtocol All -SSLv2 -SSLv3 # Change this to the path where you put 'phabricator' when you checked it # out from GitHub when following the Installation Guide. # # Make sure you include "/webroot" at the end! DocumentRoot /var/www/phabricator/webroot RewriteEngine on RewriteRule ^/rsrc/(.*) - [L,QSA] RewriteRule ^/favicon.ico - [L,QSA] RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] <Directory "/var/www/phabricator/webroot"> Require all granted </Directory> </VirtualHost> </IfModule>
- Ahora habilitaremos nuestro nuevo sitio:
# podemos reshabilitar el que está por defecto a2dissite 000-default # Ahora activamos el nuevo sitio a2ensite phabricator # Reiniciamos el servidor service apache2 restart
- (Opcional): Ahora, si contamos con un servidor con grandes pretaciones podemos subir la velocidad de consulta de MySQL, con la siguiente configuración opcional (
/etc/mysql/my.cnf
): Debajo de la etiqueta[mysqld]
:Aumentamos el uso de memoria del sistema:sql_mode=STRICT_ALL_TABLES ft_boolean_syntax=' |-><()~*:""&^' ft_stopword_file=/home/phd/phabricator/resources/sql/stopwords.txt ft_min_word_len=3
Reiniciamos el servidor MySQL:innodb_buffer_pool_size=800M
service mysql restart
- En
/var/www/phabricator
actualizamos almacenamiento:/bin/storage upgrade
- Ahora configuraremos PHP: Ajustamos las siguientes líneas de
/etc/php5/apache2/php.ini
. Con nano, podemos buscar la línea usando el comandoctrl+w
.Reiniciamos Apachepost_max_size = 8M date.timezone = Etc/UTC opcache.validate_timestamps = 0
Reiniciamos dameon user de phabricator:service apache2 restart
root# sudo -su phd phd$ ./bin/phd restart
- Ahora copiaremos archivo de clonado SSH a otro directorio:Creamos ssh daemon en el puerto 22:
# copy ssh hook to executable location cp /var/www/phabricator/resources/sshd/phabricator-ssh-hook.sh /usr/lib/phabricator-ssh-hook.sh chown root /usr/lib/phabricator-ssh-hook.sh chmod 755 /usr/lib/phabricator-ssh-hook.sh # Modify hook to match your system (hint: vcs-user == git) nano /usr/lib/phabricator-ssh-hook.sh
Corremos el siguiente comando para probar accesibilidad:# Copy the examply sshd config cp /var/www/phabricator/resources/sshd/sshd_config.phabricator.example /etc/ssh/sshd_config.phabricator # Edit AuthorizedKeysCommand, AuthorizedKeysCommandUser, and AllowUsers nano /etc/ssh/sshd_config.phabricator # Start the phabricator sshd /usr/sbin/sshd -f /etc/ssh/sshd_config.phabricator
El resultado debería ser:echo {} | ssh git@phabricator.mydomain.net conduit conduit.ping
{"result":"orbital","error_code":null,"error_info":null}
- Ahora ingresaremos desde un navegador a nuestra instancia de Phabricator y terminamos los procesos pendientes en el icono de notificaciones.