Coder Social home page Coder Social logo

asdf-postgres's Introduction

asdf-postgres

Postgresql plugin for asdf version manager

Dependencies

This assumes macOS or a debian flavored linux. If you need it to work on something else, you'll likely need to modify the plugin.

  1. You will need a compiler.
  • Mac
    1. gcc
    2. Hit the ok button and it will install. If it already has it, then you are good.
  • Ubuntu
    1. sudo apt install linux-headers-$(uname -r) build-essential
  1. On Ubuntu, you will need libreadline
  2. sudo apt-get install libreadline-dev
  3. On Ubuntu 19.04, you will need curl and zlib
  4. sudo apt-get install zlib1g-dev curl

Install

asdf plugin-add postgres

ASDF options

Check asdf readme for instructions on how to install & manage versions of Postgres.

When installing Postgres using asdf install, you can pass custom configure options with the following env vars:

  • POSTGRES_CONFIGURE_OPTIONS - use only your configure options
  • POSTGRES_EXTRA_CONFIGURE_OPTIONS - append these configure options along with ones that this plugin already uses

These options can be passed at runtime, or set in ~/.asdf-postgres-configure-options. This file will be sourced at asdf install time if it exists.

For example, if you want to compile with a specific set of openssl libraries, you might do something like POSTGRES_EXTRA_CONFIGURE_OPTIONS="--with-uuid=e2fs --with-openssl --with-libraries=/usr/local/lib:/usr/local/opt/[email protected]/lib --with-includes=/usr/local/include:/usr/local/opt/[email protected]/include" asdf install postgres

How to use (easier version)

Install

  1. Create your .tool-versions file in the project that needs postgres and add postgres 9.4.7 or whatever version that you want.
  2. run asdf install

Run

  1. Once it is done, run pg_ctl start
  2. Once that starts, run createdb default you can sub default with whatever you want your db name to be.
  3. Then log in with psql -d default if you didn't use default, make sure you use whatever you put in step 2.
  4. If you need to move your data file around, move data from your install directory, which will look something like this: ~/.asdf/installs/postgres/9.4.7/data to wherever you want it. Once it is moved, start your db with pg_ctl -D wherever/you/moved/it start. Your postgresql.conf file is in that directory if you need to change the port or anything.

Stop

  1. Just run pg_ctl stop if you moved your data directory, you have to do pg_ctl -D wherever/you/moved/it stop

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.