<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>www.php-geek.fr</title>
	<atom:link href="https://www.php-geek.fr/feed" rel="self" type="application/rss+xml" />
	<link>https://www.php-geek.fr</link>
	<description>Astuces et tutoriels web – PHP, JS, SQL, WordPress, Linux</description>
	<lastBuildDate>Tue, 05 Nov 2019 21:06:19 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9</generator>
	<item>
		<title>Sauvegarde et restauration de Gitlab dans Docker</title>
		<link>https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html</link>
		<comments>https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html#respond</comments>
		<pubDate>Thu, 20 Oct 2016 22:12:23 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[docker]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=781</guid>
		<description><![CDATA[<p>Commis promis dans l&#8217;article Installer Gitlab en https avec Docker et Nginx, nous allons voir comment créer des backups de Docker Gitlab et les restaurer. Attention, la source et la destination du fichier de restauration doivent avoir exactement la même &#8230; <a href="https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html">Sauvegarde et restauration de Gitlab dans Docker</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Commis promis dans l&rsquo;article <a href="https://www.php-geek.fr/installer-gitlab-docker-nginx.html">Installer Gitlab en https avec Docker et Nginx</a>, nous allons voir comment créer des backups de Docker Gitlab et les restaurer.</p>
<p>Attention, la source et la destination du fichier de restauration doivent avoir exactement la même version. Si la source à une version plus ancienne que la destination, il faut mettre à jour vers la bonne version.</p>
<p>Création d&rsquo;une sauvegarde de Gitlab:</p>
<pre class="brush:shell">
docker exec -it gitlab.example.com gitlab-rake gitlab:backup:create
</pre>
<p>Ré-import de l&rsquo;archive Gitlab:</p>
<pre class="brush:shell">
#copie de l'archive dans le dossier backup du Gitlab de destination
cp 1475786020_gitlab_backup.tar /srv/gitlab/data/backups/

#connexion au conteneur et import de l'archive
docker exec -it gitlab.example.com /bin/bash
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# Verification
gitlab-ctl status

gitlab-rake gitlab:backup:restore BACKUP=1475786020

gitlab-ctl start
gitlab-rake gitlab:check SANITIZE=true

exit
</pre>
<p>Création d&rsquo;une archive des fichiers de configuration:</p>
<pre class="brush:shell">
umask 0077;tar cfz $(date "+etc-gitlab-%s.tgz") -C / /srv/gitlab/config -P
</pre>
<p>sources:<br />
<a href="https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/backup_restore.md">https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/backup_restore.md</a><br />
<a href="https://docs.gitlab.com/omnibus/settings/backups.html">https://docs.gitlab.com/omnibus/settings/backups.html</a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html">Sauvegarde et restauration de Gitlab dans Docker</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/sauvegarde-restauration-gitlab-docker.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer Redmine en https avec Docker et Nginx</title>
		<link>https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html</link>
		<comments>https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html#respond</comments>
		<pubDate>Mon, 17 Oct 2016 23:32:49 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[docker]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=758</guid>
		<description><![CDATA[<p>Pour faire suite à l&#8217;article précédent sur Gitlab, voici comment installer Redmine avec Docker Dans ce tuto, le port 3000 du conteneur est mappé sur le ports 4432. Cela veux dire que le reverse proxy de Nginx installé sur l&#8217;host &#8230; <a href="https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html">Installer Redmine en https avec Docker et Nginx</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3><img class=" wp-image-767 aligncenter" src="https://www.php-geek.fr/wp-content/uploads/2016/10/docker-redmine.png" alt="docker-redmine" width="482" height="224" />Pour faire suite à l&rsquo;article précédent sur Gitlab, voici comment installer Redmine avec Docker</h3>
<p>Dans ce tuto, le port 3000 du conteneur est mappé sur le ports 4432.<br />
Cela veux dire que le reverse proxy de Nginx installé sur l&rsquo;host devra « écouter » sur le port 4432.</p>
<h3>1 &#8211; Configuration du conteneur Docker</h3>
<h4>1.1 &#8211; Création du conteneur</h4>
<p>Premièrement, il faut récupérer la dernière image Docker de Redmine.</p>
<pre class="brush:shell">#https://hub.docker.com/_/redmine/
docker pull redmine
</pre>
<h4>1.2 &#8211; docker-compose</h4>
<p>On créé un fichier <em>docker-compose.yml</em> avec le contenu suivant:</p>
<pre class="brush:shell">version: '2'
services:

  redmine:
    image: redmine
    container_name: 'redmine.example.com'
    volumes:
      - "/srv/redmine/files:/usr/src/redmine/files"
      - "/srv/redmine/config/configuration.yml:/usr/src/redmine/config/configuration.yml"
    ports:
      - 4432:3000
    environment:
      REDMINE_DB_MYSQL: mariadb
      REDMINE_DB_PASSWORD: password
    depends_on:
      - mariadb
    restart: always

  mariadb:
    image: mariadb
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: redmine
    restart: always
    volumes:
      - "/srv/mariadb:/var/lib/mysql"
</pre>
<p>Pour ajouter un conteneur phpmyadmin lié à mariadb ajoutez ceci au fichier docker-compose.yml</p>
<pre class="brush:shell">
  phpmyadmin:
    image: nazarpc/phpmyadmin
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: redmine
    restart: always
    ports:
      - 1234:80
    links:
      - mariadb:mysql
</pre>
<p>On peut ensuite accéder à phpmyadmin sur cette URL: http://127.0.0.1:1234</p>
<p>Lancement du conteneur</p>
<pre class="brush:shell">docker-compose up -d
</pre>
<h3>2 &#8211; Configuration SMTP</h3>
<p>Dans le fichier docker-compose.yml le fichier de configuration est monté sur /srv/redmine/config/configuration.yml .<br />
Ce fichier contient la configuration SMTP.<br />
Exemple de configuration avec Gmail:</p>
<pre class="brush:shell">  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: "true"
      address: "smtp.gmail.com"
      port: 587
      domain: "smtp.gmail.com"
      authentication: :plain
      user_name: "USER@gmail.com"
      password: "PASSWORD"
</pre>
<p>Une fois la configuration effectuée, il faut redémarrer le conteneur:</p>
<pre class="brush:shell">docker-compose stop
docker-compose up -d
</pre>
<h3>3 &#8211; Configuration du reverse proxy sur la machine host</h3>
<p>Dans ce tutoriel nous allons utiliser Nginx pour mettre en place un reverse proxy mais vous pouvez également utiliser Apache.</p>
<p>Installation de Nginx</p>
<pre class="brush:shell">apt-get install nginx
</pre>
<p>Configuration du proxy</p>
<pre class="brush:shell">cd /etc/nginx/
vim sites-available/redmine.example.com
</pre>
<p>Contenu de <em>/etc/nginx/sites-available/redmine.example.com</em></p>
<pre class="brush:shell">server {
        listen *:443 ssl http2;


	## Strong SSL Security
	## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html &amp; https://cipherli.st/
	ssl on;
	ssl_certificate /srv/redmine/ssl/redmine.example.com.crt;
	ssl_certificate_key /srv/redmine/ssl/redmine.example.com.key;

	ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
	ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers on;
	ssl_session_cache  builtin:1000  shared:SSL:10m;
	ssl_session_timeout  5m;


	server_tokens off; ## Don't show the nginx version number, a security best practice

        proxy_redirect  off;
        proxy_set_header        Host    $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto https;

        server_name  redmine.example.com;
        access_log  /var/log/redmine.example.com.access.log;
        error_log  /var/log/redmine.example.com.nginx_error.log debug;
        location / {
                proxy_pass         http://127.0.0.1:4432/;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /var/www/nginx-default;
        }
}
</pre>
<p>Pour terminer:</p>
<pre class="brush:shell">ln -s /etc/nginx/sites-available/redmine.example.com sites-enabled/redmine.example.com
/etc/init.d/nginx restart
</pre>
<h3>4 &#8211; Première connexion</h3>
<p>Rendez vous sur https://redmine.example.com/ pour la première authentification.<br />
Les accès par défaut sont admin/admin.</p>
<p>Rendez-vous sur https://redmine.example.com/settings pour configurer le hostname et le protocol https et sur https://redmine.example.com/settings?tab=authentication pour empêcher la création de compte.</p>
<p>&nbsp;</p>
<h3>BONUS: Backup/Restore</h3>
<p>Pour faire une backup de Redmine, il suffit d&rsquo;exporter la base « redmine » de mariadb et de faire une archive du dossier /srv/redmine/files qui contient les fichiers uploadés.</p>
<p>Pour exporter la base <em>redmine</em> de l&rsquo;instance mariadb:</p>
<pre class="brush:shell">
docker exec mariadb sh -c 'exec mysqldump -uroot -p"password" redmine' > /chemin/sur/host/redmine.sql
</pre>
<p>Script bash pour la création automatique d&rsquo;une archive du dossier /srv/redmine/file:</p>
<pre class="brush:shell">
#!/bin/bash

# Number of backups to keep
NBACKUPS_TO_KEEP=6

# Also keep backups of the first day of each month
KEEP_FIRST_DAY_MONTH=true

REDMINE_VOLUMES_PATH="/srv/redmine"

BACKUP_PATH="/path/to/backups"

EMAIL_DEST="admin@redmine.example.com"

EMAIL_SUBJECT="redmine.example.com - backup"

TODAY=$(date)

HOST=$(hostname)

NEWLINE_CHAR="\n"

if [ ! -d $BACKUP_PATH/files ]; then
	mkdir -p $BACKUP_PATH/files;
fi

echo "----------------"
MESSAGE_TO_SEND="----------------"

echo "$TODAY - $HOST"
MESSAGE_TO_SEND=$MESSAGE_TO_SEND"${NEWLINE_CHAR}$TODAY - $HOST"

echo "Backing up redmine into $BACKUP_PATH"
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"backing up redmine into $BACKUP_PATH"

echo "----------------"
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"----------------"
echo ""


LINE="creating /usr/src/redmine/files archive.."
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}$LINE
echo $LINE
umask 0077;tar cfz $BACKUP_PATH/files/$(date "+files-redmine-%s.tgz") -C / $REDMINE_VOLUMES_PATH/files -P
echo "done"
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"done"${NEWLINE_CHAR}

echo ""
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"Removing old backups"
echo "Removing old backups"

backups=( $( ls $BACKUP_PATH/files/ | sort -n -r -t _ -k 2 ) );
i=1;
for filename in "${backups[@]}";do

	if [ $i -gt $NBACKUPS_TO_KEEP ]
	then
		if [ $KEEP_FIRST_DAY_MONTH == true ]
		then
			day=$( date -d @$( echo $filename | sed -e "s/files-redmine-//g" | sed -e "s/.tgz//g") '+%d' )
			if [ ! $day == 01 ]
			then
				rm "$BACKUP_PATH/files/$filename"
				LINE="removed $filename"
				MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}$LINE
				echo $LINE
			else
				LINE="keeping $filename"
				MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}$LINE
				echo $LINE
			fi
			
		else
			rm "$BACKUP_PATH/files/$filename"
			LINE="removed $filename"
			MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}$LINE
			echo $LINE
		fi
	fi
	i=$[i+1]
done
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"done"
echo "done"

echo "----------------";
MESSAGE_TO_SEND=$MESSAGE_TO_SEND${NEWLINE_CHAR}"----------------"
echo -e $MESSAGE_TO_SEND | mail -s "$EMAIL_SUBJECT" $EMAIL_DEST
</pre>
<p>Pour restaurer, extraire l&rsquo;archive des fichiers dans /srv/redmine/files et importer /chemin/sur/host/redmine.sql dans l&rsquo;instance mariadb.</p>
<p>sources:<br />
<a href="http://www.redmine.org/boards/2/topics/14177" target="_blank"> http://www.redmine.org/boards/2/topics/14177</a><br />
<a href="https://github.com/docker-library/docs/tree/master/mariadb" target="_blank"> https://github.com/docker-library/docs/tree/master/mariadb</a><br />
<a href="https://hub.docker.com/r/nazarpc/phpmyadmin/" target="_blank"> https://hub.docker.com/r/nazarpc/phpmyadmin/</a><br />
<a href="http://www.redmine.org/projects/redmine/wiki/redmineinstall" target="_blank"> redmine.org/projects/redmine/wiki/redmineinstall</a></p>
<p>Pour l&rsquo;installation de docker-compose ou pour générer les certificats SSL jetez un oeil à mon précédent article: <a href="https://www.php-geek.fr/installer-gitlab-docker-nginx.html" target="_blank">Installer Gitlab en https avec Docker et Nginx</a></p>
<p>Tutoriel réalisé sous Ubuntu Xenial (16.04 LTS)</p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html">Installer Redmine en https avec Docker et Nginx</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/installer-redmine-docker-nginx-proxy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer Gitlab en https avec Docker et Nginx</title>
		<link>https://www.php-geek.fr/installer-gitlab-docker-nginx.html</link>
		<comments>https://www.php-geek.fr/installer-gitlab-docker-nginx.html#comments</comments>
		<pubDate>Wed, 12 Oct 2016 22:55:16 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=740</guid>
		<description><![CDATA[<p>Nous allons aujourd&#8217;hui utiliser la puissance de Docker pour créer une instance en https de Gitlab derrière un proxy Nginx. Dans ce tuto, les ports 443 (SSL) et 22 (SSH) du conteneur sont mappés respectivement sur les ports 4431 et &#8230; <a href="https://www.php-geek.fr/installer-gitlab-docker-nginx.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/installer-gitlab-docker-nginx.html">Installer Gitlab en https avec Docker et Nginx</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><img class="wp-image-750 aligncenter" src="https://www.php-geek.fr/wp-content/uploads/2016/10/277d9badcbd723e913b3a41e64e8d2f3d2c80598.png" alt="277d9badcbd723e913b3a41e64e8d2f3d2c80598" width="356" height="138" /></p>
<h3>Nous allons aujourd&rsquo;hui utiliser la puissance de Docker pour créer une instance en <strong>https</strong> de Gitlab derrière un proxy Nginx.</h3>
<h3><img class="wp-image-749 alignleft" src="https://www.php-geek.fr/wp-content/uploads/2016/10/docker_logo-1455828502290.png" alt="docker_logo-1455828502290" width="214" height="185" srcset="https://www.php-geek.fr/wp-content/uploads/2016/10/docker_logo-1455828502290.png 517w, https://www.php-geek.fr/wp-content/uploads/2016/10/docker_logo-1455828502290-300x258.png 300w, https://www.php-geek.fr/wp-content/uploads/2016/10/docker_logo-1455828502290-349x300.png 349w" sizes="(max-width: 214px) 100vw, 214px" /></h3>
<p>Dans ce tuto, les ports 443 (SSL) et 22 (SSH) du conteneur sont mappés respectivement sur les ports 4431 et 2201 de l&rsquo;host mais libre à vous de changer ces valeurs.<br />
Cela veux dire que le reverse proxy de Nginx installé sur l&rsquo;host devra « écouter » sur le port 4431 et que l&rsquo;url SSH de vos dépôts sera du type <em>« ssh://git@gitlab.example.com:<strong>2201</strong>/user/repo.git »</em></p>
<h3>1 &#8211; Configuration du conteneur Docker</h3>
<h4>1.1 &#8211; Création du conteneur</h4>
<p>Premièrement, il faut récupérer la dernière image Docker de Gitlab.</p>
<pre class="brush:shell">#https://hub.docker.com/r/gitlab/gitlab-ce/
docker pull gitlab/gitlab-ce
</pre>
<p>On lance ensuite le conteneur, n&rsquo;oubliez par de remplacer gitlab.example.com par votre nom de domaine.<br />
Les différents fichiers de Gitlab seronts stockés dans <em>/srv/gitlab/</em></p>
<pre class="brush:shell">docker run --detach \
    --hostname gitlab.example.com \
    --publish 4431:443 --publish 2201:22 \
    --name gitlab.example.com \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    --volume /srv/gitlab/logs/reconfigure:/var/log/gitlab/reconfigure \
    gitlab/gitlab-ce:latest
</pre>
<h4>1.2 &#8211; Configuration</h4>
<p>Configuration de Gitlab <em>/etc/gitlab/gitlab.rb</em></p>
<pre class="brush:shell">#ouverture de gitlab.rb dans le conteneur
docker exec -it gitlab.example.com vi /etc/gitlab/gitlab.rb
</pre>
<p>Dans le fichier gitlab.rb, remplacez les valeurs par défaut par les vôtres</p>
<pre class="brush:shell">#configuration de l'url de Gitlab. Notez le https.
#https://docs.gitlab.com/omnibus/docker/
external_url 'https://gitlab.example.com'

#modification du port ssh pour coller avec le mapping du conteneur
gitlab_rails['gitlab_shell_ssh_port'] = 2201

#configuration du smtp avec un compte gmail
#https://docs.gitlab.com/omnibus/settings/smtp.html
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "USERNAME@gmail.com"
gitlab_rails['smtp_password'] = "PSW_GMAIL"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = :plain
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

# on garde les backups pendant 7 jours
#https://docs.gitlab.com/ee/raketasks/backup_restore.html
gitlab_rails['backup_keep_time'] = 604800
</pre>
<p>Reconfiguration de Gitlab pour prendre en compte les changements</p>
<pre class="brush:shell">docker exec -it gitlab.example.com gitlab-ctl reconfigure
</pre>
<h4>1.3 &#8211; Alternative: docker-compose</h4>
<p>Cette configuration peut être faite bien plus simplement avec <em>docker-compose</em>.</p>
<p>Après avoir fait un <em>docker pull gitlab/gitlab-ce</em> comme vu précédemment, on créé un fichier <em>docker-compose.yml</em> avec le contenu suivant:</p>
<pre class="brush:shell">web:
  image: 'gitlab/gitlab-ce:latest'
  restart: always
  hostname: 'gitlab.example.com'
  container_name: 'gitlab.example.com'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'https://gitlab.example.com'
      gitlab_rails['gitlab_shell_ssh_port'] = 2201
      gitlab_rails['smtp_enable'] = true
      gitlab_rails['smtp_address'] = "smtp.gmail.com"
      gitlab_rails['smtp_port'] = 587
      gitlab_rails['smtp_user_name'] = "USERNAME@gmail.com"
      gitlab_rails['smtp_password'] = "PSW_GMAIL"
      gitlab_rails['smtp_domain'] = "smtp.gmail.com"
      gitlab_rails['smtp_authentication'] = :plain
      gitlab_rails['smtp_enable_starttls_auto'] = true
      gitlab_rails['smtp_tls'] = false
      gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
      gitlab_rails['backup_keep_time'] = 604800
  ports:
    - '4431:443'
    - '2201:22'
  volumes:
    - '/srv/gitlab/config:/etc/gitlab'
    - '/srv/gitlab/logs:/var/log/gitlab'
    - '/srv/gitlab/data:/var/opt/gitlab'
</pre>
<p>CF: <a href="https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/docker/docker-compose.yml" target="_blank">https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/docker/docker-compose.yml</a></p>
<p>Si docker-compose n&rsquo;est pas installé:</p>
<pre class="brush:shell">#https://docs.docker.com/compose/install/
curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` &gt; /usr/local/bin/docker-compose
</pre>
<p>Lancement du conteneur</p>
<pre class="brush:shell">docker-compose up -d
</pre>
<h3>2 &#8211; Création du certificat SSL</h3>
<p>Après avoir ouvert et redirigé le port 443 sur votre box ADSL, on peut utiliser <em>letsencrypt</em> pour générer des certificats gratuits. Attention, ces certificats ne sont valides que 90 jours, il faut penser à les renouveler.</p>
<pre class="brush:shell">#https://certbot.eff.org/#ubuntuxenial-other
apt-get install letsencrypt 
letsencrypt certonly --standalone -d gitlab.example.com
</pre>
<p>Copie des certificats dans le dossier config de Gitlab</p>
<pre class="brush:shell">cd /etc/letsencrypt/live/gitlab.example.com/
mkdir -p /srv/gitlab/config/ssl
chmod 700 /srv/gitlab/config/ssl
cp privkey.pem /srv/gitlab/config/ssl/gitlab.example.com.key
cp cert.pem /srv/gitlab/config/ssl/gitlab.example.com.crt
</pre>
<p>Reconfiguration de Gitlab pour prendre en compte les changements</p>
<pre class="brush:shell">docker exec -it gitlab.example.com gitlab-ctl reconfigure
</pre>
<h3>3 &#8211; Configuration du reverse proxy sur la machine host</h3>
<p>Dans ce tutoriel nous allons utiliser Nginx pour mettre en place un reverse proxy mais vous pouvez également utiliser Apache.</p>
<p>Installation de Nginx</p>
<pre class="brush:shell">apt-get install nginx
</pre>
<p>Configuration du proxy</p>
<pre class="brush:shell">cd /etc/nginx/
vim sites-available/gitlab.example.com
</pre>
<p>Contenu de <em>/etc/nginx/sites-available/gitlab.example.com</em></p>
<pre class="brush:shell">## Redirects all HTTP traffic to the HTTPS host
server {
	listen 0.0.0.0:80;
	listen [::]:80 ipv6only=on;
	server_name gitlab.example.com; 
	server_tokens off;
	return 301 https://$http_host$request_uri;

	access_log  /var/log/gitlab.example.com80.access.log;
	error_log  /var/log/gitlab.example.com80.nginx_error.log debug;
}

server {
        listen *:443 ssl http2;

	ssl on;
	ssl_certificate /srv/gitlab/config/ssl/gitlab.example.com.crt;
	ssl_certificate_key /srv/gitlab/config/ssl/gitlab.example.com.key;

	ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
	ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
	ssl_prefer_server_ciphers on;
	ssl_session_cache  builtin:1000  shared:SSL:10m;
	ssl_session_timeout  5m;

	server_tokens off;

        server_name  gitlab.example.com;
        access_log  /var/log/gitlab.example.com.access.log;
        error_log  /var/log/gitlab.example.com.nginx_error.log debug;
        location / {
                proxy_pass         https://127.0.0.1:4431/;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   /var/www/nginx-default;
        }
}
</pre>
<p>Pour terminer:</p>
<pre class="brush:shell">ln -s /etc/nginx/sites-available/gitlab.example.com sites-enabled/giltab.example.com
/etc/init.d/nginx restart
</pre>
<h3>4 &#8211; Première connexion</h3>
<p>Rendez vous sur https://gitlab.example.com/ pour la première authentification.<br />
Saisissez deux fois un mot de passe que vous choisissez et connecter vous avec l&rsquo;utilisateur root et ce mot de passe.</p>
<p>Pour empêcher la création de compte allez sur: https://gitlab.example.com/admin/application_settings</p>
<h3>5 &#8211; Mise à jour de l&rsquo;image</h3>
<p>Avec docker-compose, il suffit de lancer les commande suivantes:</p>
<pre class="brush:shell">docker-compose pull 
docker-compose up
</pre>
<p>Dans un prochain article, j&rsquo;aborderai comment créer des backups et les restaurer.</p>
<p>Tutoriel réalisé sous Ubuntu Xenial (16.04 LTS)</p>
<p>sources:<br />
<a href="https://docs.gitlab.com/omnibus/docker/">https://docs.gitlab.com/omnibus/docker/</a><br />
<a href="https://forum.gitlab.com/t/nginx-as-reverse-proxy-for-gitlab-with-ssl/1641">https://forum.gitlab.com/t/nginx-as-reverse-proxy-for-gitlab-with-ssl/1641</a><br />
<a href="https://docs.gitlab.com/omnibus/settings/nginx.html">https://docs.gitlab.com/omnibus/settings/nginx.html</a><br />
<a href="https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/web-server/nginx/gitlab-omnibus-ssl-nginx.conf">https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/web-server/nginx/gitlab-omnibus-ssl-nginx.conf</a><br />
<a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/1331">ttps://gitlab.com/gitlab-org/gitlab-ce/issues/1331</a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/installer-gitlab-docker-nginx.html">Installer Gitlab en https avec Docker et Nginx</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/installer-gitlab-docker-nginx.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL: afficher la liste des bases de données qui ressemblent à un certain modèle</title>
		<link>https://www.php-geek.fr/mysql-show-databases-like.html</link>
		<comments>https://www.php-geek.fr/mysql-show-databases-like.html#respond</comments>
		<pubDate>Mon, 12 Sep 2016 22:49:26 +0000</pubDate>
		<dc:creator><![CDATA[phpgeekfr]]></dc:creator>
				<category><![CDATA[Astuces]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=734</guid>
		<description><![CDATA[<p>Commande pour récupérer la liste des bases de données qui commencent par &#171;&#160;mon_prefix_&#160;&#187; et la sauvegarder dans un fichier: mysql -h localhost -u root -p -e "SHOW DATABASES LIKE 'mon_prefix_%';" &#62; ~/databases-list</p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/mysql-show-databases-like.html">MySQL: afficher la liste des bases de données qui ressemblent à un certain modèle</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Commande pour récupérer la liste des bases de données qui commencent par &laquo;&nbsp;mon_prefix_&nbsp;&raquo; et la sauvegarder dans un fichier:</p>
<pre class="brush:shell">mysql -h localhost -u root -p -e "SHOW DATABASES LIKE 'mon_prefix_%';" &gt; ~/databases-list</pre>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/mysql-show-databases-like.html">MySQL: afficher la liste des bases de données qui ressemblent à un certain modèle</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/mysql-show-databases-like.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux/Debian: bannir/dé-bannir une adresse IP</title>
		<link>https://www.php-geek.fr/linux-bannir-adresse-ip.html</link>
		<comments>https://www.php-geek.fr/linux-bannir-adresse-ip.html#respond</comments>
		<pubDate>Tue, 09 Aug 2016 10:10:23 +0000</pubDate>
		<dc:creator><![CDATA[phpgeekfr]]></dc:creator>
				<category><![CDATA[Non classé]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=717</guid>
		<description><![CDATA[<p>Bannir une IP iptables -A INPUT -s AA.BB.CC.DD -j DROP Dé-bannir une IP iptables -D INPUT -s AA.BB.CC.DD -j DROP Liste des adresses bannies: iptables -L INPUT -v -n</p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/linux-bannir-adresse-ip.html">Linux/Debian: bannir/dé-bannir une adresse IP</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Bannir une IP</p>
<pre class="brush:shell">
iptables -A INPUT -s AA.BB.CC.DD -j DROP
</pre>
<p>Dé-bannir une IP</p>
<pre class="brush:shell">
iptables -D INPUT -s AA.BB.CC.DD -j DROP
</pre>
<p>Liste des adresses bannies:</p>
<pre class="brush:shell">
iptables -L INPUT -v -n
</pre>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/linux-bannir-adresse-ip.html">Linux/Debian: bannir/dé-bannir une adresse IP</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/linux-bannir-adresse-ip.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T411 &#8211; comment contourner le blocage DNS avec le fichier hosts</title>
		<link>https://www.php-geek.fr/t411-contourner-blocage-dns.html</link>
		<comments>https://www.php-geek.fr/t411-contourner-blocage-dns.html#comments</comments>
		<pubDate>Wed, 19 Aug 2015 19:05:10 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Astuces]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=688</guid>
		<description><![CDATA[<p>Si comme moi vous utilisez T411 pour télécharger des fichiers, légaux bien sur (et oui il y en a) mais que votre fournisseur d&#8217;accès à fait un blocage DNS des domaines t411.io ou/et t411.me, voici comment le contourner rapidement en &#8230; <a href="https://www.php-geek.fr/t411-contourner-blocage-dns.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/t411-contourner-blocage-dns.html">T411 &#8211; comment contourner le blocage DNS avec le fichier hosts</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;"><a href="https://www.php-geek.fr/wp-content/uploads/2015/08/t411.png"><img class=" wp-image-690 alignright" src="https://www.php-geek.fr/wp-content/uploads/2015/08/t411.png" alt="t411" width="164" height="124" srcset="https://www.php-geek.fr/wp-content/uploads/2015/08/t411.png 400w, https://www.php-geek.fr/wp-content/uploads/2015/08/t411-300x225.png 300w" sizes="(max-width: 164px) 100vw, 164px" /></a>Si comme moi vous utilisez T411 pour télécharger des fichiers, légaux bien sur (et oui il y en a) mais que votre fournisseur d&rsquo;accès à fait un blocage DNS des domaines t411.io ou/et t411.me, voici comment le contourner rapidement en utilisant le fichier hosts.</p>
<p style="text-align: justify;">Premièrement il faut récupérer l&rsquo;IP du serveur ou est hébergé T411. On peut pour cela utiliser un service web de « ping » comme <a href="https://cloudmonitor.ca.com/en/ping.php">https://cloudmonitor.ca.com/en/ping.php</a></p>
<p>Avec ce service, on voit que T411 est hébergé sur deux IP différentes:</p>
<pre class="brush:shell">108.162.204.254
108.162.203.254</pre>
<p>Il suffit alors d&rsquo;en prendre une au hasard et d&rsquo;ajouter ce qui suit dans votre fichier hosts.<br />
Sous Ubuntu, le fichier est localisé dans <em>/etc/hosts</em></p>
<pre class="brush:shell">108.162.203.254 www.t411.io 
108.162.203.254 t411.io
108.162.203.254 www.t411.me
108.162.203.254 t411.me
108.162.203.254 forum.t411.io
108.162.203.254 forum.t411.me
108.162.203.254 tracker.t411.me
108.162.203.254 tracker.t411.io
</pre>
<p>Et voilà !</p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/t411-contourner-blocage-dns.html">T411 &#8211; comment contourner le blocage DNS avec le fichier hosts</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/t411-contourner-blocage-dns.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend: regler le timeout des connexions MySQL avec pdo_mysql</title>
		<link>https://www.php-geek.fr/zend-timeout-pdo_mysql.html</link>
		<comments>https://www.php-geek.fr/zend-timeout-pdo_mysql.html#respond</comments>
		<pubDate>Wed, 25 Feb 2015 22:50:34 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Astuces]]></category>
		<category><![CDATA[Développement]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=665</guid>
		<description><![CDATA[<p>Il peut parfois être utile d&#8217;augmenter ou de baisser la durée de timeout des connexions MySQL. Par exemple, il peut être intéressant de l&#8217;augmenter si certaines de vos requêtes MySQL n&#8217;aboutissent pas et si vous obtenez l&#8217;erreur &#171;&#160;MySQL server went &#8230; <a href="https://www.php-geek.fr/zend-timeout-pdo_mysql.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/zend-timeout-pdo_mysql.html">Zend: regler le timeout des connexions MySQL avec pdo_mysql</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-670" src="https://www.php-geek.fr/wp-content/uploads/2015/02/11.jpg" alt="11" width="189" height="137" />Il peut parfois être utile d&rsquo;augmenter ou de baisser la durée de timeout des connexions MySQL. Par exemple, il peut être intéressant de l&rsquo;augmenter si certaines de vos requêtes MySQL n&rsquo;aboutissent pas et si vous obtenez l&rsquo;erreur &laquo;&nbsp;MySQL server went away&nbsp;&raquo;.</p>
<p>Ce réglage se fait en passant l&rsquo;option <em>PDO::ATTR_TIMEOUT</em> (constante de la classe PDO qui vaut 2) au driver pdo_mysql. Cette option marchera aussi pour certains autres pilotes mais sa signification peut différer (avec sqlite par exemple).</p>
<p>Avec Zend, il faut définir cette option lors de la création de l&rsquo;adapter soit en utilisant <em>Zend_Db::factory</em> soit en créant une nouvelle instance de <em>Zend_Db_Adapter_Pdo_Mysql</em>.</p>
<p>Exemple avec un timeout de 10 secondes en utilisant <em>Zend_Db::factory</em>:</p>
<pre class="brush:php">
      $driverOptions = array(
          PDO::ATTR_TIMEOUT =&gt; 10
      );

      $params = array(
        'host' =&gt; '127.0.0.1',
        'port' =&gt; '3306',
        'username' =&gt; 'user',
        'password' =&gt; 'password',
        'dbname' =&gt; 'my_db',
        'driver_options' =&gt; $driverOptions
      );
      $adapter = Zend_Db::factory('pdo_mysql', $params);

</pre>
<p>sources/docs:<br />
<a href="http://php.net/manual/fr/pdo.setattribute.php" target="_blank&quot;">PDO::setAttribute</a><br />
<a href="http://framework.zend.com/manual/1.12/fr/zend.db.adapter.html" target="_blank&quot;">documentation Zend_Db_Adapter</a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/zend-timeout-pdo_mysql.html">Zend: regler le timeout des connexions MySQL avec pdo_mysql</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/zend-timeout-pdo_mysql.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1script.fr : une plateforme française pour les développeurs</title>
		<link>https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html</link>
		<comments>https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html#respond</comments>
		<pubDate>Mon, 01 Sep 2014 19:28:05 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Outils]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=636</guid>
		<description><![CDATA[<p>1script.fr est une plateforme communautaire française pour les développeurs qui souhaitent partager ou vendre leur code. L&#8217;objectif principal est de mettre en relation développeurs et acheteurs potentiels. Le projet n&#8217;est pas encore achevé mais une bêta-test est disponible et le résultat &#8230; <a href="https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html">1script.fr : une plateforme française pour les développeurs</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;"><strong><img class="alignleft size-full wp-image-639" src="https://www.php-geek.fr/wp-content/uploads/2014/09/logo_1script.jpg" alt="logo_1script" width="354" height="100" srcset="https://www.php-geek.fr/wp-content/uploads/2014/09/logo_1script.jpg 354w, https://www.php-geek.fr/wp-content/uploads/2014/09/logo_1script-300x84.jpg 300w" sizes="(max-width: 354px) 100vw, 354px" />1script.fr</strong> est une plateforme communautaire <strong>française</strong> pour les développeurs qui souhaitent partager ou vendre leur code. L&rsquo;objectif principal est de mettre en relation développeurs et acheteurs potentiels. Le projet n&rsquo;est pas encore achevé mais une bêta-test est disponible et le résultat risque d&rsquo;être prometteur!</p>
<p style="text-align: justify;">La plateforme permet de partager ou vendre un script de manière simplifiée et propose une large choix de langages et de catégories. Une section CV est également disponible pour se mettre en avant.</p>
<p style="text-align: justify;">Pour les intéressés je vous invite à visiter la bêta-test sur <a href="http://1script.fr" target="_blank">1script.fr</a>  en utilisant une clé si dessous:</p>
<pre class="brush:shell">b3a19b6f1498b90e05781778874dd8d6f2211a61
6aa9badac2ca4b68c095568763fb2d065fc2b0b7
8712e0f3fb29fc9d2416a0564471e9f9365fcada
fcac0af3fe6d8a953562997b85a8ba6fb7d6aaf6
c1e3d2cbe45a77de96ed55f96fabda62f52f69e6
0eee120ab864cfce232bbfee50f3a45a1f24c5b8
42a66039d8b7d99bcc3e0714911a150b832009be
c9f3841cc868d201cdcb41d5c4c0c0c34e19af4b
a41ba8b9756495db7d4712f6ac8233503bfb5fe8
759e59104e3068065a1e3417a28307d93bb19185
</pre>
<p style="text-align: justify;">Attention chaque clé est à usage unique.</p>
<h3 style="text-align: justify;">Vidéo explicative<br />
<iframe src="//www.youtube.com/embed/CI0CuoSYqFk" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe></h3>
<h3 style="text-align: justify;">Liens utiles</h3>
<ul>
<li style="text-align: justify;">Le site: <a href="http://1script.fr">http://www.1script.fr/</a></li>
<li style="text-align: justify;">Facebook: <a href="https://www.facebook.com/1script.fr">https://www.facebook.com/1script.fr</a></li>
<li style="text-align: justify;">Twitter: <a href="https://twitter.com/1scriptfr">https://twitter.com/1scriptfr</a></li>
</ul>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html">1script.fr : une plateforme française pour les développeurs</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/1script-fr-plateforme-francaise-pour-developpeurs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiler et encapsuler Twitter Bootstrap dans un namespace</title>
		<link>https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html</link>
		<comments>https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html#respond</comments>
		<pubDate>Tue, 08 Jul 2014 18:11:03 +0000</pubDate>
		<dc:creator><![CDATA[phpgeekfr]]></dc:creator>
				<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=502</guid>
		<description><![CDATA[<p>Il peut parfois être utile d&#8217;encapsuler le CSS de Twitter Bootstrap pour par exemple éviter les conflits lorsque l&#8217;ont intègre Bootstrap dans un site existant. Cette opération permet en effet d&#8217;ajouter un namespace à tous les sélecteurs. Exemple avec le &#8230; <a href="https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html">Compiler et encapsuler Twitter Bootstrap dans un namespace</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><a href="https://www.php-geek.fr/wp-content/uploads/2014/07/grunt-logo.png"><img class=" wp-image-630 alignleft" alt="grunt-logo" src="https://www.php-geek.fr/wp-content/uploads/2014/07/grunt-logo.png" width="99" height="114" /></a>Il peut parfois être utile d&rsquo;encapsuler le CSS de Twitter Bootstrap pour par exemple éviter les conflits lorsque l&rsquo;ont intègre Bootstrap dans un site existant. Cette opération permet en effet d&rsquo;ajouter un namespace à tous les sélecteurs.</p>
<p>Exemple avec le namespace « bootstrap-styles »:</p>
<pre class="brush:css">.bootstrap-styles textarea {
overflow: auto;
}
.bootstrap-styles optgroup {
font-weight: bold;
}</pre>
<p>Pour encapsuler bootstrap, il faut compiler le fichier bootstrap.less à l&rsquo;aide de Grunt.</p>
<h3>Installation de Grunt</h3>
<h4>Installation de Node.js</h4>
<pre class="brush:shell">sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs</pre>
<h4>Installation de Git</h4>
<pre class="brush:shell">sudo  apt-get install git git-core</pre>
<h4>Clonage de bootstrap depuis github</h4>
<pre class="brush:shell">git clone https://github.com/twbs/bootstrap.git</pre>
<h4>Installation de Grunt</h4>
<pre class="brush:shell">sudo npm install -g grunt-cli
cd bootstrap
sudo npm install</pre>
<h4>Compilation</h4>
<p>Editer le fichier bootstrap.less pour ajouter la classe <em>bootstrap-styles</em> autour de tous les imports:</p>
<pre class="brush:shell">cd less/
vim bootstrap.less</pre>
<p>contenu de <em>bootstrap.less</em></p>
<pre class="brush:shell">.bootstrap-styles {
// Core variables and mixins
@import "variables.less";
@import "mixins.less";

[...]
// Utility classes
@import "utilities.less";
@import "responsive-utilities.less";
}</pre>
<p>Pour compiler le CSS et le Javascript:</p>
<pre class="brush:shell">grunt dist</pre>
<p>Les fichiers compilés se trouveront ensuite dans le dossier <em>dist</em>.</p>
<p>Attention, même les sélecteurs <em>html</em> et <em>body</em> seront préfixés de .bootstrap-styles. Étant donné que les balises <em>html</em> et <em>body</em> sont rarement entourées de balises <em>div</em> dans le code source d&rsquo;une page web, il faut donc supprimer ou modifier ces deux entrées dans le fichier <em>bootstrap.css</em></p>
<p>Testé sous Ubuntu 14.04 serveur</p>
<p>sources:</p>
<ul>
<li><a href="http://doc.ubuntu-fr.org/nodejs"> http://doc.ubuntu-fr.org/nodejs</a></li>
<li><a href="https://github.com/twbs/bootstrap/blob/master/README.md"> https://github.com/twbs/bootstrap/blob/master/README.md</a></li>
<li><a href="http://getbootstrap.com/getting-started/"> http://getbootstrap.com/getting-started/</a></li>
<li><a href="http://stackoverflow.com/questions/13966259/how-to-namespace-twitter-bootstrap-so-styles-dont-conflict">http://stackoverflow.com/questions/13966259/how-to-namespace-twitter-bootstrap-so-styles-dont-conflict</a></li>
</ul>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html">Compiler et encapsuler Twitter Bootstrap dans un namespace</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/compiler-encapsuler-bootstrap-css.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: permettre aux administrateurs d&#8217;ajouter du JavaScript dans un widget ou article</title>
		<link>https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html</link>
		<comments>https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html#respond</comments>
		<pubDate>Wed, 25 Jun 2014 18:15:16 +0000</pubDate>
		<dc:creator><![CDATA[Bruce]]></dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.php-geek.fr/?p=611</guid>
		<description><![CDATA[<p>Si WordPress est installé en mode « network » ou « multisite », les administrateurs n&#8217;ont pas le droit de mettre ce qu&#8217;ils veulent (du JavaScript par exemple) dans les articles, pages, commentaires ou widgets texte. Seuls les administrateurs du réseau ont cette capacité. &#8230; <a href="https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html">Lire la suite <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html">WordPress: permettre aux administrateurs d&rsquo;ajouter du JavaScript dans un widget ou article</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;">Si WordPress est installé en mode « network » ou « multisite », les administrateurs n&rsquo;ont pas le droit de mettre ce qu&rsquo;ils veulent (du JavaScript par exemple) dans les articles, pages, commentaires ou widgets texte. Seuls les administrateurs du réseau ont cette capacité.</p>
<p style="text-align: justify;">Dans la doc officielle de WP il est précisé que pour autoriser les utilisateurs à poster des marqueurs HTML ou du JavaScript il faut que le rôle auquel ils sont associés ait la capacité « unfiltered_html ».</p>
<p style="text-align: justify;">Cependant si l&rsquo;ont fait un test en ajoutant ce bout de code dans le fichier functions.php du thème:</p>
<pre class="brush:php">$role = get_role( 'administrator' );//récupération du rôle "administrator"
$role-&gt;add_cap( 'unfiltered_html' ); //ajout de la capacité "unfiltered_html"</pre>
<p>on se rend compte que cela ne fonctionne pas..</p>
<p style="text-align: justify;">En fouillant un peu pour résoudre mon problème j&rsquo;ai trouvé ce plugin: <a href="https://github.com/rdonovan/WP-Admin-Unfiltered-HTML">WP-Admin-Unfiltered-HTML</a> qui fonctionne très bien.</p>
<p style="text-align: justify;">Attention cependant à ne donner cette capacité qu&rsquo;à une personne de confiance <img src="https://s.w.org/images/core/emoji/2.3/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>source: <a href="http://codex.wordpress.org/fr:R%C3%B4les_et_Capacit%C3%A9s#unfiltered_html">Documentation WP</a></p>
<p>The post <a rel="nofollow" href="https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html">WordPress: permettre aux administrateurs d&rsquo;ajouter du JavaScript dans un widget ou article</a> appeared first on <a rel="nofollow" href="https://www.php-geek.fr">www.php-geek.fr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.php-geek.fr/wordpress-ajouter-javascript-dans-widget-ou-article.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>