annotate compose2/preview/setup.sh @ 130:bf5f8acc35f2

DEP-12: improve compse setup.sh
author smith@nwoca.org
date Mon, 08 May 2017 18:25:23 +0100
parents 5c986cbb22b8
children a095257a342b
rev   line source
129
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
1 #!/bin/bash
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
2 # Sets up a new district project based on SSDT default configuration in the current working directory.
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
3 #
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
4 # Usage:
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
5 #
130
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
6 # /data/preview/sampletown $ /ssdt/compose2/preview/setup.sh
129
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
7 #
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
8 # Will create a docker-compose.yml and .env file with default settings.
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
9 #
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
10 #
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
11 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/.functions.sh"
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
12
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
13 base=$(dirname "${BASH_SOURCE[0]}")
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
14
130
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
15 echo "Preparing '$(basename $PWD)' with default USxS configuration"
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
16
129
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
17 if [ ! -e "docker-compose.yml" ] ; then
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
18 cp $base/usxs-template.yml ./docker-compose.yml
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
19 echo "created docker-compose.yml"
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
20 fi
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
21
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
22 touch .env
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
23
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
24 source .env
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
25
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
26 if [ "$COMPOSE_PROJECT_NAME" == "" ]
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
27 then
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
28 echo "COMPOSE_PROJECT_NAME=$(basename $PWD)" >> .env
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
29 echo "set project name in .env file"
130
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
30 source .env
129
5c986cbb22b8 DEP-12: add simple script to standardize setting up projects
smith@nwoca.org
parents:
diff changeset
31 fi
130
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
32
bf5f8acc35f2 DEP-12: improve compse setup.sh
smith@nwoca.org
parents: 129
diff changeset
33 echo "project '$COMPOSE_PROJECT_NAME' ready with default values. Review or create a docker-compose.override.yml for custom settings."