Skip to content
Yuichi Takeuchi edited this page Jul 31, 2018 · 19 revisions

Welcome to the gitfab2 wiki!

DB

確認

bundle exec ridgepole -c config/database.yml -E development  --apply --dry-run -f db/schemas/Schemafile --enable-foreigner

適用

bundle exec ridgepole -c config/database.yml -E development --apply -f db/schemas/Schemafile --enable-foreigner

テスト用

bundle exec ridgepole -c config/database.yml -E test --apply -f db/schemas/Schemafile --enable-foreigner

trouble shoot!!

incompatible marshal file format in the view.

bundle exec rake tmp:clear

メモ

embeds_many :items

has_many :items, dependent: :destroy

embeds_one :item

has_one :item, dependent: :destroy

embedded_in :parent

belongs_to :parent

reindex

classes = Dir.glob('app/models/*.rb').map{|path| path.to_s.match('.+/(.+?).rb')[1].camelize.constantize}.select{|klass|klass.respond_to?(:reindex)}
classes.each do |klass|
  klass.find_each do |obj|
    begin
      obj.index!
    rescue => e
      puts "#{obj.class.name}:#{obj.id}: #{e.message}(#{e.class.name})"
    end
  end
end

Docker Compose

docker-compose.yml

version: '3'
volumes:
  mysql-data:
    driver: 'local'
  minio-data:
    driver: 'local'
services:
  db:
    image: mysql:5.6.36
    command: '--innodb-file-format=Barracuda --innodb-file-per-table=true --innodb-large-prefix=true'
    environment:
      MYSQL_USER: root
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
      MYSQL_ROOT_HOST: '%'
      TZ: /usr/share/zoneinfo/Asia/Tokyo
    volumes:
      - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
      - mysql-data:/var/lib/mysql
    ports:
      - '3306:3306'
    networks:
      - default
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot", "-P", "3306"]
      interval: 1m
      timeout: 10s
      retries: 5
  sunspot:
    image: rorymc/docker-solr-sunspot
    ports:
      - '8984:8983'
docker-compose -f docker-compose.yml up

http://localhost:8984/solr/

config/sunspot.yml

development:
  solr:
    hostname: localhost
    port: 8984
    log_level: INFO
    path: /solr/collection1

Direnv

export GITHUB_APP_ID=xxxxxxxxxxxxxxxxxxxx
export GITHUB_APP_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
direnv allow