Giter Site home page Giter Site logo

heroku-buildpack-ci-postgresql's Introduction

Warning this is an experimental buildpack and is provided as-is without any promise of support.

Heroku CI buildpack: Postgresql

This experimental Heroku buildpack vendors Postgresql into the dyno. It is intended for use with Heroku CI or any other environment where data retention is not important.

Please note that Postgresql will lose all data each time a dyno restarts.

Usage

This is intended to be transparent to your application. Connect to the database in the same way as you would for Heroku Postgresql by reading the value of the DATABASE_URL environment variable into your application.

By default, the buildpack provides the latest Postgres version that is generally available on Heroku. You can specify a POSTGRESQL_VERSION in the env section of your app.json to use a different major (e.g., "10" or "9.6") version. This feature is experimental and subject to change.

PostgreSQL fsync

If you want to turn off fsync during your test, you can set HEROKU_CI_POSTGRES_FSYNC_OFF in your app.json env section.

heroku_ext extension schema

By default, this buildpack will create the heroku_ext schema to better reflect production databases.

To disable this, you can set HEROKU_CI_POSTGRES_HEROKU_EXT_OFF in your app.json env section.

Releasing a new version

Follow the playbook.

heroku-buildpack-ci-postgresql's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-buildpack-ci-postgresql's Issues

Builds failing

I am getting the following on a couple Heroku projects since the updates to Postgres 12:

-----> Copying .profile.d/00-pg-path.sh to add postgresql binaries to PATH
-----> Postgresql done
-----> Timed out running buildpack Postgresql
 !     Push failed

It hangs there for awhile and then eventually fails.

Unable to install Postgres 12 or 13 on a new app

I am getting the following when trying to install Postgres 12 or 13 on a new app:

-----> Copying .profile.d/00-pg-path.sh to add postgresql binaries to PATH
-----> Postgresql done
-----> Timed out running buildpack Postgresql
 !     Push failed

It will hang on Postgresql done until the Heroku build timeout kicks in. I am using the POSTGRESQL_VERSION config var to specify the version. If I switch it to Postgres 10 or 11 on the same app it works as expected.

Configure Postgres for UTF-8

When setting up this buildpack for Heroku Connect, I initially had trouble with some of our Unicode tests, which we eventually tracked down to the fact that the default Postgres database was using C for its locale settings (LC_CTYPE and LC_COLLATE, for example), while the databases created by the Heroku Postgres addon use en_us.UTF-8. We were able to get the database to use the correct encoding by setting the following env vars in our CI configuration:

  • LANG=en_us.UTF-8
  • LC_CTYPE=en_us.UTF-8
  • LC_COLLATE=en_us.UTF-8

It might've been more than we need, or we might need to do more in the long run, but this was at least enough to get our tests working again. It'd be nice if this could be set correctly via the buildpack, directly.

Add support for more locales

I would like to use this but run into problems since I need to support collation sv_SE on some columns. I have added a rake task:

namespace :db do
  task add_collation: [:environment] do
    puts "Adding sv_SE collation..."
    ActiveRecord::Base.connection.execute("SET search_path TO 'public'; CREATE COLLATION sv_SE (locale = 'sv_SE.UTF-8');")
  end
end

Rake::Task['db:structure:load_if_sql'].enhance [:add_collation]

But when using heroku-postgres:in-dyno I'm getting:

ActiveRecord::StatementInvalid: PG::InvalidParameterValue: ERROR:  could not create locale "sv_SE.UTF-8": No such file or directory
       DETAIL:  The operating system could not find any locale data for the locale name "sv_SE.UTF-8".

Is there an easy way to add more locales in the buildpack?

Does not support TLS

The build of Postgres used in the buildpack does not support TLS. If we're building from source, we need to pass the --with-openssl flag. (this is inaccurate; see comment below.)

A build that supports TLS is nice to have for dev/prod parity.

Getting DATABASE_URL undefined in my CI

Here is my app.json. Note that the only non-standard thing I am doing is using the subdir-heroku-buildpack

{
  "environments": {
    "test": {
      "scripts": {
        "test": "pytest"
      },
      "env": {
        "DJANGO_SETTINGS_MODULE": "myapp.settings",
        "DJANGO_SECRET_KEY": "###"
      },
      "buildpacks": [
        {"url": "https://github.com/timanovsky/subdir-heroku-buildpack#6d1c9021ebccd1d55681fad1c22e244a86908fe2"},
        {"url": "heroku/python"}
      ],
      "addons": [
        "heroku-postgresql:in-dyno"
      ]
    }
  }
}

Then I get TESTS FAILED with an error from my django settings file :

    "default": dj_database_url.config(default=os.environ["DATABASE_URL"])
                                              ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'DATABASE_URL'

Any idea what's going on ? Is that a bug ?

Allow configuring POSTGRESQL_VERSION

Right now, it looks like this is configured for 9.6.2, with no way to use anything else, although a lot of the supporting infrastructure is in place. Any thoughts on supporting a user-configurable version (via config var or... buildpack source control tag or...)? It would be a great way to, e.g., try out the Postgres 10 betas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.