Add "welcome" asciicast on db init

install-doc
Marcin Kulik 7 years ago
parent b4ed4edc9c
commit 20904489c4

@ -23,7 +23,7 @@ module Asciinema
if home_asciicast_id
Asciicast.find(home_asciicast_id)
else
Asciicast.non_private.last
Asciicast.non_private.order(:id).first
end
end

@ -1,7 +1,13 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
# Create asciinema user
asciinema_user = User.find_by_username("asciinema") || User.create!(username: "asciinema", name: "asciinema", email: "support@asciinema.org")
# Create "welcome" asciicast
if asciinema_user.asciicasts.count == 0
attrs = AsciicastParams.build(File.open("resources/welcome.json"), asciinema_user, nil)
AsciicastCreator.new.create(attrs.merge(private: false, snapshot_at: 76.2))
end

@ -1,7 +1,7 @@
version: '2'
# Quickstart:
# docker-compose run --rm -b_init
# docker-compose run --rm db_init
# docker-compose up -d web
# To cleanup:
@ -67,7 +67,11 @@ services:
db_init:
image: asciinema/asciinema.org
links:
- redis
- postgres
environment:
DATABASE_URL: "postgresql://asciinema:sekrit@postgres/asciinema"
REDIS_URL: "redis://redis:6379"
command: "bundle exec rake db:setup"
volumes:
- /tmp/asciinema/uploads:/app/uploads

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save