├── .gitignore ├── docker ├── files │ ├── tmux.conf │ ├── bashrc │ ├── vimrc │ ├── pg_hba.conf │ ├── start.sh │ ├── lein │ └── postgresql.conf └── Dockerfile ├── manage.sh ├── README.md ├── CONTRIBUTING.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | \#*\# 2 | *~ 3 | .\#* 4 | /uxbox 5 | /uxbox-backend 6 | /uxbox-web -------------------------------------------------------------------------------- /docker/files/tmux.conf: -------------------------------------------------------------------------------- 1 | set -g mouse off 2 | set -g history-limit 50000 3 | setw -g mode-keys emacs 4 | 5 | -------------------------------------------------------------------------------- /docker/files/bashrc: -------------------------------------------------------------------------------- 1 | export PATH=$HOME/.local/bin:$PATH 2 | 3 | alias l='ls --color -GFlh' 4 | alias rm='rm -r' 5 | alias ls='ls --color -F' 6 | alias lsd='ls -d *(/)' 7 | alias lsf='ls -h *(.)' 8 | 9 | export NVM_DIR="/home/uxbox/.nvm" 10 | [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm 11 | -------------------------------------------------------------------------------- /docker/files/vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | set bs=2 4 | set ts=4 5 | set tw=1000000000 6 | 7 | set expandtab 8 | set tabstop=8 9 | set softtabstop=4 10 | set shiftwidth=4 11 | filetype indent off 12 | filetype plugin on 13 | 14 | syntax on 15 | 16 | set autoindent 17 | set showmatch 18 | set showmode 19 | set mousehide 20 | 21 | set nowrapscan 22 | set hlsearch 23 | set incsearch 24 | 25 | set fileencoding=utf8 26 | set encoding=utf8 27 | -------------------------------------------------------------------------------- /docker/files/pg_hba.conf: -------------------------------------------------------------------------------- 1 | # Database administrative login by Unix domain socket 2 | local all postgres trust 3 | 4 | # TYPE DATABASE USER ADDRESS METHOD 5 | 6 | # "local" is for Unix domain socket connections only 7 | local all all trust 8 | # IPv4 local connections: 9 | host all all 127.0.0.1/32 trust 10 | # IPv6 local connections: 11 | host all all ::1/128 trust 12 | -------------------------------------------------------------------------------- /docker/files/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tmux -2 new-session -d -s uxbox 4 | 5 | tmux new-window -t uxbox:1 -n 'figwheel' 6 | tmux select-window -t uxbox:1 7 | tmux send-keys -t uxbox 'cd uxbox' enter C-l 8 | tmux send-keys -t uxbox 'npm run figwheel' enter 9 | 10 | tmux new-window -t uxbox:2 -n 'backend' 11 | tmux select-window -t uxbox:2 12 | tmux send-keys -t uxbox 'cd uxbox-backend' enter C-l 13 | tmux send-keys -t uxbox 'bash ./scripts/fixtures.sh' enter 14 | tmux send-keys -t uxbox 'bash ./scripts/run.sh' enter 15 | 16 | tmux new-window -t uxbox:3 -n 'services' 17 | tmux select-window -t uxbox:3 18 | tmux send-keys -t uxbox 'sudo pg_ctlcluster 9.5 main start' enter 19 | 20 | tmux rename-window -t uxbox:0 'gulp' 21 | tmux select-window -t uxbox:0 22 | tmux send-keys -t uxbox 'cd uxbox' enter C-l 23 | tmux send-keys -t uxbox 'if [ ! -e ./node_modules ]; then npm install; fi' enter C-l 24 | tmux send-keys -t uxbox 'npm run watch' enter 25 | 26 | tmux -2 attach-session -t uxbox 27 | -------------------------------------------------------------------------------- /manage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | REV=`git rev-parse --short HEAD` 4 | IMGNAME="uxbox" 5 | 6 | function kill_container { 7 | if $(sudo docker ps |grep -q $IMGNAME); then 8 | sudo docker ps |grep $IMGNAME | awk '{print $1}' | xargs --no-run-if-empty sudo docker kill 9 | fi 10 | } 11 | 12 | function build_image { 13 | kill_container 14 | sudo docker build --rm=true -t $IMGNAME:$REV docker/ 15 | } 16 | 17 | function initialize { 18 | if [ ! -e ./uxbox ]; then 19 | git clone git@github.com:uxbox/uxbox.git 20 | fi 21 | 22 | if [ ! -e ./uxbox-backend ]; then 23 | git clone git@github.com:uxbox/uxbox-backend.git 24 | fi 25 | } 26 | 27 | function run_image { 28 | kill_container 29 | initialize 30 | 31 | if ! $(sudo docker images|grep $IMGNAME |grep -q $REV); then 32 | build_image 33 | fi 34 | 35 | sudo docker run -ti \ 36 | -v `pwd`/uxbox:/home/uxbox/uxbox \ 37 | -v `pwd`/uxbox-backend:/home/uxbox/uxbox-backend \ 38 | -v $HOME/.m2:/home/uxbox/.m2 \ 39 | -v $HOME/.gitconfig:/home/uxbox/.gitconfig \ 40 | -p 3449:3449 -p 6060:6060 -p 9090:9090 $IMGNAME:$REV 41 | } 42 | 43 | function usage { 44 | echo "USAGE: $0 [ build | run | init ]" 45 | } 46 | 47 | case $1 in 48 | build) 49 | build_image 50 | ;; 51 | run) 52 | run_image 53 | ;; 54 | 55 | init) 56 | initialize 57 | ;; 58 | *) 59 | usage 60 | ;; 61 | esac 62 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:xenial 2 | MAINTAINER Andrey Antukh 3 | 4 | RUN apt-get update && \ 5 | apt-get install -yq locales ca-certificates wget && \ 6 | rm -rf /var/lib/apt/lists/* 7 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 8 | RUN locale-gen && update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=en 9 | ENV LANG en_US.UTF-8 10 | ENV LC_ALL en_US.UTF-8 11 | 12 | RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list 13 | RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - 14 | 15 | RUN apt-get update -yq && \ 16 | apt-get install -yq bash git tmux vim openjdk-8-jdk rlwrap build-essential \ 17 | postgresql-9.5 postgresql-contrib-9.5 imagemagick webp \ 18 | sudo 19 | 20 | RUN mkdir -p /etc/resolvconf/resolv.conf.d 21 | RUN echo "nameserver 8.8.8.8" > /etc/resolvconf/resolv.conf.d/tail 22 | 23 | RUN useradd -m -g users -s /bin/bash uxbox 24 | RUN passwd uxbox -d 25 | RUN echo "uxbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers 26 | 27 | COPY files/pg_hba.conf /etc/postgresql/9.5/main/pg_hba.conf 28 | COPY files/postgresql.conf /etc/postgresql/9.5/main/postgresql.conf 29 | COPY files/bashrc /root/.bashrc 30 | COPY files/vimrc /root/.vimrc 31 | 32 | RUN /etc/init.d/postgresql start \ 33 | && psql -U postgres -c "create user \"uxbox\" LOGIN SUPERUSER" \ 34 | && createdb -U uxbox uxbox \ 35 | && createdb -U uxbox test \ 36 | && /etc/init.d/postgresql stop 37 | 38 | EXPOSE 3449 39 | EXPOSE 6060 40 | EXPOSE 9090 41 | 42 | USER uxbox 43 | WORKDIR /home/uxbox 44 | 45 | RUN git clone https://github.com/creationix/nvm.git .nvm 46 | RUN bash -c "source .nvm/nvm.sh && nvm install v6.2.1" 47 | RUN bash -c "source .nvm/nvm.sh && nvm alias default v6.2.1" 48 | 49 | COPY files/lein /home/uxbox/.local/bin/lein 50 | RUN bash -c "/home/uxbox/.local/bin/lein version" 51 | 52 | COPY files/bashrc /home/uxbox/.bashrc 53 | COPY files/vimrc /home/uxbox/.vimrc 54 | COPY files/start.sh /home/uxbox/.start.sh 55 | COPY files/tmux.conf /home/uxbox/.tmux.conf 56 | 57 | CMD /home/uxbox/.start.sh 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UXBOX Development Environment # 2 | 3 | ## Introduction ## 4 | 5 | The development environment consists in a docker container that mounts your local 6 | copy of the uxbox souce code directory tree and executes a tmux inside the container 7 | in order to facilitate execute multiple processes inside. 8 | 9 | 10 | ## System requirements ## 11 | 12 | You should have `docker` installed in your system in order to set up properly 13 | the uxbox development enviroment. 14 | 15 | In debian like linux distributions you can install it executing: 16 | 17 | ```bash 18 | sudo apt-get install docker 19 | ``` 20 | 21 | 22 | ## Start the docker container ## 23 | 24 | **Requires a minimum knowledge of tmux usage in order to use that development 25 | environment.** 26 | 27 | For start it, staying in this repository, execute: 28 | 29 | ```bash 30 | ./manage.sh run 31 | ``` 32 | 33 | This will do the following: 34 | 35 | - Build the image if it is not done before. 36 | - Download all repositories if them are not downloaded previously. 37 | - Start a container with predefined tmux layout. 38 | - Start all needed processes such as gulp and figwheel. 39 | 40 | 41 | ## First steps with tmux ## 42 | 43 | Now having the the container running and tmux open inside the container, you are 44 | free to execute any commands and open many shells as you want. 45 | 46 | You can create a new shell just pressing the **Ctr+b c** shortcut. And **Ctrl+b w** 47 | for switch between windows, **Ctrl+b &** for kill the current window. 48 | 49 | ## Inside the tmux session ## 50 | 51 | ### UI ### 52 | 53 | The UI related tasks starts automatically so you do not need do anything. The 54 | **window 0** and **window 1** are used for the UI related environment. 55 | 56 | 57 | ### Backend ### 58 | 59 | The backend related environment is located in the **window 2**, and you can go 60 | directly to it using `ctrl+b 2` shortcut. 61 | 62 | By default this tasks are performed: 63 | 64 | - Start postgresql. 65 | - Load initial fixtures into the database. 66 | 67 | The backend is not started automatically, and frontend code by default does not 68 | requires that (because it uses a remote server on default config). 69 | 70 | You can start it just execting the `run.sh` script: 71 | 72 | ```bash 73 | ./scripts/run.sh 74 | ``` 75 | 76 | You also can start an repl and strart the backend inside of them: 77 | 78 | ```bash 79 | lein repl 80 | ``` 81 | 82 | And use `(start)` to start all the environment, `(stop)` for stoping it and 83 | `(reset)` for restart with code reloading. If some exception is raised when 84 | code is reloaded, just use `(refresh)` in order to finish correctly the 85 | code swaping and later use `(reset)` again. 86 | 87 | 88 | ## License ## 89 | 90 | ``` 91 | This Source Code Form is subject to the terms of the Mozilla Public 92 | License, v. 2.0. If a copy of the MPL was not distributed with this 93 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 94 | ``` 95 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to UXBox # 2 | 3 | Thank you for your interest in contributing to UXBox. This guide details how 4 | to contribute to UXBox in a way that is efficient for everyone. 5 | 6 | ## Contributor License Agreement ## 7 | 8 | By submitting code you are agree and can certify the below: 9 | 10 | Developer's Certificate of Origin 1.1 11 | 12 | By making a contribution to this project, I certify that: 13 | 14 | (a) The contribution was created in whole or in part by me and I 15 | have the right to submit it under the open source license 16 | indicated in the file; or 17 | 18 | (b) The contribution is based upon previous work that, to the best 19 | of my knowledge, is covered under an appropriate open source 20 | license and I have the right under that license to submit that 21 | work with modifications, whether created in whole or in part 22 | by me, under the same open source license (unless I am 23 | permitted to submit under a different license), as indicated 24 | in the file; or 25 | 26 | (c) The contribution was provided directly to me by some other 27 | person who certified (a), (b) or (c) and I have not modified 28 | it. 29 | 30 | (d) I understand and agree that this project and the contribution 31 | are public and that a record of the contribution (including all 32 | personal information I submit with it, including my sign-off) is 33 | maintained indefinitely and may be redistributed consistent with 34 | this project or the open source license(s) involved. 35 | 36 | Then, all your patches should contain a sign-off at the end of the patch/commit 37 | description body. It can be automatically added on adding `-s` parameter to 38 | `git commit`. 39 | 40 | This is an example of the aspect of the line: 41 | 42 | Signed-off-by: Andrey Antukh 43 | 44 | Please, use your real name (sorry, no pseudonyms or anonymous contributions 45 | are allowed). 46 | 47 | 48 | ## How to contribute ## 49 | 50 | > **WARNING** 51 | > 52 | > The project is still in a **design phase of the development** and 53 | > pull-requests with new functionality without previous chat are very 54 | > discouraged. 55 | 56 | If you have an idea and think that it would be awesome to have implemented in 57 | _uxbox_ or you have some time and you want contribute doing some bugfixing or 58 | implementing some small task, **please open an issue and discuss it**. 59 | 60 | No pull-request will be accepted without previous chat about the changes; 61 | independently if it is a new feature, already planned feature, small task or 62 | bug fix. The coordination is key for avoid doing double work. 63 | 64 | 65 | ## Code of conduct ## 66 | 67 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 68 | 69 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 70 | 71 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 72 | 73 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 74 | 75 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. 76 | 77 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 78 | 79 | This Code of Conduct is adapted from the Contributor Covenant, version 1.1.0, available from http://contributor-covenant.org/version/1/1/0/ 80 | -------------------------------------------------------------------------------- /docker/files/lein: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Ensure this file is executable via `chmod a+x lein`, then place it 4 | # somewhere on your $PATH, like ~/bin. The rest of Leiningen will be 5 | # installed upon first run into the ~/.lein/self-installs directory. 6 | 7 | export LEIN_VERSION="2.6.1" 8 | 9 | case $LEIN_VERSION in 10 | *SNAPSHOT) SNAPSHOT="YES" ;; 11 | *) SNAPSHOT="NO" ;; 12 | esac 13 | 14 | if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then 15 | delimiter=";" 16 | else 17 | delimiter=":" 18 | fi 19 | 20 | if [[ "$OSTYPE" == "cygwin" ]]; then 21 | cygwin=true 22 | else 23 | cygwin=false 24 | fi 25 | 26 | function command_not_found { 27 | >&2 echo "Leiningen coundn't find $1 in your \$PATH ($PATH), which is required." 28 | exit 1 29 | } 30 | 31 | function make_native_path { 32 | # ensure we have native paths 33 | if $cygwin && [[ "$1" == /* ]]; then 34 | echo -n "$(cygpath -wp "$1")" 35 | elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then 36 | echo -n "$(sh -c "(cd $1 2 /dev/null 81 | download_failed_message "$LEIN_URL" "$exit_code" 82 | exit 1 83 | fi 84 | } 85 | 86 | function check_root { 87 | local -i user_id 88 | # Thank you for the complexity, Solaris 89 | if [ `uname` = "SunOS" -a -x /usr/xpg4/bin/id ]; then 90 | user_id=$(/usr/xpg4/bin/id -u 2>/dev/null || echo 0) 91 | else 92 | user_id=$(id -u 2>/dev/null || echo 0) 93 | fi 94 | [ $user_id -eq 0 -a "$LEIN_ROOT" = "" ] && return 0 95 | return 1 96 | } 97 | 98 | if check_root; then 99 | echo "WARNING: You're currently running as root; probably by accident." 100 | echo "Press control-C to abort or Enter to continue as root." 101 | echo "Set LEIN_ROOT to disable this warning." 102 | read _ 103 | fi 104 | 105 | NOT_FOUND=1 106 | ORIGINAL_PWD="$PWD" 107 | while [ ! -r "$PWD/project.clj" ] && [ "$PWD" != "/" ] && [ $NOT_FOUND -ne 0 ] 108 | do 109 | cd .. 110 | if [ "$(dirname "$PWD")" = "/" ]; then 111 | NOT_FOUND=0 112 | cd "$ORIGINAL_PWD" 113 | fi 114 | done 115 | 116 | export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}" 117 | 118 | for f in "/etc/leinrc" "$LEIN_HOME/leinrc" ".leinrc"; do 119 | if [ -e "$f" ]; then 120 | source "$f" 121 | fi 122 | done 123 | 124 | if $cygwin; then 125 | export LEIN_HOME=$(cygpath -w "$LEIN_HOME") 126 | fi 127 | 128 | LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar" 129 | 130 | # normalize $0 on certain BSDs 131 | if [ "$(dirname "$0")" = "." ]; then 132 | SCRIPT="$(which "$(basename "$0")")" 133 | if [ -z "$SCRIPT" ]; then 134 | SCRIPT="$0" 135 | fi 136 | else 137 | SCRIPT="$0" 138 | fi 139 | 140 | # resolve symlinks to the script itself portably 141 | while [ -h "$SCRIPT" ] ; do 142 | ls=$(ls -ld "$SCRIPT") 143 | link=$(expr "$ls" : '.*-> \(.*\)$') 144 | if expr "$link" : '/.*' > /dev/null; then 145 | SCRIPT="$link" 146 | else 147 | SCRIPT="$(dirname "$SCRIPT"$)/$link" 148 | fi 149 | done 150 | 151 | BIN_DIR="$(dirname "$SCRIPT")" 152 | 153 | export LEIN_JVM_OPTS="${LEIN_JVM_OPTS-"-XX:+TieredCompilation -XX:TieredStopAtLevel=1"}" 154 | 155 | # This needs to be defined before we call HTTP_CLIENT below 156 | if [ "$HTTP_CLIENT" = "" ]; then 157 | if type -p curl >/dev/null 2>&1; then 158 | if [ "$https_proxy" != "" ]; then 159 | CURL_PROXY="-x $https_proxy" 160 | fi 161 | HTTP_CLIENT="curl $CURL_PROXY -f -L -o" 162 | else 163 | HTTP_CLIENT="wget -O" 164 | fi 165 | fi 166 | 167 | 168 | # When :eval-in :classloader we need more memory 169 | grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null && \ 170 | export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Xms64m -Xmx512m" 171 | 172 | if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then 173 | # Running from source checkout 174 | LEIN_DIR="$(dirname "$BIN_DIR")" 175 | 176 | # Need to use lein release to bootstrap the leiningen-core library (for aether) 177 | if [ ! -r "$LEIN_DIR/leiningen-core/.lein-bootstrap" ]; then 178 | echo "Leiningen is missing its dependencies." 179 | echo "Please run \"lein bootstrap\" in the leiningen-core/ directory" 180 | echo "with a stable release of Leiningen. See CONTRIBUTING.md for details." 181 | exit 1 182 | fi 183 | 184 | # If project.clj for lein or leiningen-core changes, we must recalculate 185 | LAST_PROJECT_CHECKSUM=$(cat "$LEIN_DIR/.lein-project-checksum" 2> /dev/null) 186 | PROJECT_CHECKSUM=$(sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj") 187 | if [ "$PROJECT_CHECKSUM" != "$LAST_PROJECT_CHECKSUM" ]; then 188 | if [ -r "$LEIN_DIR/.lein-classpath" ]; then 189 | rm "$LEIN_DIR/.lein-classpath" 190 | fi 191 | fi 192 | 193 | # Use bin/lein to calculate its own classpath. 194 | if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then 195 | echo "Recalculating Leiningen's classpath." 196 | ORIG_PWD="$PWD" 197 | cd "$LEIN_DIR" 198 | 199 | LEIN_NO_USER_PROFILES=1 $0 classpath .lein-classpath 200 | sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj" > \ 201 | .lein-project-checksum 202 | cd "$ORIG_PWD" 203 | fi 204 | 205 | mkdir -p "$LEIN_DIR/target/classes" 206 | export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Dclojure.compile.path=$LEIN_DIR/target/classes" 207 | add_path CLASSPATH "$LEIN_DIR/leiningen-core/src/" "$LEIN_DIR/leiningen-core/resources/" \ 208 | "$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources" 209 | 210 | if [ -r "$LEIN_DIR/.lein-classpath" ]; then 211 | add_path CLASSPATH "$(cat "$LEIN_DIR/.lein-classpath" 2> /dev/null)" 212 | else 213 | add_path CLASSPATH "$(cat "$LEIN_DIR/leiningen-core/.lein-bootstrap" 2> /dev/null)" 214 | fi 215 | else # Not running from a checkout 216 | add_path CLASSPATH "$LEIN_JAR" 217 | 218 | BOOTCLASSPATH="-Xbootclasspath/a:$LEIN_JAR" 219 | 220 | if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then 221 | self_install 222 | fi 223 | fi 224 | 225 | if [ ! -x "$JAVA_CMD" ] && ! type -f java >/dev/null 226 | then 227 | >&2 echo "Leiningen coundn't find 'java' executable, which is required." 228 | >&2 echo "Please either set JAVA_CMD or put java (>=1.6) in your \$PATH ($PATH)." 229 | exit 1 230 | fi 231 | 232 | export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-java}}" 233 | 234 | if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then 235 | export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')" 236 | export DRIP_INIT_CLASS="clojure.main" 237 | fi 238 | 239 | # Support $JAVA_OPTS for backwards-compatibility. 240 | export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}" 241 | 242 | # Handle jline issue with cygwin not propagating OSTYPE through java subprocesses: https://github.com/jline/jline2/issues/62 243 | cygterm=false 244 | if $cygwin; then 245 | case "$TERM" in 246 | rxvt* | xterm* | vt*) cygterm=true ;; 247 | esac 248 | fi 249 | 250 | if $cygterm; then 251 | LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Djline.terminal=jline.UnixTerminal" 252 | stty -icanon min 1 -echo > /dev/null 2>&1 253 | fi 254 | 255 | # TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html 256 | # If you're packaging this for a package manager (.deb, homebrew, etc) 257 | # you need to remove the self-install and upgrade functionality or see lein-pkg. 258 | if [ "$1" = "self-install" ]; then 259 | if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then 260 | echo "Running self-install from a checkout is not supported." 261 | echo "See CONTRIBUTING.md for SNAPSHOT-specific build instructions." 262 | exit 1 263 | fi 264 | echo "Manual self-install is deprecated; it will run automatically when necessary." 265 | self_install 266 | elif [ "$1" = "upgrade" ] || [ "$1" = "downgrade" ]; then 267 | if [ "$LEIN_DIR" != "" ]; then 268 | echo "The upgrade task is not meant to be run from a checkout." 269 | exit 1 270 | fi 271 | if [ $SNAPSHOT = "YES" ]; then 272 | echo "The upgrade task is only meant for stable releases." 273 | echo "See the \"Bootstrapping\" section of CONTRIBUTING.md." 274 | exit 1 275 | fi 276 | if [ ! -w "$SCRIPT" ]; then 277 | echo "You do not have permission to upgrade the installation in $SCRIPT" 278 | exit 1 279 | else 280 | TARGET_VERSION="${2:-stable}" 281 | echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version." 282 | echo -n "Do you want to continue [Y/n]? " 283 | read RESP 284 | case "$RESP" in 285 | y|Y|"") 286 | echo 287 | echo "Upgrading..." 288 | TARGET="/tmp/lein-$$-upgrade" 289 | if $cygwin; then 290 | TARGET=$(cygpath -w "$TARGET") 291 | fi 292 | LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein" 293 | $HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL" 294 | if [ $? == 0 ]; then 295 | cmp -s "$TARGET" "$SCRIPT" 296 | if [ $? == 0 ]; then 297 | echo "Leiningen is already up-to-date." 298 | fi 299 | mv "$TARGET" "$SCRIPT" && chmod +x "$SCRIPT" 300 | exec "$SCRIPT" version 301 | else 302 | download_failed_message "$LEIN_SCRIPT_URL" 303 | fi;; 304 | *) 305 | echo "Aborted." 306 | exit 1;; 307 | esac 308 | fi 309 | else 310 | if $cygwin; then 311 | # When running on Cygwin, use Windows-style paths for java 312 | ORIGINAL_PWD=$(cygpath -w "$ORIGINAL_PWD") 313 | fi 314 | 315 | # apply context specific CLASSPATH entries 316 | if [ -f .lein-classpath ]; then 317 | add_path CLASSPATH "$(cat .lein-classpath)" 318 | fi 319 | 320 | if [ -n "$DEBUG" ]; then 321 | echo "Leiningen's classpath: $CLASSPATH" 322 | fi 323 | 324 | if [ -r .lein-fast-trampoline ]; then 325 | export LEIN_FAST_TRAMPOLINE='y' 326 | fi 327 | 328 | if [ "$LEIN_FAST_TRAMPOLINE" != "" ] && [ -r project.clj ]; then 329 | INPUTS="$* $(cat project.clj) $LEIN_VERSION $(test -f "$LEIN_HOME/profiles.clj" && cat "$LEIN_HOME/profiles.clj")" 330 | 331 | if command -v shasum >/dev/null 2>&1; then 332 | SUM="shasum" 333 | elif command -v sha1sum >/dev/null 2>&1; then 334 | SUM="sha1sum" 335 | else 336 | command_not_found "sha1sum or shasum" 337 | fi 338 | 339 | export INPUT_CHECKSUM=$(echo "$INPUTS" | $SUM | cut -f 1 -d " ") 340 | # Just don't change :target-path in project.clj, mkay? 341 | TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM" 342 | else 343 | if hash mktemp 2>/dev/null; then 344 | # Check if mktemp is available before using it 345 | TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)" 346 | else 347 | TRAMPOLINE_FILE="/tmp/lein-trampoline-$$" 348 | fi 349 | trap "rm -f $TRAMPOLINE_FILE" EXIT 350 | fi 351 | 352 | if $cygwin; then 353 | TRAMPOLINE_FILE=$(cygpath -w "$TRAMPOLINE_FILE") 354 | fi 355 | 356 | if [ "$INPUT_CHECKSUM" != "" ] && [ -r "$TRAMPOLINE_FILE" ]; then 357 | if [ -n "$DEBUG" ]; then 358 | echo "Fast trampoline with $TRAMPOLINE_FILE." 359 | fi 360 | exec sh -c "exec $(cat "$TRAMPOLINE_FILE")" 361 | else 362 | export TRAMPOLINE_FILE 363 | "$LEIN_JAVA_CMD" \ 364 | "${BOOTCLASSPATH[@]}" \ 365 | -Dfile.encoding=UTF-8 \ 366 | -Dmaven.wagon.http.ssl.easy=false \ 367 | -Dmaven.wagon.rto=10000 \ 368 | $LEIN_JVM_OPTS \ 369 | -Dleiningen.original.pwd="$ORIGINAL_PWD" \ 370 | -Dleiningen.script="$SCRIPT" \ 371 | -classpath "$CLASSPATH" \ 372 | clojure.main -m leiningen.core.main "$@" 373 | 374 | EXIT_CODE=$? 375 | 376 | if $cygterm ; then 377 | stty icanon echo > /dev/null 2>&1 378 | fi 379 | 380 | ## TODO: [ -r "$TRAMPOLINE_FILE" ] may be redundant? A trampoline file 381 | ## is always generated these days. 382 | if [ -r "$TRAMPOLINE_FILE" ] && [ "$LEIN_TRAMPOLINE_WARMUP" = "" ]; then 383 | TRAMPOLINE="$(cat "$TRAMPOLINE_FILE")" 384 | if [ "$INPUT_CHECKSUM" = "" ]; then 385 | rm "$TRAMPOLINE_FILE" 386 | fi 387 | if [ "$TRAMPOLINE" = "" ]; then 388 | exit $EXIT_CODE 389 | else 390 | exec sh -c "exec $TRAMPOLINE" 391 | fi 392 | else 393 | exit $EXIT_CODE 394 | fi 395 | fi 396 | fi 397 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /docker/files/postgresql.conf: -------------------------------------------------------------------------------- 1 | # ----------------------------- 2 | # PostgreSQL configuration file 3 | # ----------------------------- 4 | # 5 | # This file consists of lines of the form: 6 | # 7 | # name = value 8 | # 9 | # (The "=" is optional.) Whitespace may be used. Comments are introduced with 10 | # "#" anywhere on a line. The complete list of parameter names and allowed 11 | # values can be found in the PostgreSQL documentation. 12 | # 13 | # The commented-out settings shown in this file represent the default values. 14 | # Re-commenting a setting is NOT sufficient to revert it to the default value; 15 | # you need to reload the server. 16 | # 17 | # This file is read on server startup and when the server receives a SIGHUP 18 | # signal. If you edit the file on a running system, you have to SIGHUP the 19 | # server for the changes to take effect, or use "pg_ctl reload". Some 20 | # parameters, which are marked below, require a server shutdown and restart to 21 | # take effect. 22 | # 23 | # Any parameter can also be given as a command-line option to the server, e.g., 24 | # "postgres -c log_connections=on". Some parameters can be changed at run time 25 | # with the "SET" SQL command. 26 | # 27 | # Memory units: kB = kilobytes Time units: ms = milliseconds 28 | # MB = megabytes s = seconds 29 | # GB = gigabytes min = minutes 30 | # TB = terabytes h = hours 31 | # d = days 32 | 33 | 34 | #------------------------------------------------------------------------------ 35 | # FILE LOCATIONS 36 | #------------------------------------------------------------------------------ 37 | 38 | # The default values of these variables are driven from the -D command-line 39 | # option or PGDATA environment variable, represented here as ConfigDir. 40 | 41 | data_directory = '/var/lib/postgresql/9.5/main' # use data in another directory 42 | # (change requires restart) 43 | hba_file = '/etc/postgresql/9.5/main/pg_hba.conf' # host-based authentication file 44 | # (change requires restart) 45 | ident_file = '/etc/postgresql/9.5/main/pg_ident.conf' # ident configuration file 46 | # (change requires restart) 47 | 48 | # If external_pid_file is not explicitly set, no extra PID file is written. 49 | external_pid_file = '/var/run/postgresql/9.5-main.pid' # write an extra PID file 50 | # (change requires restart) 51 | 52 | 53 | #------------------------------------------------------------------------------ 54 | # CONNECTIONS AND AUTHENTICATION 55 | #------------------------------------------------------------------------------ 56 | 57 | # - Connection Settings - 58 | 59 | #listen_addresses = 'localhost' # what IP address(es) to listen on; 60 | # comma-separated list of addresses; 61 | # defaults to 'localhost'; use '*' for all 62 | # (change requires restart) 63 | port = 5432 # (change requires restart) 64 | max_connections = 100 # (change requires restart) 65 | # Note: Increasing max_connections costs ~400 bytes of shared memory per 66 | # connection slot, plus lock space (see max_locks_per_transaction). 67 | #superuser_reserved_connections = 3 # (change requires restart) 68 | unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories 69 | # (change requires restart) 70 | #unix_socket_group = '' # (change requires restart) 71 | #unix_socket_permissions = 0777 # begin with 0 to use octal notation 72 | # (change requires restart) 73 | #bonjour = off # advertise server via Bonjour 74 | # (change requires restart) 75 | #bonjour_name = '' # defaults to the computer name 76 | # (change requires restart) 77 | 78 | # - Security and Authentication - 79 | 80 | #authentication_timeout = 1min # 1s-600s 81 | ssl = true # (change requires restart) 82 | #ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers 83 | # (change requires restart) 84 | #ssl_prefer_server_ciphers = on # (change requires restart) 85 | #ssl_ecdh_curve = 'prime256v1' # (change requires restart) 86 | ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart) 87 | ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart) 88 | #ssl_ca_file = '' # (change requires restart) 89 | #ssl_crl_file = '' # (change requires restart) 90 | #password_encryption = on 91 | #db_user_namespace = off 92 | #row_security = on 93 | 94 | # GSSAPI using Kerberos 95 | #krb_server_keyfile = '' 96 | #krb_caseins_users = off 97 | 98 | # - TCP Keepalives - 99 | # see "man 7 tcp" for details 100 | 101 | #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; 102 | # 0 selects the system default 103 | #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; 104 | # 0 selects the system default 105 | #tcp_keepalives_count = 0 # TCP_KEEPCNT; 106 | # 0 selects the system default 107 | 108 | 109 | #------------------------------------------------------------------------------ 110 | # RESOURCE USAGE (except WAL) 111 | #------------------------------------------------------------------------------ 112 | 113 | # - Memory - 114 | 115 | shared_buffers = 256MB # min 128kB 116 | # (change requires restart) 117 | #huge_pages = try # on, off, or try 118 | # (change requires restart) 119 | #temp_buffers = 8MB # min 800kB 120 | #max_prepared_transactions = 0 # zero disables the feature 121 | # (change requires restart) 122 | # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory 123 | # per transaction slot, plus lock space (see max_locks_per_transaction). 124 | # It is not advisable to set max_prepared_transactions nonzero unless you 125 | # actively intend to use prepared transactions. 126 | #work_mem = 4MB # min 64kB 127 | #maintenance_work_mem = 64MB # min 1MB 128 | #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem 129 | #max_stack_depth = 2MB # min 100kB 130 | dynamic_shared_memory_type = posix # the default is the first option 131 | # supported by the operating system: 132 | # posix 133 | # sysv 134 | # windows 135 | # mmap 136 | # use none to disable dynamic shared memory 137 | 138 | # - Disk - 139 | 140 | #temp_file_limit = -1 # limits per-session temp file space 141 | # in kB, or -1 for no limit 142 | 143 | # - Kernel Resource Usage - 144 | 145 | #max_files_per_process = 1000 # min 25 146 | # (change requires restart) 147 | #shared_preload_libraries = '' # (change requires restart) 148 | 149 | # - Cost-Based Vacuum Delay - 150 | 151 | #vacuum_cost_delay = 0 # 0-100 milliseconds 152 | #vacuum_cost_page_hit = 1 # 0-10000 credits 153 | #vacuum_cost_page_miss = 10 # 0-10000 credits 154 | #vacuum_cost_page_dirty = 20 # 0-10000 credits 155 | #vacuum_cost_limit = 200 # 1-10000 credits 156 | 157 | # - Background Writer - 158 | 159 | #bgwriter_delay = 200ms # 10-10000ms between rounds 160 | #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round 161 | #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round 162 | 163 | # - Asynchronous Behavior - 164 | 165 | #effective_io_concurrency = 1 # 1-1000; 0 disables prefetching 166 | #max_worker_processes = 8 167 | 168 | 169 | #------------------------------------------------------------------------------ 170 | # WRITE AHEAD LOG 171 | #------------------------------------------------------------------------------ 172 | 173 | # - Settings - 174 | 175 | #wal_level = minimal # minimal, archive, hot_standby, or logical 176 | # (change requires restart) 177 | #fsync = on # turns forced synchronization on or off 178 | synchronous_commit = off # synchronization level; 179 | # off, local, remote_write, or on 180 | #wal_sync_method = fsync # the default is the first option 181 | # supported by the operating system: 182 | # open_datasync 183 | # fdatasync (default on Linux) 184 | # fsync 185 | # fsync_writethrough 186 | # open_sync 187 | #full_page_writes = on # recover from partial page writes 188 | #wal_compression = off # enable compression of full-page writes 189 | #wal_log_hints = off # also do full page writes of non-critical updates 190 | # (change requires restart) 191 | #wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers 192 | # (change requires restart) 193 | wal_writer_delay = 300ms # 1-10000 milliseconds 194 | 195 | #commit_delay = 0 # range 0-100000, in microseconds 196 | #commit_siblings = 5 # range 1-1000 197 | 198 | # - Checkpoints - 199 | 200 | #checkpoint_timeout = 5min # range 30s-1h 201 | #max_wal_size = 1GB 202 | #min_wal_size = 80MB 203 | #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 204 | #checkpoint_warning = 30s # 0 disables 205 | 206 | # - Archiving - 207 | 208 | #archive_mode = off # enables archiving; off, on, or always 209 | # (change requires restart) 210 | #archive_command = '' # command to use to archive a logfile segment 211 | # placeholders: %p = path of file to archive 212 | # %f = file name only 213 | # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' 214 | #archive_timeout = 0 # force a logfile segment switch after this 215 | # number of seconds; 0 disables 216 | 217 | 218 | #------------------------------------------------------------------------------ 219 | # REPLICATION 220 | #------------------------------------------------------------------------------ 221 | 222 | # - Sending Server(s) - 223 | 224 | # Set these on the master and on any standby that will send replication data. 225 | 226 | #max_wal_senders = 0 # max number of walsender processes 227 | # (change requires restart) 228 | #wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables 229 | #wal_sender_timeout = 60s # in milliseconds; 0 disables 230 | 231 | #max_replication_slots = 0 # max number of replication slots 232 | # (change requires restart) 233 | #track_commit_timestamp = off # collect timestamp of transaction commit 234 | # (change requires restart) 235 | 236 | # - Master Server - 237 | 238 | # These settings are ignored on a standby server. 239 | 240 | #synchronous_standby_names = '' # standby servers that provide sync rep 241 | # comma-separated list of application_name 242 | # from standby(s); '*' = all 243 | #vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed 244 | 245 | # - Standby Servers - 246 | 247 | # These settings are ignored on a master server. 248 | 249 | #hot_standby = off # "on" allows queries during recovery 250 | # (change requires restart) 251 | #max_standby_archive_delay = 30s # max delay before canceling queries 252 | # when reading WAL from archive; 253 | # -1 allows indefinite delay 254 | #max_standby_streaming_delay = 30s # max delay before canceling queries 255 | # when reading streaming WAL; 256 | # -1 allows indefinite delay 257 | #wal_receiver_status_interval = 10s # send replies at least this often 258 | # 0 disables 259 | #hot_standby_feedback = off # send info from standby to prevent 260 | # query conflicts 261 | #wal_receiver_timeout = 60s # time that receiver waits for 262 | # communication from master 263 | # in milliseconds; 0 disables 264 | #wal_retrieve_retry_interval = 5s # time to wait before retrying to 265 | # retrieve WAL after a failed attempt 266 | 267 | 268 | #------------------------------------------------------------------------------ 269 | # QUERY TUNING 270 | #------------------------------------------------------------------------------ 271 | 272 | # - Planner Method Configuration - 273 | 274 | #enable_bitmapscan = on 275 | #enable_hashagg = on 276 | #enable_hashjoin = on 277 | #enable_indexscan = on 278 | #enable_indexonlyscan = on 279 | #enable_material = on 280 | #enable_mergejoin = on 281 | #enable_nestloop = on 282 | #enable_seqscan = on 283 | #enable_sort = on 284 | #enable_tidscan = on 285 | 286 | # - Planner Cost Constants - 287 | 288 | #seq_page_cost = 1.0 # measured on an arbitrary scale 289 | #random_page_cost = 4.0 # same scale as above 290 | #cpu_tuple_cost = 0.01 # same scale as above 291 | #cpu_index_tuple_cost = 0.005 # same scale as above 292 | #cpu_operator_cost = 0.0025 # same scale as above 293 | #effective_cache_size = 4GB 294 | 295 | # - Genetic Query Optimizer - 296 | 297 | #geqo = on 298 | #geqo_threshold = 12 299 | #geqo_effort = 5 # range 1-10 300 | #geqo_pool_size = 0 # selects default based on effort 301 | #geqo_generations = 0 # selects default based on effort 302 | #geqo_selection_bias = 2.0 # range 1.5-2.0 303 | #geqo_seed = 0.0 # range 0.0-1.0 304 | 305 | # - Other Planner Options - 306 | 307 | #default_statistics_target = 100 # range 1-10000 308 | #constraint_exclusion = partition # on, off, or partition 309 | #cursor_tuple_fraction = 0.1 # range 0.0-1.0 310 | #from_collapse_limit = 8 311 | #join_collapse_limit = 8 # 1 disables collapsing of explicit 312 | # JOIN clauses 313 | 314 | 315 | #------------------------------------------------------------------------------ 316 | # ERROR REPORTING AND LOGGING 317 | #------------------------------------------------------------------------------ 318 | 319 | # - Where to Log - 320 | 321 | log_destination = 'stderr' # Valid values are combinations of 322 | # stderr, csvlog, syslog, and eventlog, 323 | # depending on platform. csvlog 324 | # requires logging_collector to be on. 325 | 326 | # This is used when logging to stderr: 327 | logging_collector = on # Enable capturing of stderr and csvlog 328 | # into log files. Required to be on for 329 | # csvlogs. 330 | # (change requires restart) 331 | 332 | # These are only used if logging_collector is on: 333 | log_directory = 'pg_log' # directory where log files are written, 334 | # can be absolute or relative to PGDATA 335 | log_filename = 'postgresql-%Y-%m-%d.log' # log file name pattern, 336 | # can include strftime() escapes 337 | #log_file_mode = 0600 # creation mode for log files, 338 | # begin with 0 to use octal notation 339 | #log_truncate_on_rotation = off # If on, an existing log file with the 340 | # same name as the new log file will be 341 | # truncated rather than appended to. 342 | # But such truncation only occurs on 343 | # time-driven rotation, not on restarts 344 | # or size-driven rotation. Default is 345 | # off, meaning append to existing files 346 | # in all cases. 347 | #log_rotation_age = 1d # Automatic rotation of logfiles will 348 | # happen after that time. 0 disables. 349 | #log_rotation_size = 10MB # Automatic rotation of logfiles will 350 | # happen after that much log output. 351 | # 0 disables. 352 | 353 | # These are relevant when logging to syslog: 354 | #syslog_facility = 'LOCAL0' 355 | #syslog_ident = 'postgres' 356 | 357 | # This is only relevant when logging to eventlog (win32): 358 | #event_source = 'PostgreSQL' 359 | 360 | # - When to Log - 361 | 362 | #client_min_messages = notice # values in order of decreasing detail: 363 | # debug5 364 | # debug4 365 | # debug3 366 | # debug2 367 | # debug1 368 | # log 369 | # notice 370 | # warning 371 | # error 372 | 373 | #log_min_messages = warning # values in order of decreasing detail: 374 | # debug5 375 | # debug4 376 | # debug3 377 | # debug2 378 | # debug1 379 | # info 380 | # notice 381 | # warning 382 | # error 383 | # log 384 | # fatal 385 | # panic 386 | 387 | #log_min_error_statement = error # values in order of decreasing detail: 388 | # debug5 389 | # debug4 390 | # debug3 391 | # debug2 392 | # debug1 393 | # info 394 | # notice 395 | # warning 396 | # error 397 | # log 398 | # fatal 399 | # panic (effectively off) 400 | 401 | log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements 402 | # and their durations, > 0 logs only 403 | # statements running at least this number 404 | # of milliseconds 405 | 406 | 407 | # - What to Log - 408 | 409 | #debug_print_parse = off 410 | #debug_print_rewritten = off 411 | #debug_print_plan = off 412 | #debug_pretty_print = on 413 | #log_checkpoints = off 414 | #log_connections = off 415 | #log_disconnections = off 416 | #log_duration = off 417 | #log_error_verbosity = default # terse, default, or verbose messages 418 | #log_hostname = off 419 | log_line_prefix = '%t [%p-%l] %q%u@%d ' # special values: 420 | # %a = application name 421 | # %u = user name 422 | # %d = database name 423 | # %r = remote host and port 424 | # %h = remote host 425 | # %p = process ID 426 | # %t = timestamp without milliseconds 427 | # %m = timestamp with milliseconds 428 | # %i = command tag 429 | # %e = SQL state 430 | # %c = session ID 431 | # %l = session line number 432 | # %s = session start timestamp 433 | # %v = virtual transaction ID 434 | # %x = transaction ID (0 if none) 435 | # %q = stop here in non-session 436 | # processes 437 | # %% = '%' 438 | # e.g. '<%u%%%d> ' 439 | #log_lock_waits = off # log lock waits >= deadlock_timeout 440 | #log_statement = 'none' # none, ddl, mod, all 441 | #log_replication_commands = off 442 | #log_temp_files = -1 # log temporary files equal or larger 443 | # than the specified size in kilobytes; 444 | # -1 disables, 0 logs all temp files 445 | log_timezone = 'UTC' 446 | 447 | 448 | # - Process Title - 449 | 450 | #cluster_name = '' # added to process titles if nonempty 451 | # (change requires restart) 452 | #update_process_title = on 453 | 454 | 455 | #------------------------------------------------------------------------------ 456 | # RUNTIME STATISTICS 457 | #------------------------------------------------------------------------------ 458 | 459 | # - Query/Index Statistics Collector - 460 | 461 | #track_activities = on 462 | #track_counts = on 463 | #track_io_timing = off 464 | #track_functions = none # none, pl, all 465 | #track_activity_query_size = 1024 # (change requires restart) 466 | stats_temp_directory = '/var/run/postgresql/9.5-main.pg_stat_tmp' 467 | 468 | 469 | # - Statistics Monitoring - 470 | 471 | #log_parser_stats = off 472 | #log_planner_stats = off 473 | #log_executor_stats = off 474 | #log_statement_stats = off 475 | 476 | 477 | #------------------------------------------------------------------------------ 478 | # AUTOVACUUM PARAMETERS 479 | #------------------------------------------------------------------------------ 480 | 481 | #autovacuum = on # Enable autovacuum subprocess? 'on' 482 | # requires track_counts to also be on. 483 | #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and 484 | # their durations, > 0 logs only 485 | # actions running at least this number 486 | # of milliseconds. 487 | #autovacuum_max_workers = 3 # max number of autovacuum subprocesses 488 | # (change requires restart) 489 | #autovacuum_naptime = 1min # time between autovacuum runs 490 | #autovacuum_vacuum_threshold = 50 # min number of row updates before 491 | # vacuum 492 | #autovacuum_analyze_threshold = 50 # min number of row updates before 493 | # analyze 494 | #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum 495 | #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze 496 | #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum 497 | # (change requires restart) 498 | #autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age 499 | # before forced vacuum 500 | # (change requires restart) 501 | #autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for 502 | # autovacuum, in milliseconds; 503 | # -1 means use vacuum_cost_delay 504 | #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for 505 | # autovacuum, -1 means use 506 | # vacuum_cost_limit 507 | 508 | 509 | #------------------------------------------------------------------------------ 510 | # CLIENT CONNECTION DEFAULTS 511 | #------------------------------------------------------------------------------ 512 | 513 | # - Statement Behavior - 514 | 515 | #search_path = '"$user", public' # schema names 516 | #default_tablespace = '' # a tablespace name, '' uses the default 517 | #temp_tablespaces = '' # a list of tablespace names, '' uses 518 | # only default tablespace 519 | #check_function_bodies = on 520 | #default_transaction_isolation = 'read committed' 521 | #default_transaction_read_only = off 522 | #default_transaction_deferrable = off 523 | #session_replication_role = 'origin' 524 | #statement_timeout = 0 # in milliseconds, 0 is disabled 525 | #lock_timeout = 0 # in milliseconds, 0 is disabled 526 | #vacuum_freeze_min_age = 50000000 527 | #vacuum_freeze_table_age = 150000000 528 | #vacuum_multixact_freeze_min_age = 5000000 529 | #vacuum_multixact_freeze_table_age = 150000000 530 | #bytea_output = 'hex' # hex, escape 531 | #xmlbinary = 'base64' 532 | #xmloption = 'content' 533 | #gin_fuzzy_search_limit = 0 534 | #gin_pending_list_limit = 4MB 535 | 536 | # - Locale and Formatting - 537 | 538 | datestyle = 'iso, mdy' 539 | #intervalstyle = 'postgres' 540 | timezone = 'UTC' 541 | #timezone_abbreviations = 'Default' # Select the set of available time zone 542 | # abbreviations. Currently, there are 543 | # Default 544 | # Australia (historical usage) 545 | # India 546 | # You can create your own file in 547 | # share/timezonesets/. 548 | #extra_float_digits = 0 # min -15, max 3 549 | #client_encoding = sql_ascii # actually, defaults to database 550 | # encoding 551 | 552 | # These settings are initialized by initdb, but they can be changed. 553 | lc_messages = 'C' # locale for system error message 554 | # strings 555 | lc_monetary = 'C' # locale for monetary formatting 556 | lc_numeric = 'C' # locale for number formatting 557 | lc_time = 'C' # locale for time formatting 558 | 559 | # default configuration for text search 560 | default_text_search_config = 'pg_catalog.english' 561 | 562 | # - Other Defaults - 563 | 564 | #dynamic_library_path = '$libdir' 565 | #local_preload_libraries = '' 566 | #session_preload_libraries = '' 567 | 568 | 569 | #------------------------------------------------------------------------------ 570 | # LOCK MANAGEMENT 571 | #------------------------------------------------------------------------------ 572 | 573 | #deadlock_timeout = 1s 574 | #max_locks_per_transaction = 64 # min 10 575 | # (change requires restart) 576 | # Note: Each lock table slot uses ~270 bytes of shared memory, and there are 577 | # max_locks_per_transaction * (max_connections + max_prepared_transactions) 578 | # lock table slots. 579 | #max_pred_locks_per_transaction = 64 # min 10 580 | # (change requires restart) 581 | 582 | 583 | #------------------------------------------------------------------------------ 584 | # VERSION/PLATFORM COMPATIBILITY 585 | #------------------------------------------------------------------------------ 586 | 587 | # - Previous PostgreSQL Versions - 588 | 589 | #array_nulls = on 590 | #backslash_quote = safe_encoding # on, off, or safe_encoding 591 | #default_with_oids = off 592 | #escape_string_warning = on 593 | #lo_compat_privileges = off 594 | #operator_precedence_warning = off 595 | #quote_all_identifiers = off 596 | #sql_inheritance = on 597 | #standard_conforming_strings = on 598 | #synchronize_seqscans = on 599 | 600 | # - Other Platforms and Clients - 601 | 602 | #transform_null_equals = off 603 | 604 | 605 | #------------------------------------------------------------------------------ 606 | # ERROR HANDLING 607 | #------------------------------------------------------------------------------ 608 | 609 | #exit_on_error = off # terminate session on any error? 610 | #restart_after_crash = on # reinitialize after backend crash? 611 | 612 | 613 | #------------------------------------------------------------------------------ 614 | # CONFIG FILE INCLUDES 615 | #------------------------------------------------------------------------------ 616 | 617 | # These options allow settings to be loaded from files other than the 618 | # default postgresql.conf. 619 | 620 | #include_dir = 'conf.d' # include files ending in '.conf' from 621 | # directory 'conf.d' 622 | #include_if_exists = 'exists.conf' # include file only if it exists 623 | #include = 'special.conf' # include file 624 | 625 | 626 | #------------------------------------------------------------------------------ 627 | # CUSTOMIZED OPTIONS 628 | #------------------------------------------------------------------------------ 629 | 630 | # Add settings for extensions here 631 | --------------------------------------------------------------------------------