[Groonga-commit] ranguba/chupa-text-vagrant at aee4d64 [master] Make workable

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jul 18 15:46:36 JST 2017


Kouhei Sutou	2017-07-18 15:46:36 +0900 (Tue, 18 Jul 2017)

  New Revision: aee4d6478e07fa1d8d2c0c12d5a9147d52fd6bcb
  https://github.com/ranguba/chupa-text-vagrant/commit/aee4d6478e07fa1d8d2c0c12d5a9147d52fd6bcb

  Message:
    Make workable

  Added files:
    .gitignore
  Modified files:
    Vagrantfile
    ansible/playbook.yml
  Renamed files:
    ansible/files/lib/systemd/system/chupa-text.service
      (from ansible/files/usr/lib/systemd/system/chupa-text.service)

  Added: .gitignore (+2 -0) 100644
===================================================================
--- /dev/null
+++ .gitignore    2017-07-18 15:46:36 +0900 (6274c4b)
@@ -0,0 +1,2 @@
+/.vagrant/
+/ansible/playbook.retry

  Modified: Vagrantfile (+22 -19)
===================================================================
--- Vagrantfile    2017-07-18 12:22:06 +0900 (7a91fb3)
+++ Vagrantfile    2017-07-18 15:46:36 +0900 (7f9a33a)
@@ -17,26 +17,29 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 Vagrant.configure("2") do |config|
-  config.vm.box = "bento/ubuntu-17.04"
-  config.vm.network "forwarded_port", guest: 20080, host: 20080
-  log_directory = "/var/log/chupa-text"
-  if File.exist?(log_directory)
-    config.vm.synced_folder log_directory, "/var/log/chupa-text"
-  end
+  name = "chupa-text"
+  config.vm.define(name) do |node|
+    node.vm.box = "bento/ubuntu-17.04"
+    node.vm.network "forwarded_port", guest: 3000, host: 20080
+    log_directory = "/var/log/chupa-text"
+    if File.exist?(log_directory)
+      node.vm.synced_folder log_directory, "/var/log/chupa-text"
+    end
 
-  config.vm.provider "virtualbox" do |virtualbox|
-    virtualbox.memory = "2048"
-    # virtualbox.memory = "4096"
-  end
+    node.vm.provider "virtualbox" do |virtualbox|
+      virtualbox.memory = "2048"
+      # virtualbox.memory = "4096"
+    end
 
-  config.vm.provision "ansible" do |ansible|
-    ansible.playbook = "ansible/playbook.yml"
-    ansible.groups = {
-      "servers" => ["chupa-text"],
-    }
-    ansible.host_key_checking = false
-    # ansible.raw_arguments  = [
-    #   "-vvv",
-    # ]
+    node.vm.provision "ansible" do |ansible|
+      ansible.playbook = "ansible/playbook.yml"
+      ansible.groups = {
+        "servers" => [name],
+      }
+      ansible.host_key_checking = false
+      # ansible.raw_arguments  = [
+      #   "-vvv",
+      # ]
+    end
   end
 end

  Renamed: ansible/files/lib/systemd/system/chupa-text.service (+2 -1) 69%
===================================================================
--- ansible/files/usr/lib/systemd/system/chupa-text.service    2017-07-18 12:22:06 +0900 (64cacb3)
+++ ansible/files/lib/systemd/system/chupa-text.service    2017-07-18 15:46:36 +0900 (374c34f)
@@ -7,7 +7,8 @@ Type=simple
 User=chupa-text
 Group=chupa-text
 WorkingDirectory=/home/chupa-text/chupa-text-http-server
-ExecStart=RAILS_ENV=production xvfb-run bin/rails server
+EnvironmentFile=/home/chupa-text/chupa-text-http-server/.env
+ExecStart=/usr/bin/xvfb-run bin/rails server
 Restart=always
 
 [Install]

  Modified: ansible/playbook.yml (+25 -13)
===================================================================
--- ansible/playbook.yml    2017-07-18 12:22:06 +0900 (9d2f962)
+++ ansible/playbook.yml    2017-07-18 15:46:36 +0900 (427decb)
@@ -24,6 +24,9 @@
       command: timedatectl set-timezone Asia/Tokyo
     - name: Enable NTP
       command: timedatectl set-ntp true
+    - name: Install aptitude
+      apt:
+        name: aptitude
     - name: Upgrade packages
       apt:
         update_cache: yes
@@ -50,6 +53,7 @@
         - npm
         - ruby
         - ruby-dev
+        - squid
         - sudo
         - tzdata
         - xvfb
@@ -65,14 +69,13 @@
     - name: Create chupa-text user
       user:
         name: chupa-text
-        groups:
-          - chupa-text
-          - sudo
+        groups: sudo
         append: true
     - name: Enable no password sudo
       copy:
         src: etc/sudoers.d/no-password
         dest: /etc/sudoers.d/no-password
+        validate: "visudo -cf %s"
     - name: Clone ChupaText HTTP server
       git:
         repo: https://github.com/ranguba/chupa-text-http-server.git
@@ -85,8 +88,9 @@
         dest: /home/chupa-text/chupa-text-http-server/{{ item }}
       with_items:
         - Gemfile.local
+      become_user: chupa-text
     - name: Install dependencies
-      bundle:
+      bundler:
         chdir: ~/chupa-text-http-server
         exclude_groups:
           - development
@@ -98,20 +102,28 @@
       args:
         chdir: ~/chupa-text-http-server
       become_user: chupa-text
-    - name: Check secret key file
+    - name: Check secret key
       stat:
-        path: ~/chupa-text-http-server/config/secrets.yml
+        path: ~/chupa-text-http-server/config/secrets.key
       become_user: chupa-text
-      register: chupa_text_config_secrets
+      register: chupa_text_config_secrets_key
     - name: Generate secret key
+      shell: RAILS_ENV=production bin/rails secret > config/secrets.key
+      args:
+        chdir: ~/chupa-text-http-server
+      become_user: chupa-text
+      when: not chupa_text_config_secrets_key.stat.exists
+    - name: Generate .env
       shell: |
-        (echo "production:"; \
-         echo "  secret_key_base: $(RAILS_ENV=production bin/rails secret)") > \
-         config/secrets.yml
+        (echo "RAILS_ENV=production"; \
+         echo "RAILS_SERVE_STATIC_FILES=yes"; \
+         echo "SECRET_KEY_BASE=$(cat config/secrets.key)"; \
+         echo "http_proxy=http://127.0.0.1:3128"; \
+         echo "https_proxy=http://127.0.0.1:3128") > \
+         .env
       args:
         chdir: ~/chupa-text-http-server
       become_user: chupa-text
-      when: not chupa_text_config_secrets.exists
     - name: Enable logrotate
       copy:
         src: etc/logrotate.d/{{ item }}
@@ -120,8 +132,8 @@
         - chupa-text
     - name: Enable systemd service
       copy:
-        src: usr/lib/systemd/system/{{ item }}
-        dest: /usr/lib/systemd/system/{{ item }}
+        src: lib/systemd/system/{{ item }}
+        dest: /lib/systemd/system/{{ item }}
       with_items:
         - chupa-text.service
       notify:
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index