BiB/i daemon. Actually, not a daemon.
It hosts EPUB files and generates HTML tags to embed the books into your blog.
BiB/i'd is running at bibid.kitaitimakoto.net.
Example unit file is here:
(/etc/systemd/system/bibid.service
)
[Unit]
Description=BiB/i'd EPUB Hosting Service
After=postgresql.service
[Service]
User=www-data
WorkingDirectory=/var/www/bibid/current
EnvironmentFile=/var/www/bibid/current/.env.production
ExecStart=/usr/local/bin/bundle exec puma -b unix:///var/www/bibid/puma.sock
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
% docker pull kitaitimakoto/bibid
% docker run --name bibid -d -p 3000:3000 --env-file=.env -v $(pwd)/gcp-service-account.json:/bibid/gcp-service-account.json kitaitimakoto/bibid
Expose port 3000
to host.
gcp-service-account.json
specified for -v
option is a file of Google Cloud Platform IAM service account and generated by Google Cloud Platform to access to Google Cloud Storage. See official document for how to generate it.
You may set environment variables blow in a file specified for --env-file
or --env
option.
RACK_ENV
:development
,test
orproduction
DATABASE_URL
: Database URL. ex)postgres://bibiduser:bibidpassword@databasehost:5432/bibid_databasename
SESSION_SECRET
: Random string to sign session cookie. See Session Secret Security section in Sinatra documentTWITTER_KEY
: OAuth2 client key for Twitter generated at Twitter Application Management siteTWITTER_SECRET
: OAuth2 client secret for TwitterCONTACT_URI
: URI users can contact youCARRIERWAVE_FOG_PROVIDER
: Object storage provider. Currently, only Google Cloud Storage is available. Set togoogle
CARRIERWAVE_FOG_PROJECT
: Project which include Google Cloud Storage bucket for Bib/i'd instanceCARRIERWAVE_FOG_DIRECTORY
: Google Cloud Storage bucket nameCARRIERWAVE_FOG_KEY_LOCATION
: Full path in Docker container for Google Cloud Platform IAM service account file
- Install assets
$ bower install
- Install gems
$ bundle install --path=deps
- Copy sample configure file
$ cp config/apps.sample.rb config/apps.rb
- Set
:session_secret
$ $EDITOR config/apps.rb
- Set Twitter consumer key and secret
$ $EDITOR config/apps.rb
- Start server
$ bundle exec rackup config.ru
BiB/i'd is released under the AGPLv3. See th file "agpl.txt" for the term.