From 0b0546ef52405ab3328096c93d627a4cb01cdef2 Mon Sep 17 00:00:00 2001 From: cjpf Date: Thu, 14 Jul 2022 17:29:19 -0400 Subject: [PATCH 1/2] expanded pre-setup instructions --- Makefile | 2 +- README.md | 43 ++++++++++++++++++++++++++++++------- bin/gen_slack_manifest.sh | 4 ++-- localdev/backend.Dockerfile | 2 +- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 367a67d..3a36bd9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL := help .EXPORT_ALL_VARIABLES: UID = $(shell id -u) -AWS_REGION = us-east-2 +REGION = us-east-2 PROJECT_NAME = $(shell basename $(PWD)) PREFIX = $(shell jq -r '.application_namespace' < config.json) diff --git a/README.md b/README.md index 4fc1ca2..3ec0249 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,15 @@ ## Required software * gnu make +* nodejs +* npm * terraform * tfswitch * docker -* docker-compose +* docker-compose ~> 1.29 +* python ~> 3.9 +* python-poetry +* aws cli # Pre Setup (making this your own) @@ -30,7 +35,7 @@ export UID="$(id -u)" ``` ### Poetry -`poetry upgrade` +`poetry update` ## Run terraform ``` @@ -41,20 +46,28 @@ terraform plan -out plan.out terraform apply plan.out ``` -## initialize a blank ssm secret +## Initialize a blank ssm secret ``` -./bin/crypt.sh create +./bin/crypt.sh save ``` +Running this script the first time will create an empty `.secrets.json` file in your project, and then populate it with a secrets template. These secrets are put in the parameter store in AWS SSM. +These values will be filled in and updated in AWS SSM later. -## perform first deploy of of backend (needed to create slack app manifest) +## Install npm packages ``` -make deploy_all +npm install +``` + +## Build backend layer +``` +make backend_layer ``` ## Generate slack manifest ``` -make gen_slack_manifest +make gen_slack_manifest ``` +This will generate a slack manifest template for you to create your Slack App and generate the secrets stored in the AWS SSM Parameter store. ## Setup Slack App * Create two channels in your workspace, one as a primary channel for your app, @@ -74,6 +87,8 @@ make gen_slack_manifest and past into the window * ![Copy paste generated manifest data](./media/create_new_paste_manifest.png) +* Change all the `url` keys to `http://localhost` - this will be updated later. + * Finalize your app creation * ![Finalize](./media/create_new_finalize.png) @@ -102,7 +117,19 @@ of the application. You secrets json file should look like the first image. ./bin/crypt.sh save ``` -* Once they are saved, go your "App Manifest" section, and click the verify +After your secrets are saved, deploy the backend; +``` +make deploy_all +``` + +Now that the backend is in place, you can generate an updated manifest with the URL for your App's deployment; +``` +make gen_slack_manifest +``` + +Copy your new `slack/manifest.yml` file into your App's configuration. + +* Once the backend is built and your manifest is updated, go your "App Manifest" section, and click the verify location * ![verify](./media/verify_endpoint.png) diff --git a/bin/gen_slack_manifest.sh b/bin/gen_slack_manifest.sh index f728221..6698c88 100755 --- a/bin/gen_slack_manifest.sh +++ b/bin/gen_slack_manifest.sh @@ -8,7 +8,7 @@ CONF="${DIR}/config.json" SCONF="${DIR}/serverless.json" APP_NAME="$(jq -r '.slack_app_name' "$CONF")" -APP_DESCRTIPTION="$(jq -r '.slack_app_description' "$CONF")" +APP_DESCRIPTION="$(jq -r '.slack_app_description' "$CONF")" APP_SLACK_COMMAND="$(jq -r '.slack_slash_command' "$CONF")" URL="$(jq -r '.HttpApiUrl' "$SCONF")" @@ -16,7 +16,7 @@ URL="$(jq -r '.HttpApiUrl' "$SCONF")" TEMPLATE=$(cat < Date: Fri, 15 Jul 2022 00:42:56 -0400 Subject: [PATCH 2/2] reverted change on line 3 --- localdev/backend.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localdev/backend.Dockerfile b/localdev/backend.Dockerfile index 620f7b9..3b4f31f 100644 --- a/localdev/backend.Dockerfile +++ b/localdev/backend.Dockerfile @@ -1,6 +1,6 @@ FROM python:3.9-slim-bullseye -ARG UID=1000 +ARG UID RUN test "${UID}" || { echo "Failed to run with UID ${UID}"; exit 1; } RUN apt update && apt install -y python3-pip curl