<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://de.contaowiki.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
		<id>https://de.contaowiki.org/index.php?action=history&amp;feed=atom&amp;title=Backups_mit_Git</id>
		<title>Backups mit Git - Versionsgeschichte</title>
		<link rel="self" type="application/atom+xml" href="https://de.contaowiki.org/index.php?action=history&amp;feed=atom&amp;title=Backups_mit_Git"/>
		<link rel="alternate" type="text/html" href="https://de.contaowiki.org/index.php?title=Backups_mit_Git&amp;action=history"/>
		<updated>2026-04-30T13:43:18Z</updated>
		<subtitle>Versionsgeschichte dieser Seite in Contao Community Documentation</subtitle>
		<generator>MediaWiki 1.22.6</generator>

	<entry>
		<id>https://de.contaowiki.org/index.php?title=Backups_mit_Git&amp;diff=7323&amp;oldid=prev</id>
		<title>Lindesbs: /* Grundlagen */</title>
		<link rel="alternate" type="text/html" href="https://de.contaowiki.org/index.php?title=Backups_mit_Git&amp;diff=7323&amp;oldid=prev"/>
				<updated>2013-05-24T16:46:07Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Grundlagen&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Version vom 24. Mai 2013, 16:46 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 8:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 8:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Der Zugriff auf die MySQL Datenbank erfolgt hierbei Passwortlos, d.h. es muss bei der Eingabe der Befehle mysqldump und mysql kein Passwort angegeben werden. Dies wurde durch entsprechende Konfiguration der $HOME/.my.cnf bewerkstelligt.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Der Zugriff auf die MySQL Datenbank erfolgt hierbei Passwortlos, d.h. es muss bei der Eingabe der Befehle mysqldump und mysql kein Passwort angegeben werden. Dies wurde durch entsprechende Konfiguration der $HOME/.my.cnf bewerkstelligt.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Backupverzeichnis : $HOME/backup/contao_1&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;Backupverzeichnis : $HOME/backup/contao_1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Contao Verzeichnis : /var/www/contao_1/html&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;Contao Verzeichnis : /var/www/contao_1/html&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Datenbank Name : DB_NAME&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;Datenbank Name : DB_NAME&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lindesbs</name></author>	</entry>

	<entry>
		<id>https://de.contaowiki.org/index.php?title=Backups_mit_Git&amp;diff=7322&amp;oldid=prev</id>
		<title>Lindesbs: Die Seite wurde neu angelegt: „{{stub}}  Category:Sonstiges  =Grundlagen=  Backup einer Webpraesenz mittels GIT. Hierbei ist das Repository ausserhalb des Webpfades. Der Zugriff auf die MyS…“</title>
		<link rel="alternate" type="text/html" href="https://de.contaowiki.org/index.php?title=Backups_mit_Git&amp;diff=7322&amp;oldid=prev"/>
				<updated>2013-05-24T16:43:56Z</updated>
		
		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „{{stub}}  &lt;a href=&quot;/Kategorie:Sonstiges&quot; title=&quot;Kategorie:Sonstiges&quot;&gt;Category:Sonstiges&lt;/a&gt;  =Grundlagen=  Backup einer Webpraesenz mittels GIT. Hierbei ist das Repository ausserhalb des Webpfades. Der Zugriff auf die MyS…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Sonstiges]]&lt;br /&gt;
&lt;br /&gt;
=Grundlagen=&lt;br /&gt;
&lt;br /&gt;
Backup einer Webpraesenz mittels GIT. Hierbei ist das Repository ausserhalb des Webpfades.&lt;br /&gt;
Der Zugriff auf die MySQL Datenbank erfolgt hierbei Passwortlos, d.h. es muss bei der Eingabe der Befehle mysqldump und mysql kein Passwort angegeben werden. Dies wurde durch entsprechende Konfiguration der $HOME/.my.cnf bewerkstelligt.&lt;br /&gt;
&lt;br /&gt;
Backupverzeichnis : $HOME/backup/contao_1&lt;br /&gt;
Contao Verzeichnis : /var/www/contao_1/html&lt;br /&gt;
Datenbank Name : DB_NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Erstellen des Backupverzeichnisses==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd $HOME/backup/contao_1&lt;br /&gt;
git init --bare&lt;br /&gt;
git config core.worktree /var/www/contao_1/html&lt;br /&gt;
git config core.bare false&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in das Verzeicnis $HOME/backup/contao_1 wechseln und eine Datei &amp;quot;makeBackup.sh&amp;quot; erstellen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
TAGNAME=$(date &amp;quot;+%Y%m%d_%H%M&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;DATABASE Dump&amp;quot;&lt;br /&gt;
mysqldump DB_NAME &amp;gt; /var/www/contao_1/html/database.sql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
git add .&lt;br /&gt;
git commit -m $TAGNAME&lt;br /&gt;
&lt;br /&gt;
rm /var/www/contao_1/html/database.sql&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
diese Datei ausfuehrbar machen :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
chmod +x makeBackup.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Erstellen eines Backups=&lt;br /&gt;
&lt;br /&gt;
in das Backupverzeichnis wechseln und die makeBackup.sh aufrufen.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd $HOME/backup/contao_1&lt;br /&gt;
./makeBackup.sh&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Danach wird die DB erstellt, alles in GIT versioniert, und final die database.sql wieder geloescht.&lt;br /&gt;
Dies kann auch mittels cron automatisiert werden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Restore eines Backups=&lt;br /&gt;
Anzeigen der vorhandenen Sicherungen :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$&amp;gt; git log --oneline&lt;br /&gt;
&lt;br /&gt;
1628ed4 20130524_1645&lt;br /&gt;
3405409 20130524_1630&lt;br /&gt;
ad83395 20130524_1615&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
bzw.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 git log --oneline | grep 1615&lt;br /&gt;
&lt;br /&gt;
ad83395 20130524_1615&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
D.h. der Commit ist ad83395&lt;br /&gt;
und kann mit&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git checkout -f ad83395&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
wiederhergestellt werden. Danach nur noch die database.sql manuell wiederherstellen.&lt;br /&gt;
Oder via Hook. Hierzu im Verzeichnis hooks die Datei post-checkout erstellen mit diesem Inhalt :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;restore database&amp;quot;&lt;br /&gt;
mysql DB_NAME &amp;lt; /var/www/contao_1/html/database.sql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
rm /var/www/contao_1/html/database.sql&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{msgQuestion|Ein &amp;quot;Loeschen&amp;quot; von alten Sicherungen ist nicht moeglich}}&lt;/div&gt;</summary>
		<author><name>Lindesbs</name></author>	</entry>

	</feed>