Skip to content

jayme/pleroma-cookbook

Repository files navigation

pleroma cookbook

Chef cookbook for installing and configuring pleroma. (see pleroma-test-cookbook or below for example usage)

NOTE pleroma requires postgres, which this cookbook does not provide.

NOTE This cookbook is a LWRP resource. You should depend/include it in your own cookbook recipes. See examples below for further instructions.

NOTE The initial elixir compile stages using mix does take a few minutes - systemd is configured with a high timeout. Furthermore, since a proper database is not provided by this cookbook - systemd and upstart has ignore_failure settings default to true.

Requirements

chef >= 12.1

A general understanding of how pleroma works.

Platforms:

This cookbook has been tested on:

  • ubuntu-16.04
  • ubuntu-14.04
  • freebsd-11
  • centos-7
  • debian-9

Freebsd service is controled by daemontools.

Resources / Providers

pleroma_install

Installs a pleroma instance using default properties below.

name type default info
instance string name_property the instance name, defaults to the required name property
username string pleroma the pleroma system user
groupname string pleroma the pleroma system group
path string /opt/pleroma directory for pleroma source
repo string https://git.pleroma.social/pleroma/pleroma.git the pleroma repo url
branch string develop the pleroma branch to sync

Usage:

pleroma_install 'testing' do
  username 'pleroma'
  groupname 'pleroma'
  path '/opt/pleroma'
end

pleroma_instance

Configures a pleroma instance using the default properties below.

name type default info
hostname string node['fqdn'] the pleroma hostname to display
db_hostname string localhost the pleroma postgres hostname/ip
db_username string pleroma the pleroma postgres username
db_password string pleroma the pleroma postgres password
db_database string pleroma the pleroma postgres database
email string pleroma@node['fqdn'] the pleroma owner email
secret_key string generated by ruby if not provided the pleroma instance secret_key
vapid hash generated by ruby if not provided the public/private key for web_push
registration boolean true should pleroma allow registration
public boolean true should pleroma be public

Usage:

pleroma_instance 'pleroma_chef' do
  ignore_failure true
  hostname 'myhostname.com'
  db_username 'pleroma'
  db_password 'pleroma'
  db_hostname 'localhost'
  db_database 'pleroma'
  secret_key 'q5Q6Dc40N2B5py3jn8jxwb+2LqXJUhYcLN/IJ+Gty4xVSETv6dH4CakQ8wL9ya2CyAQutx8UkWTgPa8U9DlOeg=='
  register true
  public true
  email 'pleroma@myhostname.com'
  action :create
end

Example Usage

Include the pleroma cookbook in your cookbook/recipes. See pleroma-test-cookbook for basic example cookbook structure.

append to your Berksfile:

cookbook 'pleroma', github: 'jayme/pleroma-cookbook'

update your metadata.rb

depends 'pleroma'
depends 'postgresql'
depends 'nginx'

in whatever_cookbook/recipes/default.rb:

include_recipe 'nginx'

nginx_site 'pleroma' do
  template 'my.nginx.conf.erb'
  action :enable
end

postgresql_server_install 'pleroma postgresql' do
  action :install
end

postgresql_user 'pleroma' do
  password 'pleroma'
end

postgresql_database 'pleroma' do
  owner 'pleroma'
end

postgresql_access 'pleroma' do
  comment 'pleroma postgresql user'
  access_type 'host'
  access_db 'all'
  access_user 'pleroma'
  access_addr '127.0.0.1/32'
  access_method 'md5'
end

package 'postgresql-contrib-9.6'

%w[citext pg_trgm "uuid-ossp"].each do |ext|
  postgresql_extension ext do
    database 'pleroma'
    extension ext
  end
end

pleroma_install

pleroma_instance 'testing' do
  ignore_failure true
  hostname 'social.supplntr.io'
  db_username 'pleroma'
  db_password 'pleroma'
  db_hostname 'localhost'
  db_database 'pleroma'
  secret_key 'q5Q6Dc40N2B5py3jn8jxwb+2LqXJUhYcLN/IJ+Gty4xVSETv6dH4CakQ8wL9ya2CyAQutx8UkWTgPa8U9DlOeg=='
  register true
  public true
  email "pleroma@social.supplntr.io"
  action :create
end

Testing

The cookbook provides a kitchen-vagrant configuration and a pleroma_test cookbook for testing.

WARNING Tests will utilize a postgresql database provided by default property values (localhost) unless modified. You must provide the postgresql server on your own.

Contributing

We welcome contributed improvements and bug fixes via the usual workflow:

  1. Fork this repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request

About

Chef LWRP cookbook for installing pleroma.

Resources

License

Stars

Watchers

Forks

Packages

No packages published