<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ### 管理 Drupal 站點 **Drupal** 是一個內容管理系統,它通過插拔組裝一系列罐裝的模塊讓你快速構建網站, 它使用戶創建和編輯自己的內容變的相對容易。 Drupal 特別適合使用 Puppet 來管理,因為有一個強大的命令行工具 drush, 你可以使用這個工具安裝、管理 Drupal 站點。 如果我們將自動化管理 Drupal 站點的 drush 工具與我們已經創建的用于管理 MySQL 數據庫和 Apache 虛擬主機的 Puppet 處方相結合, 就可以使用單一資源創建一個安裝 Drupal 站點所需一切的新處方。 #### 準備工作 1. 創建一個新的 drupal 模塊如下: ``` # mkdir /etc/puppet/modules/drupal # mkdir /etc/puppet/modules/drupal/manifests ``` 2. 使用如下內容創建 /etc/puppet/modules/drupal/manifests/init.pp 文件: ``` class drupal { $drupalversion = "7.2" exec { "download-drush": cwd =&gt; "/root", command =&gt; "/usr/bin/wget http://ftp.drupal.org/files/ projects/drush-7.x-4.4.tar.gz ", creates =&gt; "/root/drush-7.x-4.4.tar.gz", require =&gt; Package["php5-mysql"], } exec { "install-drush": cwd =&gt; "/usr/local", command =&gt; "/bin/tar xvzf /root/drush-7.x-4.4.tar.gz", creates =&gt; "/usr/local/drush", require =&gt; Exec["download-drush"], } file { "/usr/local/bin/drush": ensure =&gt; link, target =&gt; "/usr/local/drush/drush", require =&gt; Exec["install-drush"], } exec { "install-drupal": cwd =&gt; "/var/www", command =&gt; "/usr/local/drush/drush dl drupal- ${drupalversion}", creates =&gt; "/var/www/drupal-${drupalversion}", require =&gt; Exec["install-drush"], } file { "/var/www/drupal": ensure =&gt; link, target =&gt; "/var/www/drupal-${drupalversion}", require =&gt; Exec["install-drupal"], } package { [ "libapache2-mod-php5", "php5-mysql" ]: ensure =&gt; installed } exec { "enable-mod-php5": command =&gt; "/usr/bin/a2enmod php5", creates =&gt; "/etc/apache2/mods-enabled/php5.conf", require =&gt; Package["libapache2-mod-php5"], } } ``` #### 操作步驟 1. 在 init.pp 文件的 drupal 類中添加如下內容: ``` define site( $password, $sitedomain = "" ) { include drupal if $sitedomain == "" { $drupal_domain = $name } else { $drupal_domain = $sitedomain } $dbname = regsubst( $drupal_domain, "\.", "" ) mysql::server::db { $dbname: user =&gt; $dbname, password =&gt; $password, } exec { "site-install-${name}": cwd =&gt; "/var/www/drupal", command =&gt; "/usr/local/bin/drush site-install -y --site-name=${name} --sites-subdir=${drupal_domain} --db-url=mysql://${dbname}:${password}@localhost/${dbname}", creates =&gt; "/var/www/drupal/sites/${drupal_domain}", require =&gt; [ File["/var/www/drupal"], Exec["install-drupal"], Mysql::Server::Db[$dbname] ], logoutput =&gt; on_failure, } apache::site { $drupal_domain: documentroot =&gt; "/var/www/drupal", } } ``` 2. 添加如下內容到一個節點: ``` drupal::site { "crispinfo.com": password =&gt; "crunch", } ``` 3. 運行 Puppet: ``` # puppet agent --test info: Retrieving plugin info: Caching catalog for cookbook.bitfieldconsulting.com info: Applying configuration version '1309783783' notice: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Mysql::Server::Db[crispinfocom]/Exec[create-crispinfocom-db]/ returns: executed successfully notice: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Apache::Site[crispinfo.com]/File[/etc/apache2/sites-available/ crispinfo.com.conf]/ensure: defined content as '{md5}15c5bbffa6128 fce0b8a3996914af549' info: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Apache::Site[crispinfo.com]/File[/etc/apache2/sites-available/ crispinfo.com.conf]: Scheduling refresh of Exec[enable-crispinfo. com-vhost] notice: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Apache::Site[crispinfo.com]/Exec[enable-crispinfo.com-vhost]: Triggered 'refresh' from 1 events info: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Apache::Site[crispinfo.com]/Exec[enable-crispinfo.com-vhost]: Scheduling refresh of Service[apache2] notice: /Stage[main]/Apache/Service[apache2]: Triggered 'refresh' from 1 events notice: /Stage[main]//Node[cookbook]/Drupal::Site[crispinfo.com]/ Exec[site-install-crispinfo.com]/returns: executed successfully notice: Finished catalog run in 22.51 seconds ``` 4. 在 /etc/hosts 文件中創建一個條目將 crispinfo.com 指向你正在使用的節點 IP (如果還沒設置 DNS): ``` 10.0.2.15 crispinfo.com ``` 5. 在瀏覽器中檢查站點,以確保一切都已經正確創建。你應該看到 Drupal 的登錄提示,在下圖所示: ![https://box.kancloud.cn/2016-05-12_5733eee582f11.png](https://box.kancloud.cn/2016-05-12_5733eee582f11.png) 使用由 drush site-install 創建的默認的管理員登錄,用戶名為 admin 其口令為 admin。 顯然你應該為實際生產線上的站點設置強壯的口令 (查看 drush 文檔獲得如何使用命令行工具設置的信息)。 #### 工作原理 真是神奇呀!尤其是 drupal 類首先安裝 drush,然后使用它安裝 Drupal 的核心代碼 (你可以通過修改 $drupalversion 的值改變版本)。 drupal::sitedefine 為你想要創建的每個站點運行 drush site-install 。 在我們的例子中,創建了一個名為 crispinfo.com 的站點并為其傳遞了站點數據庫使用的口令, 其余的工作都由 drush 去完成。 drupal::site 也為我們的站點創建了所需的 **Apache 虛擬主機** (使用本章 [創建 Apache 虛擬主機](#ch07sec02) 一節中的處方) 和 **MySQL 數據庫** (使用本章 [創建 MySQL 數據庫及用戶](#ch07sec04) 一節中的處方)。 #### 更多用法 要管理 Drupal 站點,drush 可以幫你做很多事,包括更新 Drupal 的核心代碼、 安裝模塊和主題模板、管理用戶以及備份站點數據庫等。 你可以在 [http://drush.ws/](http://drush.ws/) 找到更多關于 drush 的信息。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看