{"id":33,"date":"2012-05-26T00:47:07","date_gmt":"2012-05-25T15:47:07","guid":{"rendered":"http:\/\/litcoder.cafe24.com\/?p=33"},"modified":"2012-05-26T00:47:07","modified_gmt":"2012-05-25T15:47:07","slug":"repo-mirroring-2","status":"publish","type":"post","link":"https:\/\/litcoder.com\/?p=33","title":{"rendered":"Repo mirroring"},"content":{"rendered":"<blockquote><p>\ud55c\uad6d\uacfc \ubbf8\uad6d \ucc98\ub7fc \uac70\ub9ac\uc0c1\uc73c\ub85c \uba40\ub9ac \ub5a8\uc5b4\uc838 \uc788\ub294 \uacbd\uc6b0, \ud55c\ucabd\uc5d0\uc11c source\ub97c sync\ud558\uae30 \uc704\ud574\uc11c\ub294 \uc2dc\uac04\uc774 \ub108\ubb34 \ub9ce\uc774 \uac78\ub9b0\ub2e4. Mirror\ub97c \uc124\uc815\ud558\uace0 \uc8fc\uae30\uc801\uc73c\ub85c source\ub97c sync \ud574 \uc624\ub3c4\ub85d \ud558\uba74 \uc2dc\uac04\uacfc load\ub97c \uc904\uc77c \uc218 \uc788\ub2e4. \ub2e4\uc74c\uc740 Ubuntu 10.04 LTS \uae30\uc900\uc73c\ub85c\ud55c repo mirror server \uc124\uc815\ubc29\ubc95\uc5d0 \ub300\ud574 \uc124\uba85\ud55c\ub2e4.<\/p><\/blockquote>\n<p>1. Git daemon \uc124\uc815<br \/>\n: xinetd\ub97c \uc124\uce58\ud558\uace0 git-daemon\uc744 \uc124\uc815\ud55c\ub2e4.<\/p>\n<pre class=\"theme:neon toolbar:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt; sudo apt-get install xinetd<\/pre>\n<pre class=\"toolbar:2 show-lang:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt;sudo vi \/etc\/xinetd.d\/git-daemon\n\nservice git\n{\n        disable = no\n        type            = UNLISTED\n        port            = 9418\n        socket_type     = stream\n        wait            = no\n        user            = nobody\n        server          = \/usr\/bin\/git\n        server_args     = daemon --inetd --export-all --base-path=\/public\/gitmirrors\/\n        log_on_failure  += USERID\n}<\/pre>\n<pre class=\"theme:neon toolbar:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt; sudo \/etc\/init.d\/xinetd restart\n\ud639\uc740\n$&gt; sudo service xinetd restart<\/pre>\n<p>&nbsp;<\/p>\n<p>2. Mirror repository \ub9cc\ub4e4\uae30<br \/>\n: \uc678\ubd80\uc5d0\uc11c \uc811\uadfc\ud560 \uacf5\uac04\uc744 \uc0dd\uc131\ud558\uace0 mirror\ub97c \ub9cc\ub4e0\ub2e4.<\/p>\n<pre class=\"theme:neon toolbar:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt;sudo mkdir -p \/public\/gitmirrors\/\n$&gt;chmod 777 \/public\/gitmirrors\/\n$&gt;mkdir \/public\/gitmirrors\/PROJECT_TOP_DIR\n$&gt;cd  \/public\/gitmirrors\/PROJECT_TOP_DIR\n$&gt;repo init -u ssh:\/\/USER_ID@SERVER_ADDRESS_AND_PORT\/platform\/manifest.git -b &lt;BRANCH_NAME&gt; --mirror\n$&gt;repo sync<\/pre>\n<p>&nbsp;<\/p>\n<p>3. Fetching address \ubcc0\uacbd<br \/>\n: manifest.git\uc744 \ubcc0\uacbd\uc2dc\ucf1c\uc11c \uc0c8\ub85c\uc6b4 branch\ub85c server\uc5d0 push \ud55c\ub2e4.<\/p>\n<p>\uba3c\uc800 manifest.git\uc744 cloning \ud574\uc624\uc790<\/p>\n<pre class=\"theme:neon toolbar:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt; mkdir ~\/temp\/manifest\n$&gt; cd ~\/temp\/manifest\n$&gt; git clone \/public\/gitmirrors\/PROJECT_TOP_DIR\/platform\/manifest.git<\/pre>\n<p>default.xml\uc758 fetch address\ub97c \ubcc0\uacbd\ud574\uc11c mirror\uc5d0\uc11c \ubc1b\uc544\uc624\ub3c4\ub85d \uc218\uc815\ud55c\ub2e4.<\/p>\n<pre class=\"toolbar:2 show-plain:3 lang:default decode:true\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;manifest&gt;\n  &lt;remote name=REMOTE_NAME fetch=\"git:\/\/MIRROR_SERVER_ADDR\/PROJECT_TOP_DIR\" review=REVIEW_SITE_ADDR \/&gt;\n\n...<\/pre>\n<p>\uc218\uc815\ub41c default.xml\uc744 \uc0c8\ub85c\uc6b4 branch\uc5d0 push \ud55c\ub2e4.<\/p>\n<pre class=\"theme:neon toolbar:2 nums:false lang:default highlight:0 decode:true\">$&gt;git checkout -b  MIRROR_BRANCH_NAME\n$&gt;git add .\n$&gt;git commit -m \"Updated fetch URL to mirror\"\n$&gt;git push origin MIRROR_BRANCH_NAME<\/pre>\n<p>&nbsp;<\/p>\n<p>4. Client\uc5d0\uc11c mirror\ub85c \ubd80\ud130 source sync \ud558\uae30<\/p>\n<p>repo init\ud560\ub54c mirror branch\ub97c \uba85\uc2dc\ud55c\ub2e4.<\/p>\n<pre class=\"theme:neon toolbar:2 nums:false show-plain:3 lang:default highlight:0 decode:true\">$&gt; repo init -u git:\/\/MIRROR_SERVER_ADDR\/PROJECT_TOP_DIR\/platform\/manifest.git -b MIRROR_BRANCH_NAME\n$&gt; repo sync<\/pre>\n<p>&nbsp;<\/p>\n<p>5.\u00a0\uc8fc\uae30\uc801\uc778 sync\ub97c \uc704\ud55c crontab\uacfc sync script \uc791\uc131<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">$&gt; crontab -e\n# m h  dom mon dow   command\n\n# \ub9e4\uc2dc 00\ubd84 \ub9c8\ub2e4 repo sync\ub97c \uc218\ud589\n0 * * * * ~\/bin\/cron_repo_sync.sh<\/pre>\n<p>repo sync script<br \/>\n: \ud638\ucd9c\ub420 \ub54c\ub9c8\ub2e4 mirror directory\uc5d0 \uc788\ub294 \ub0b4\uc6a9\ub4e4\uc744 \ubcf8\uad6d\uc5d0\uc11c \uc1a1\ud658\ud574 \uc628\ub2e4.<\/p>\n<pre class=\"toolbar:0 lang:sh decode:true crayon-selected\">#!\/bin\/bash\n# cron repo sync script.\n# Syncs all mirrors under the PUBLIC_REPO_DIRS_ROOT. - skywriter\n\nPUBLIC_REPO_DIRS_ROOT=\"\/public\/gitmirrors\/\"\nREPO_PATH=\"\/usr\/local\/bin\/repo\"\n\nsync_cmd=\"$REPO_PATH sync -j20\"\nrepodirs=`ls ${PUBLIC_REPO_DIRS_ROOT}`\n\necho \"start syncing\"\nfor repodir in $repodirs\ndo\n  echo \"syncing [$repodir] at `date`\"\n  cd ${PUBLIC_REPO_DIRS_ROOT}$repodir\/\n  $sync_cmd 2&gt;&amp;1\ndone\necho \"done at `date`\"<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud55c\uad6d\uacfc \ubbf8\uad6d \ucc98\ub7fc \uac70\ub9ac\uc0c1\uc73c\ub85c \uba40\ub9ac \ub5a8\uc5b4\uc838 \uc788\ub294 \uacbd\uc6b0, \ud55c\ucabd\uc5d0\uc11c source\ub97c sync\ud558\uae30 \uc704\ud574\uc11c\ub294 \uc2dc\uac04\uc774 \ub108\ubb34 \ub9ce\uc774 \uac78\ub9b0\ub2e4. Mirror\ub97c \uc124\uc815\ud558\uace0 \uc8fc\uae30\uc801\uc73c\ub85c source\ub97c sync \ud574 \uc624\ub3c4\ub85d \ud558\uba74 \uc2dc\uac04\uacfc load\ub97c \uc904\uc77c \uc218 \uc788\ub2e4. \ub2e4\uc74c\uc740 Ubuntu 10.04 LTS \uae30\uc900\uc73c\ub85c\ud55c repo mirror server \uc124\uc815\ubc29\ubc95\uc5d0 \ub300\ud574 \uc124\uba85\ud55c\ub2e4. 1. Git daemon \uc124\uc815 : xinetd\ub97c \uc124\uce58\ud558\uace0 git-daemon\uc744 \uc124\uc815\ud55c\ub2e4. $&gt; sudo apt-get install xinetd $&gt;sudo [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[6],"tags":[81,108,168,182],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-tools","tag-mirroring","tag-repo","tag-168","tag-182"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":1,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":3958,"href":"https:\/\/litcoder.com\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/3958"}],"wp:attachment":[{"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/litcoder.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}