From 4a226a93760a91a03e241e0621c0b6b65e0a4406 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 29 Dec 2022 06:31:43 +0000 Subject: [PATCH 01/18] rc4community-->rc4conf --- app/components/menubar.js | 4 ++-- app/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/menubar.js b/app/components/menubar.js index 1ba8b968..c29fda5d 100644 --- a/app/components/menubar.js +++ b/app/components/menubar.js @@ -33,7 +33,7 @@ export default function Menubar(props) { process.env.ROCKETCHAT_CLIENT_SECRET && process.env.ROCKETCHAT_URL; - if (!hasAllRequiredCreds) console.log("RC4Community is now using a dummy Auth Component! If you wish to use a robust Auth component, provide all the credentials first (https://github.com/RocketChat/RC4Community/tree/master/app/components/auth)") + if (!hasAllRequiredCreds) console.log("RC4Conferences is now using a dummy Auth Component! If you wish to use a robust Auth component, provide all the credentials first (https://github.com/RocketChat/RC4Community/tree/master/app/components/auth)") return ( @@ -107,7 +107,7 @@ export default function Menubar(props) { - RC4Community Profile + RC4Conferences Profile Profile diff --git a/app/package.json b/app/package.json index b7a3cf81..ddb2bd76 100644 --- a/app/package.json +++ b/app/package.json @@ -1,5 +1,5 @@ { - "name": "rc4community", + "name": "rc4conferences", "version": "0.3.0", "private": true, "scripts": { From c7c0a29c4d36cb2d467e269d3a52b7622c8f3157 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 29 Dec 2022 06:32:14 +0000 Subject: [PATCH 02/18] settings to prevent unncessary popups during startup added --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..0c878f12 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "workbench.startupEditor": "none" +} From e0c7343ed259541ef2acd70e72155b41fd3dc9e1 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Sat, 31 Dec 2022 06:23:56 +0000 Subject: [PATCH 03/18] added increase waittime logic incase gitpod requires more time to start --- superprofile/initFaunaOnce.sh | 41 +++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/superprofile/initFaunaOnce.sh b/superprofile/initFaunaOnce.sh index 19f77eb7..ffbc9b5d 100644 --- a/superprofile/initFaunaOnce.sh +++ b/superprofile/initFaunaOnce.sh @@ -27,20 +27,33 @@ sleep $waittime DBF="log/init_key_flag" container_name="faunadb" -healthy="healthy" -container_state="$( docker inspect -f '{{ .State.Health.Status }}' ${container_name} )" +constainer_health_status="starting" -if [ "$container_state" != $healthy ]; then - echo "Docker container needs extra startup time, please increase the \$waittlist value in initFaunaOnce.sh" - echo "Process ended with health status of Container: $container_state" -else - docker exec -it faunadb /bin/sh /var/log/faunadb/initialize.sh $1 - if [ -f log/dbkey ] && [ ! -f log/init_key_flag ]; then - echo "Copying over secrets to ../app/.env" - printf '\nNEXT_PUBLIC_FAUNA_SECRET=' | cat - ./log/dbkey >> ../app/.env - touch $DBF && - echo "-- All set, superprofile launch πŸš€" +check_and_start_fauna_container() { + container_state="$( docker inspect -f '{{ .State.Health.Status }}' ${container_name} )" + + if [ "$container_state" == $constainer_health_status ]; then + if [ "$counter" -lt $watchdog ]; then + counter=$((counter+1)) + waittime=$((waittime+5)) + echo "Increased wait time to $waittime seconds..." + sleep 5 + check_and_start_fauna_container + elif [ "$counter" -ge $watchdog ]; then + echo "Docker container needs extra startup time, please increase the \$waittlist value in initFaunaOnce.sh" + echo "Process ended with health status of Container: $container_state" + fi else - echo "-- Env variables are already copied, no need to copy over twice πŸ˜‰ --" + docker exec -it faunadb /bin/sh /var/log/faunadb/initialize.sh $1 + if [ -f log/dbkey ] && [ ! -f log/init_key_flag ]; then + echo "Copying over secrets to ../app/.env" + printf '\nNEXT_PUBLIC_FAUNA_SECRET=' | cat - ./log/dbkey >> ../app/.env + touch $DBF && + echo "-- All set, superprofile launch πŸš€" + else + echo "-- Env variables are already copied, no need to copy over twice πŸ˜‰ --" + fi fi -fi \ No newline at end of file +} + +check_and_start_fauna_container \ No newline at end of file From 1860d5c52193a156d43fe8a964922a5fcb35f6e6 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Sat, 31 Dec 2022 07:28:30 +0000 Subject: [PATCH 04/18] added init gitpod scripts --- .gitpod.yml | 59 +++++++++++++++++++ gitpod-scripts/startCloudContainers.sh | 39 ++++++++++++ gitpod-scripts/startCloudDevBackend.sh | 15 +++++ gitpod-scripts/startCloudDevEnv.sh | 43 ++++++++++++++ gitpod-scripts/startCloudDevStrapi.sh | 29 +++++++++ .../startCloudNext.sh | 18 ++++-- 6 files changed, 198 insertions(+), 5 deletions(-) create mode 100644 .gitpod.yml create mode 100644 gitpod-scripts/startCloudContainers.sh create mode 100644 gitpod-scripts/startCloudDevBackend.sh create mode 100644 gitpod-scripts/startCloudDevEnv.sh create mode 100644 gitpod-scripts/startCloudDevStrapi.sh rename startNextGp.sh => gitpod-scripts/startCloudNext.sh (77%) diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..a124b8de --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,59 @@ +tasks: + - name: Initialize Backend + init: | + docker pull fauna/faunadb:4.15.0 & + docker pull eventyay/open-event-server:master & + docker pull postgis/postgis:12-3.0-alpine & + docker pull redis:3-alpine + command: | + sh gitpod-scripts/startCloudDevBackend.sh + gp sync-done Initialization_of_Backend + - name: Initialize Next.js App + init: | + cd app + npm i + cd .. + command: | + gp sync-done Initialization_of_NextJS_Packages + + - name: Initialize Strapi App + init: | + cd cms + npm i + npm run build + cd .. + command: sh gitpod-scripts/startCloudDevStrapi.sh + + - name: Start build + command: | + printf "⚑️ Please wait while we're initializing these tasks for you... ⚑️\n" + gp tasks list + printf "\n" + gp sync-await Initialization_of_NextJS_Packages && + sh gitpod-scripts/startCloudDevEnv.sh + +ports: + - port: 3000 + onOpen: open-preview + name: RC4Conferences + description: Next.js app for RC4Conferences + - port: 1337 + onOpen: notify + name: Strapi + description: Strapi Dashboard + - port: 8084 + onOpen: ignore + - port: 8444 + onOpen: ignore + - port: 8443 + onOpen: ignore + +github: + prebuilds: + master: true + branches: true + pullRequests: true + pullRequestsFromForks: true + addCheck: true + addComment: true + addBadge: true \ No newline at end of file diff --git a/gitpod-scripts/startCloudContainers.sh b/gitpod-scripts/startCloudContainers.sh new file mode 100644 index 00000000..5d1fb203 --- /dev/null +++ b/gitpod-scripts/startCloudContainers.sh @@ -0,0 +1,39 @@ +#!/bin/sh +ERR_FILE=open-event-server/log/err_log.txt +INIT_DB=open-event-server/seed/init_db + +echo "--Starting the Open Event server--" +cd ../open-event-server +sh startOes.sh $1 $2 + +echo "--Starting Superprofile Backend--" +cd ../superprofile +sh initFaunaOnce.sh $1 $2 +cd ../gitpod-scripts + +OES_CONTAINER_ID=$( docker ps -q -f name=opev-web ) +FAUNA_CONTAINER_ID=$( docker ps -q -f name=faunadb ) + +if [ -s $ERR_FILE ];then + echo "\033[31m***Some error occurred while starting the Open Event Server please check open-event-server/$ERR_FILE , resolve them, and then re-run the init command***\e[0m" + exit 1 +fi +if [ -z $OES_CONTAINER_ID ]; then + echo "\033[31m***Open-event-server Docker container was unable to install and start, please rerun the script***\e[0m" + exit 1 +else + cd ../open-event-server + docker exec -it opev-postgres /bin/sh /var/log/seed/seed.sh + cd .. + if [ ! -e $INIT_DB ];then + echo "\033[31m***Open-event-server DB was not seeded with demo event, please check pg logs***\e[0m" + exit 1 + else + echo "--Successfully seeded the database with demo data--" + fi +fi +if [ -z $FAUNA_CONTAINER_ID ]; then + echo $FAUNA_CONTAINER_ID + echo "\033[31m***FaunaDB container was unable to install and start, please rerun the script***\e[0m" + exit 1 +fi diff --git a/gitpod-scripts/startCloudDevBackend.sh b/gitpod-scripts/startCloudDevBackend.sh new file mode 100644 index 00000000..6f3673e6 --- /dev/null +++ b/gitpod-scripts/startCloudDevBackend.sh @@ -0,0 +1,15 @@ +#!/bin/sh +watchtimer=0 + +sh startContainers.sh $1 $2 + +while [ $? -ne 0 ] && [ $watchtimer -lt 5 ] +do + watchtimer=$((watchtimer+1)) + sh startCloudContainers.sh $1 $2 +done + +if [ $? -eq 1 ];then + echo "\033[31m***Unable to successfully launch the superprofile or open-event-server container, please view the logs for more info and resolve&rerun the script***\e[0m" + exit 1 +fi diff --git a/gitpod-scripts/startCloudDevEnv.sh b/gitpod-scripts/startCloudDevEnv.sh new file mode 100644 index 00000000..f6dbe6c9 --- /dev/null +++ b/gitpod-scripts/startCloudDevEnv.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +trap_ctrlc () +{ + # perform cleanup here + echo "--performing clean up--" + chmod +x cleanup.sh + ls + sh cleanup.sh + + # exit shell script with error code 2 + # if omitted, shell script will continue execution + exit 2 +} + +# initialise trap to call trap_ctrlc function +# when signal 2 (SIGINT) is received +trap "trap_ctrlc" 2 + +version() { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + +echo "--Verifying the pre-requisites in the environment--" + +if ! which node > /dev/null; then + echo "\033[31m***NodeJS is not installed, please install and try again\e[31m" + exit 1 +fi + +if ! which npm > /dev/null; then + echo "\033[31m***npm is not installed, please install and try again\e[31m" + exit 1 +fi + +echo "--Checking Node version--" +NODE_VER=$( node -v | cut -c 2-9 ) +if [ $(version $NODE_VER) -ge $(version "16.0.0") ]; then + echo "***Node version is up to date" +else + echo "\033[31m***NodeJS version >= 16 is required for the application to work\e[31m" + exit 1 +fi + +sh startNextGp.sh \ No newline at end of file diff --git a/gitpod-scripts/startCloudDevStrapi.sh b/gitpod-scripts/startCloudDevStrapi.sh new file mode 100644 index 00000000..30baf180 --- /dev/null +++ b/gitpod-scripts/startCloudDevStrapi.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +counter=0 + +check_and_set_strapi_port() { + + if lsof -Pi :$STRAPI_PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt $watchdog ]; then + echo "Strapi port $STRAPI_PORT already occupied, changing to the next consecutive port" + STRAPI_PORT=$((STRAPI_PORT+1)) + counter=$((counter+1)) + check_and_set_strapi_port + elif [ "$counter" -ge $watchdog ]; then + echo "\033[31m Unable to allocate an empty port for Strapi, the last tried port was $STRAPI_PORT\e[0m" + echo "Please either change the $STRAPI_PORT to an other random number or to an unused port number" + exit 1 + else + echo "πŸš€ An empty port found for StrapiπŸš€" + fi +} + +check_and_set_strapi_port + +printf '\nNEXT_PUBLIC_STRAPI_API_URL'="http://$1:$STRAPI_PORT" >> app/.env +printf '\nNEXT_PUBLIC_EVENT_SPK_MAIL'="dhgysfmedomihkzkwv@kvhrr.com" >> app/.env +printf '\nNEXT_PUBLIC_EVENT_ANON_MAIL'="anon@pikapii.com" >> app/.env + +cd cms +export PORT=$STRAPI_PORT +INITIALIZE_DATA=true npm run develop \ No newline at end of file diff --git a/startNextGp.sh b/gitpod-scripts/startCloudNext.sh similarity index 77% rename from startNextGp.sh rename to gitpod-scripts/startCloudNext.sh index 040586c6..1b605e19 100644 --- a/startNextGp.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -1,4 +1,8 @@ +#!/bin/sh + NEXTJS_PORT=3000 +counter=0 +watchdog=5 check_and_set_next_port() { if lsof -Pi :$NEXTJS_PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt $watchdog ]; then @@ -12,21 +16,25 @@ check_and_set_next_port() { echo "After changes re-run the script" exit 1 else - echo "πŸš€ An empty port found for NextJS πŸš€" + printf "πŸš€ An empty port found for NextJS πŸš€ \n" fi } + check_and_set_next_port + export NEXT_PUBLIC_API_URL=$(gp url 3000) export NEXT_PUBLIC_FAUNA_DOMAIN=$(gp url 8084)/graphql gp ports visibility 8084:public export NEXT_PUBLIC_EVENT_BACKEND_URL=$(gp url 8080) gp ports visibility 8080:public - - export NEXT_PUBLIC_PORT=$NEXTJS_PORT printf '\nNEXT_PUBLIC_API_URL'="http://$1:$NEXTJS_PORT" >> app/.env -cd app -npm i +printf "\nPlease wait while we initialize strapi for development....πŸš€\n" +gp ports await 1337 + +printf "\nPlease wait while we initialize the backend....πŸš€\n" +gp sync-await Initialization_of_Backend +cd app && npm run dev \ No newline at end of file From 2f13781ca51d53e62a94b69b4f353f0f2b1f75a2 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Sat, 31 Dec 2022 08:50:04 +0000 Subject: [PATCH 05/18] fixed wrong shell script imports --- gitpod-scripts/startCloudDevBackend.sh | 2 +- gitpod-scripts/startCloudDevEnv.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitpod-scripts/startCloudDevBackend.sh b/gitpod-scripts/startCloudDevBackend.sh index 6f3673e6..31592dee 100644 --- a/gitpod-scripts/startCloudDevBackend.sh +++ b/gitpod-scripts/startCloudDevBackend.sh @@ -1,7 +1,7 @@ #!/bin/sh watchtimer=0 -sh startContainers.sh $1 $2 +sh startCloudContainers.sh $1 $2 while [ $? -ne 0 ] && [ $watchtimer -lt 5 ] do diff --git a/gitpod-scripts/startCloudDevEnv.sh b/gitpod-scripts/startCloudDevEnv.sh index f6dbe6c9..f68d5e8c 100644 --- a/gitpod-scripts/startCloudDevEnv.sh +++ b/gitpod-scripts/startCloudDevEnv.sh @@ -40,4 +40,4 @@ else exit 1 fi -sh startNextGp.sh \ No newline at end of file +sh startCloudNext.sh \ No newline at end of file From b0ebb8cbadc1b836448f151c0920c213d92b56a7 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Sat, 31 Dec 2022 08:53:49 +0000 Subject: [PATCH 06/18] cd added --- .gitpod.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index a124b8de..ec36729a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,8 +6,10 @@ tasks: docker pull postgis/postgis:12-3.0-alpine & docker pull redis:3-alpine command: | - sh gitpod-scripts/startCloudDevBackend.sh + cd gitpod-scripts + sh startCloudDevBackend.sh gp sync-done Initialization_of_Backend + cd .. - name: Initialize Next.js App init: | cd app From cd46c6b5ab51ad854c8188601a618d805f599259 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 14:48:22 +0000 Subject: [PATCH 07/18] fixed wrong paths and missing variables --- .gitpod.yml | 12 +++++++----- gitpod-scripts/startCloudDevStrapi.sh | 3 ++- superprofile/initFaunaOnce.sh | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index ec36729a..91b2cd6b 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -17,7 +17,7 @@ tasks: cd .. command: | gp sync-done Initialization_of_NextJS_Packages - + - name: Initialize Strapi App init: | cd cms @@ -25,14 +25,16 @@ tasks: npm run build cd .. command: sh gitpod-scripts/startCloudDevStrapi.sh - + - name: Start build command: | printf "⚑️ Please wait while we're initializing these tasks for you... ⚑️\n" gp tasks list printf "\n" - gp sync-await Initialization_of_NextJS_Packages && - sh gitpod-scripts/startCloudDevEnv.sh + gp sync-await Initialization_of_NextJS_Packages && + cd gitpod-scripts + sh startCloudDevEnv.sh + cd .. ports: - port: 3000 @@ -58,4 +60,4 @@ github: pullRequestsFromForks: true addCheck: true addComment: true - addBadge: true \ No newline at end of file + addBadge: true diff --git a/gitpod-scripts/startCloudDevStrapi.sh b/gitpod-scripts/startCloudDevStrapi.sh index 30baf180..2dfd6a73 100644 --- a/gitpod-scripts/startCloudDevStrapi.sh +++ b/gitpod-scripts/startCloudDevStrapi.sh @@ -1,9 +1,10 @@ #!/bin/sh counter=0 +STRAPI_PORT=1337 +watchdog=5 check_and_set_strapi_port() { - if lsof -Pi :$STRAPI_PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt $watchdog ]; then echo "Strapi port $STRAPI_PORT already occupied, changing to the next consecutive port" STRAPI_PORT=$((STRAPI_PORT+1)) diff --git a/superprofile/initFaunaOnce.sh b/superprofile/initFaunaOnce.sh index ffbc9b5d..d660616d 100644 --- a/superprofile/initFaunaOnce.sh +++ b/superprofile/initFaunaOnce.sh @@ -3,6 +3,9 @@ waittime=30 ALREADY_INITIALIZED="log/init_key_flag" +counter=0 +watchdog=6 + FAUNA_CONTAINER_ID=$( docker ps -q -f name=faunadb ) if [ -e $ALREADY_INITIALIZED ] && [ ! -z $FAUNA_CONTAINER_ID ]; then From 1c6ece0aac207341f52228c2d063a0ebf099d138 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 14:55:45 +0000 Subject: [PATCH 08/18] removed wrong changing directory step --- gitpod-scripts/startCloudNext.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 1b605e19..19ed7f19 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -35,6 +35,4 @@ printf "\nPlease wait while we initialize strapi for development....πŸš€\n" gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" -gp sync-await Initialization_of_Backend -cd app && -npm run dev \ No newline at end of file +gp sync-await Initialization_of_Backend && npm run dev \ No newline at end of file From 1c94654810dfb644feb61dd493ac03dc7de22769 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:18:20 +0000 Subject: [PATCH 09/18] Added synchronization for cleanup and package dependency checks --- .gitpod.yml | 10 ++++------ gitpod-scripts/startCloudDevEnv.sh | 2 ++ gitpod-scripts/startCloudNext.sh | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 91b2cd6b..0f69876a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,7 +7,7 @@ tasks: docker pull redis:3-alpine command: | cd gitpod-scripts - sh startCloudDevBackend.sh + gp sync-await Dependencies_Check && sh startCloudDevBackend.sh gp sync-done Initialization_of_Backend cd .. - name: Initialize Next.js App @@ -16,7 +16,7 @@ tasks: npm i cd .. command: | - gp sync-done Initialization_of_NextJS_Packages + gp sync-await Dependencies_Check && gp sync-done Initialization_of_NextJS_Packages - name: Initialize Strapi App init: | @@ -24,7 +24,7 @@ tasks: npm i npm run build cd .. - command: sh gitpod-scripts/startCloudDevStrapi.sh + command: gp sync-await Dependencies_Check && sh gitpod-scripts/startCloudDevStrapi.sh - name: Start build command: | @@ -32,9 +32,7 @@ tasks: gp tasks list printf "\n" gp sync-await Initialization_of_NextJS_Packages && - cd gitpod-scripts - sh startCloudDevEnv.sh - cd .. + sh gitpod-scripts/startCloudDevEnv.sh ports: - port: 3000 diff --git a/gitpod-scripts/startCloudDevEnv.sh b/gitpod-scripts/startCloudDevEnv.sh index f68d5e8c..5c1f5d2b 100644 --- a/gitpod-scripts/startCloudDevEnv.sh +++ b/gitpod-scripts/startCloudDevEnv.sh @@ -40,4 +40,6 @@ else exit 1 fi +gp sync-done Dependencies_Check + sh startCloudNext.sh \ No newline at end of file diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 19ed7f19..98392b77 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -35,4 +35,5 @@ printf "\nPlease wait while we initialize strapi for development....πŸš€\n" gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" +cd app gp sync-await Initialization_of_Backend && npm run dev \ No newline at end of file From ab8e0e11b1ebcad9eeee80af0e815acc8e1fa2f4 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:24:51 +0000 Subject: [PATCH 10/18] removed deadlock --- .gitpod.yml | 1 - gitpod-scripts/startCloudNext.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 0f69876a..0d74a75a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -31,7 +31,6 @@ tasks: printf "⚑️ Please wait while we're initializing these tasks for you... ⚑️\n" gp tasks list printf "\n" - gp sync-await Initialization_of_NextJS_Packages && sh gitpod-scripts/startCloudDevEnv.sh ports: diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 98392b77..e183c425 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -36,4 +36,4 @@ gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" cd app -gp sync-await Initialization_of_Backend && npm run dev \ No newline at end of file +gp sync-await Initialization_of_Backend && gp sync-await Initialization_of_NextJS_Packages && npm run dev \ No newline at end of file From 41ebdbf81947c88475d732dd760666941b4f07a1 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:32:15 +0000 Subject: [PATCH 11/18] fixed deadlock along with wrong directory --- .gitpod.yml | 3 ++- gitpod-scripts/startCloudNext.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 0d74a75a..588a1d07 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -31,7 +31,8 @@ tasks: printf "⚑️ Please wait while we're initializing these tasks for you... ⚑️\n" gp tasks list printf "\n" - sh gitpod-scripts/startCloudDevEnv.sh + cd gitpod-scripts + sh startCloudDevEnv.sh ports: - port: 3000 diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index e183c425..4f982f55 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -35,5 +35,5 @@ printf "\nPlease wait while we initialize strapi for development....πŸš€\n" gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" -cd app +cd ../app gp sync-await Initialization_of_Backend && gp sync-await Initialization_of_NextJS_Packages && npm run dev \ No newline at end of file From f6dea041848063bdf43a229e57c3f879fe3e87b1 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:35:02 +0000 Subject: [PATCH 12/18] exiting from gitpod-scripts directory to fix env variables exports --- gitpod-scripts/startCloudNext.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 4f982f55..d074e34a 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -4,6 +4,8 @@ NEXTJS_PORT=3000 counter=0 watchdog=5 +cd .. + check_and_set_next_port() { if lsof -Pi :$NEXTJS_PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt $watchdog ]; then echo "NextJS port $NEXTJS_PORT already occupied, changing to the next consecutive port" From d85f41af3e78e06ecf882cd7a070cfc9d6532651 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:40:14 +0000 Subject: [PATCH 13/18] changed visibility of port 3000 to public --- .gitpod.yml | 1 + gitpod-scripts/startCloudNext.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 588a1d07..1bd87f3e 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -36,6 +36,7 @@ tasks: ports: - port: 3000 + visibility : public onOpen: open-preview name: RC4Conferences description: Next.js app for RC4Conferences diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index d074e34a..96016448 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -37,5 +37,5 @@ printf "\nPlease wait while we initialize strapi for development....πŸš€\n" gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" -cd ../app +cd app gp sync-await Initialization_of_Backend && gp sync-await Initialization_of_NextJS_Packages && npm run dev \ No newline at end of file From 8dcde1609c2b242bb74458bf53987b3ac3668e79 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 15:59:52 +0000 Subject: [PATCH 14/18] gp urls not initiliazed bug fixed --- gitpod-scripts/startCloudNext.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 96016448..01aa871f 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -24,6 +24,9 @@ check_and_set_next_port() { check_and_set_next_port +gp ports await 1337 +gp sync-await Initialization_of_Backend && + export NEXT_PUBLIC_API_URL=$(gp url 3000) export NEXT_PUBLIC_FAUNA_DOMAIN=$(gp url 8084)/graphql gp ports visibility 8084:public @@ -34,8 +37,7 @@ export NEXT_PUBLIC_PORT=$NEXTJS_PORT printf '\nNEXT_PUBLIC_API_URL'="http://$1:$NEXTJS_PORT" >> app/.env printf "\nPlease wait while we initialize strapi for development....πŸš€\n" -gp ports await 1337 printf "\nPlease wait while we initialize the backend....πŸš€\n" cd app -gp sync-await Initialization_of_Backend && gp sync-await Initialization_of_NextJS_Packages && npm run dev \ No newline at end of file +gp sync-await Initialization_of_NextJS_Packages && npm run dev \ No newline at end of file From 017d0d18f7bd2051dc7e55bfed0566e15797113a Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 18:29:37 +0000 Subject: [PATCH 15/18] fixing domain for localhost --- gitpod-scripts/startCloudDevStrapi.sh | 5 ++++- gitpod-scripts/startCloudNext.sh | 3 +++ open-event-server/startOes.sh | 3 +++ superprofile/initFaunaOnce.sh | 5 ++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gitpod-scripts/startCloudDevStrapi.sh b/gitpod-scripts/startCloudDevStrapi.sh index 2dfd6a73..39fc6d2d 100644 --- a/gitpod-scripts/startCloudDevStrapi.sh +++ b/gitpod-scripts/startCloudDevStrapi.sh @@ -4,6 +4,9 @@ counter=0 STRAPI_PORT=1337 watchdog=5 +DOMAIN="localhost" +if [ ! -z "$1" ]; then DOMAIN="$1"; fi + check_and_set_strapi_port() { if lsof -Pi :$STRAPI_PORT -sTCP:LISTEN -t >/dev/null && [ "$counter" -lt $watchdog ]; then echo "Strapi port $STRAPI_PORT already occupied, changing to the next consecutive port" @@ -21,7 +24,7 @@ check_and_set_strapi_port() { check_and_set_strapi_port -printf '\nNEXT_PUBLIC_STRAPI_API_URL'="http://$1:$STRAPI_PORT" >> app/.env +printf '\nNEXT_PUBLIC_STRAPI_API_URL'="http://$DOMAIN:$STRAPI_PORT" >> app/.env printf '\nNEXT_PUBLIC_EVENT_SPK_MAIL'="dhgysfmedomihkzkwv@kvhrr.com" >> app/.env printf '\nNEXT_PUBLIC_EVENT_ANON_MAIL'="anon@pikapii.com" >> app/.env diff --git a/gitpod-scripts/startCloudNext.sh b/gitpod-scripts/startCloudNext.sh index 01aa871f..9b3c7f3f 100644 --- a/gitpod-scripts/startCloudNext.sh +++ b/gitpod-scripts/startCloudNext.sh @@ -4,6 +4,9 @@ NEXTJS_PORT=3000 counter=0 watchdog=5 +DOMAIN="localhost" +if [ ! -z "$1" ]; then DOMAIN="$1"; fi + cd .. check_and_set_next_port() { diff --git a/open-event-server/startOes.sh b/open-event-server/startOes.sh index f8fe4653..bca159f9 100644 --- a/open-event-server/startOes.sh +++ b/open-event-server/startOes.sh @@ -4,6 +4,9 @@ ERR_FILE="log/err_log.txt" INIT_FLAG="log/init_flag" OES_CONTAINER_ID=$( docker ps -q -f name=opev-web ) +DOMAIN="localhost" +if [ ! -z "$1" ]; then DOMAIN="$1"; fi + if [ -e $INIT_FLAG ] && [ ! -z $OES_CONTAINER_ID ]; then echo "-- Open Event Server is already up and running --" exit 0 diff --git a/superprofile/initFaunaOnce.sh b/superprofile/initFaunaOnce.sh index d660616d..9149804a 100644 --- a/superprofile/initFaunaOnce.sh +++ b/superprofile/initFaunaOnce.sh @@ -6,6 +6,9 @@ ALREADY_INITIALIZED="log/init_key_flag" counter=0 watchdog=6 +DOMAIN="localhost" +if [ ! -z "$1" ]; then DOMAIN="$1"; fi + FAUNA_CONTAINER_ID=$( docker ps -q -f name=faunadb ) if [ -e $ALREADY_INITIALIZED ] && [ ! -z $FAUNA_CONTAINER_ID ]; then @@ -22,7 +25,7 @@ else docker-compose -f docker-compose-dev.yml up -d echo "--Starting the development build of Superprofile--" echo "--Copying default environment variables to app/.env--" - printf '\nNEXT_PUBLIC_FAUNA_DOMAIN'="http://$1:8084/graphql" >> ../app/.env + printf '\nNEXT_PUBLIC_FAUNA_DOMAIN'="http://$DOMAIN:8084/graphql" >> ../app/.env fi echo "Waiting $waittime seconds for container to get shipped..." From 57e30211454950efddd30ec62cc39d491aa11646 Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 19:43:32 +0000 Subject: [PATCH 16/18] added exit to close terminals after execution --- .gitpod.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 1bd87f3e..679ff408 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,11 +10,13 @@ tasks: gp sync-await Dependencies_Check && sh startCloudDevBackend.sh gp sync-done Initialization_of_Backend cd .. + exit - name: Initialize Next.js App init: | cd app npm i cd .. + exit command: | gp sync-await Dependencies_Check && gp sync-done Initialization_of_NextJS_Packages From 85d635f9763e1cd3dec62ef2e833299c2c04729d Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Thu, 5 Jan 2023 19:50:02 +0000 Subject: [PATCH 17/18] exit in command --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 679ff408..09e84248 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -16,9 +16,9 @@ tasks: cd app npm i cd .. - exit command: | gp sync-await Dependencies_Check && gp sync-done Initialization_of_NextJS_Packages + exit - name: Initialize Strapi App init: | From a9ccb160c68a290d7bb01b81b1039c7ed68510ec Mon Sep 17 00:00:00 2001 From: PalanikannanM Date: Fri, 6 Jan 2023 04:13:23 +0000 Subject: [PATCH 18/18] Added readme for gitpod --- README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index da70969c..3f93d04c 100644 --- a/README.md +++ b/README.md @@ -30,16 +30,32 @@ Got questions? Or want to discuss any idea for the project, feel free to drop by # Instant Setup ~1.5 minutes To try out the project within minutes, run the following two bash commands, and you will be good to go: +Gitpod Setup + +Well...there's no setup needed here, we've taken care of setting everything up so that you can directly work on the code while we push the configuration πŸ˜‰ + +Start developing and make changes to your code via a single click **Anytime-Anywhere**! + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/RocketChat/RC4Conferences) + +__Well wait..what is Gitpod πŸ€”?__ + +[Gitpod](https://www.gitpod.io/docs/introduction/getting-started) is an Open Source Cloud Developer Environment, it's basically a pre-configured dev environment which we've setup for you! + +You can open RC4Conferences in Gitpod and work on [any IDE](https://www.gitpod.io/docs/references/ides-and-editors) of your choice ✨ + +Some *Recommendations* while using **Gitpod**: + +- Download the [gitpod browser extension](https://www.gitpod.io/docs/configure/user-settings/browser-extension) to start working on any branch, issue or PR via a single click in under a minute! +- To enjoy *BLAZINGLY FAST* startup times while developing on your forked branches, consider [enabling prebuilds by setting up a Project with your forked repository as a "Project"](https://www.gitpod.io/docs/configure/projects/prebuilds/#projects-and-prebuilds) + +--- Local Setup ```bash sh startdevenv.sh localhost sh startNext.sh localhost ``` -Gitpod Setup -```bash -sh startdevenv.sh localhost -sh startNextGp.sh localhost -``` + _Note: Please replace the "localhost" (127.0.0.1) with your static IP if you are doing environment setup on your VM. For e.g. `173.456.1.19`_ Now you can try out the following: