Skip to content

Support for PostgresApp on MacOS #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Support for PostgresApp on MacOS #178

wants to merge 9 commits into from

Conversation

noelmcloughlin
Copy link
Contributor

@noelmcloughlin noelmcloughlin commented Jan 15, 2018

This PR introduces support for the PostgresApp package on MacOS. The package is first downloaded from http://postgresapp.com, sha-256 is verified, and installed natively on MacOS.

The tested baseline included #176 and #177 so hopefully those commits are merged first.

** top_state **
base:
  '*':
    - postgres

** Pillars **
postgres:
{% if grains.os == 'MacOS' %}

  # Set to 'postgresapp' to install that upstream MacOS package
  use_upstream_repo: 'postgresapp'

{% else %}
  # Set False to use distro packaged postgresql.
  # Set True to use upstream postgresql.org repo for YUM/APT/ZYPP
  use_upstream_repo: False

  # Upstream version
  version: '9.6'

  # Additional packages to install with PostgreSQL server,
  # this should be in a list format and correctly named.
  pkgs_extra:
  - postgresql-contrib
  - postgresql-plpython

  # These are Debian/Ubuntu specific package names
  pkg: 'postgresql-9.6'
  pkg_client: 'postgresql-client-9.6'

  #Debian alternatives priority incremental. 0 disables feature.
  linux:
    altpriority: 30
{% endif %}

  limits:
    soft: 64000
    hard: 64000

... rest as per pillar.example ....


** Result on OS X El Capitan **

local:
----------
          ID: pg-remove-prev-archive
    Function: file.absent
        Name: /tmp/postgrestmp/postgres.dmg
      Result: True
     Comment: Removed file /tmp/postgrestmp/postgres.dmg
     Started: 10:26:44.473380
    Duration: 11.411 ms
     Changes:   
              ----------
              removed:
                  /tmp/postgrestmp/postgres.dmg
----------
          ID: pg-extract-dirs
    Function: file.directory
        Name: /tmp/postgrestmp
      Result: True
     Comment: Directory /tmp/postgrestmp is in the correct state
              Directory /tmp/postgrestmp updated
     Started: 10:26:44.484917
    Duration: 0.752 ms
     Changes:   
----------
          ID: pg-download-archive
    Function: pkg.installed
        Name: curl
      Result: True
     Comment: Package curl is already installed
     Started: 10:26:46.269667
    Duration: 733.215 ms
     Changes:   
----------
          ID: pg-download-archive
    Function: cmd.run
        Name: curl -s -L -o '/tmp/postgrestmp/postgres.dmg' https://github.com/PostgresApp/PostgresApp/releases/download/v2.1.1/Postgres-2.1.1.dmg
      Result: True
     Comment: Command "curl -s -L -o '/tmp/postgrestmp/postgres.dmg' https://github.com/PostgresApp/PostgresApp/releases/download/v2.1.1/Postgres-2.1.1.dmg" run
     Started: 10:26:47.005116
    Duration: 229067.193 ms
     Changes:   
              ----------
              pid:
                  5116
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: pg-package-install
    Function: macpackage.installed
        Name: /tmp/postgrestmp/postgres.dmg
      Result: True
     Comment: Postgres.app installed
     Started: 10:30:36.295101
    Duration: 18240.587 ms
     Changes:   
              ----------
              installed:
                  - Postgres.app
----------
          ID: pg-package-install
    Function: file.append
        Name: /Users/messi/.bash_profile
      Result: True
     Comment: Appended 1 lines
     Started: 10:30:54.536223
    Duration: 20.205 ms
     Changes:   
              ----------
              diff:
                  --- 
                  
                  +++ 
                  
                  @@ -26,3 +26,4 @@
                  
                   #### HOSTS #####
                   alias tm='cd && ssh tm'
                   export PATH="/usr/local/sbin:$PATH"
                  +export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
----------
          ID: pg-remove-archive
    Function: file.absent
        Name: /tmp/postgrestmp
      Result: True
     Comment: Removed directory /tmp/postgrestmp
     Started: 10:30:54.556690
    Duration: 2.163 ms
     Changes:   
              ----------
              removed:
                  /tmp/postgrestmp
----------
          ID: postgres_maxfiles_limits_conf
    Function: file.managed
        Name: /Library/LaunchDaemons/limit.maxfiles.plist
      Result: True
     Comment: File /Library/LaunchDaemons/limit.maxfiles.plist is in the correct state
     Started: 10:30:54.558930
    Duration: 13.938 ms
     Changes:   
----------
          ID: postgres-desktop-shortcut-clean
    Function: file.absent
        Name: /Users/messi/Desktop/postgres
      Result: True
     Comment: File /Users/messi/Desktop/postgres is not present
     Started: 10:30:54.572969
    Duration: 0.427 ms
     Changes:   
----------
          ID: postgres-desktop-shortcut-add
    Function: file.managed
        Name: /tmp/mac_shortcut.sh
      Result: True
     Comment: File /tmp/mac_shortcut.sh updated
     Started: 10:30:54.573711
    Duration: 7.17 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0755
              user:
                  messi
----------
          ID: postgres-desktop-shortcut-add
    Function: cmd.run
        Name: /tmp/mac_shortcut.sh postgresapp
      Result: True
     Comment: Command "/tmp/mac_shortcut.sh postgresapp" run
     Started: 10:30:54.581287
    Duration: 440.299 ms
     Changes:   
              ----------
              pid:
                  5168
              retcode:
                  0
              stderr:
              stdout:
                  alias file Postgres of folder Desktop of folder messi of folder Users of startup disk

Summary for local
-------------
Succeeded: 11 (changed=7)
Failed:     0
-------------
Total states run:     11
Total run time:  248.537 s

@noelmcloughlin
Copy link
Contributor Author

noelmcloughlin commented Mar 8, 2018

rebased as #191

@noelmcloughlin noelmcloughlin deleted the postgresapp_macos branch March 8, 2018 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant