postgresql_server_install 'My PostgreSQL Server install' do initdb_locale 'en_US.utf8' action :install end postgresql_server_install 'Setup my PostgreSQL 9.6 server' do initdb_locale 'en_US.utf8' action :create end postgresql_access 'local_postgres_superuser' do comment 'Local postgres superuser access' access_type 'local' access_db 'all' access_user 'postgres' access_addr nil access_method 'ident' end postgresql_user 'gitea' do password node['db-password'] # createrole true end # Hack for creating a database, this cook book is broken with debian... execute 'add database' do command 'createdb gitea' user 'postgres' not_if 'psql -lqt | cut -d \| -f 1 | grep -qw gitea', :user => 'postgres' end execute 'Grant gitea user' do command 'echo "grant all privileges on database gitea to gitea ;" | psql' user 'postgres' end template '/home/gitea/dump.sql' do source 'gitea_postgres.sql.erb' owner 'gitea' group 'gitea' mode '0755' end execute 'base DB' do command 'psql gitea < /home/gitea/dump.sql' user 'postgres' end # postgresql_database 'gitea' do # locale 'en_US.utf8' # owner 'gitea' # end