From a3822a0b4b607eb2729fdf259a87293555e5a7a0 Mon Sep 17 00:00:00 2001 From: Ana Lizzi Date: Sun, 7 May 2023 12:04:03 -0400 Subject: [PATCH 1/4] Added initial scripts --- scripts/bootstrap | 7 +++++++ scripts/server | 8 ++++++++ scripts/update | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 scripts/bootstrap create mode 100644 scripts/server create mode 100644 scripts/update diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100644 index 0000000..cccae5d --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,7 @@ +#!/bin/bash + +if [-f .env]; then + echo ".env file already exists" +else + cp .env.sample .env +fi \ No newline at end of file diff --git a/scripts/server b/scripts/server new file mode 100644 index 0000000..1423715 --- /dev/null +++ b/scripts/server @@ -0,0 +1,8 @@ +#!/bin/sh + +# script/server: Launch the application and any extra required processes +# locally. + +set -e + +docker compose up \ No newline at end of file diff --git a/scripts/update b/scripts/update new file mode 100644 index 0000000..5cab1e5 --- /dev/null +++ b/scripts/update @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# Build React app +echo "==> Building Third-Places app..." +docker-compose build --no-cache \ No newline at end of file From 2fdeaa36d26f117cacac3681ec06e9de9f0eda90 Mon Sep 17 00:00:00 2001 From: Ana Lizzi Date: Sun, 7 May 2023 12:05:38 -0400 Subject: [PATCH 2/4] Updated readme for initial scripts --- README.md | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index c0bf52a..0a6f550 100644 --- a/README.md +++ b/README.md @@ -23,37 +23,23 @@ Please read the [contributing guidelines](https://github.com/CodeForPhilly/third You will need to have a working understanding of using a Unix-like system via a terminal or shell and the instructions below use Bash commands. In order to run this app, you will need to have the following libraries installed on your machine: -- Node: Javascript runtime -- npm: Node Package Manager -- Django: python web framework -- Python 3.9+ +- Docker [Install here](https://www.docker.com/products/docker-desktop/) -Note: These installations will not be required locally once we have the project containerized, the container will hand that. +### First time setup -### Create .env file - -#### Why a .env? -We will be using a `.env` file to share environment variables with each of the Docker containers and separate our environment variables from our code. - -#### Make the actual file - -Duplicate the `.env.sample` file and rename it to `.env` - -#### Note - -The `.env` file is ignored by git and so any changes will have to be communicated to the team to make sure API keys etc. stay aligned from dev to dev. +```sh +./scripts/bootstrap +./scripts/update +# This script will set up everything you need to get started. +``` ### Start the servers -To run all servers (React, Django, & PostgreSQL): ```sh -# Build the containers from images -docker-compose build -# Run the servers -docker-compose up - -# OR for a single command to do both -docker-compose up --build +# If you haven't updated in a while, run update script. +./scripts/update +# To run all servers (React, Django, & PostgreSQL): +./scripts/server ``` ### Port Numbers From 33d54ae783a5948de0f5c110cc6742cd26c8489e Mon Sep 17 00:00:00 2001 From: Max Temnogorod Date: Sun, 7 May 2023 12:45:24 -0400 Subject: [PATCH 3/4] Update script permissions `git update-index --chmod=+x scripts/*` --- scripts/bootstrap | 0 scripts/server | 0 scripts/update | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/bootstrap mode change 100644 => 100755 scripts/server mode change 100644 => 100755 scripts/update diff --git a/scripts/bootstrap b/scripts/bootstrap old mode 100644 new mode 100755 diff --git a/scripts/server b/scripts/server old mode 100644 new mode 100755 diff --git a/scripts/update b/scripts/update old mode 100644 new mode 100755 From ce1035dd1d6f9f9f55cdc9c54c92f7e13608a895 Mon Sep 17 00:00:00 2001 From: Ana Lizzi Date: Sun, 7 May 2023 13:57:44 -0400 Subject: [PATCH 4/4] Added soaces around -f .env --- scripts/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index cccae5d..a96240a 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -1,6 +1,6 @@ #!/bin/bash -if [-f .env]; then +if [ -f .env ]; then echo ".env file already exists" else cp .env.sample .env