diff --git a/README.md b/README.md index 4f5fc4e6..f4dcaa56 100644 --- a/README.md +++ b/README.md @@ -4,37 +4,34 @@
Development - Build - Production
- ## 💻 Design and Development Time -During development, our data provider is a headless CMS, strapi. +During development, our data provider is a headless CMS, strapi. Note that it is used only during development and build time, not during production. - -By default, strapi listens on port 1337. If you're using WSL2 on Windows and also running Docker Desktop, port 1337 may not be available on your system. To use port 3000 instead, change this line in `config/server.js` file: +By default, strapi listens on port 1337. If you're using WSL2 on Windows and also running Docker Desktop, port 1337 may not be available on your system. To use port 3000 instead, change this line in `config/server.js` file: ``` port: env.int('PORT', 3000), ``` -Start strapi: +Start strapi: ``` git clone https://github.com/rocketchat/RC4Community @@ -44,10 +41,10 @@ INITIALIZE_DATA=true npm run develop ``` Note: -1. `INITIALIZE_DATA` environment variable is only needed the first time you startup the cms for development. It will seed the cms with a default set of components for you to start your own customization. (see [fetch data](https://github.com/RonLek/RC4Community/blob/master/cms/config/functions/fetchData.js) for the actual default initialization code) -2. On subsequent runs, if you want to activate Discourse Integration, set the environment variables `DISCOURSE_DOMAIN`, `DISCOURSE_API_USERNAME`, `DISCOURSE_API_KEY`. These environment variables are required for the cron job to fetch the latest top activity on discourse with the time interval of 5 mins. - +1. `INITIALIZE_DATA` environment variable is only needed the first time you start the cms for development. It will seed the cms with a default set of components for you to start your own customization. (see [fetch data](https://github.com/RonLek/RC4Community/blob/master/cms/config/functions/fetchData.js) for the actual default initialization code) +2. On subsequent runs, if you want to activate Discourse integration, set the environment variables `DISCOURSE_DOMAIN`, `DISCOURSE_API_USERNAME`, `DISCOURSE_API_KEY`. These environment variables are required for the cron job to fetch the latest top activity on discourse with the time interval of 5 mins. + The application is written on nextjs and deployable on all nextjs compatible CDN + microservices and scaled deployment platforms. For build and design, start it in a shell: ``` @@ -55,31 +52,31 @@ cd app npm i npm run dev ``` -You can use ethe environment variable `NEXT_PUBLIC_STRAPI_API_URL` to override the location of strapi cms, if it is not running on the same host. + +You can use the environment variable `NEXT_PUBLIC_STRAPI_API_URL` to override the location of strapi cms, if it is not running on the same host. ``` NEXT_PUBLIC_STRAPI_API_URL=http://127.0.0.1:1337 npm run dev ``` - Now RC4Community should be accessible from http://localhost:3000 You can now have designers and devs modify the portal content directly and independently from the dev and devOps folks working on the app. Devs can now enjoy the hot refresh and rapid iterations of the nextjs dev environment. +## 🛠 Application build time -## 🛠 Application build time - -This app is deployable on all nextjs compatible CDN + microservices and scaled deployment platforms. +This app is deployable on all nextjs compatible CDN + microservices and scaled deployment platforms. To build for deployment, first make sure cms (strapi) is up and running, then: + ``` cd app NEXT_PUBLIC_STRAPI_API_URL=http://localhost:1337 npm run build ``` -Upon successful build, the cms (strapi) is no longer needed for deployemnt. For example, you may want to deploy to vercel via a `git push`. +Upon successful build, the cms (strapi) is no longer needed for deployemnt. For example, you may want to deploy to vercel via a `git push`. For a workable but simple minded, non-scalable, never to be used in production deployment: @@ -90,12 +87,11 @@ NEXT_PUBLIC_STRAPI_API_URL=http://localhost:1337 npm run prod Again, note that cms/strapi is not required in production and should not be started. - -## 🗄 Deployment time (production deployment) +## 🗄 Deployment time (production deployment) Production should be deployed as a statically generated website (with associated microservices and/or serverless execution support). -Make sure you have build the bundle (with the cms running): +Make sure you have built the bundle (with the cms running): ``` cd app @@ -103,6 +99,6 @@ npm i NEXT_PUBLIC_STRAPI_API_URL=http://localhost:1337 npm run build ``` -Once you have finshed the build, the optimized files are ready in the `out` folder. You will no no longer need the CMS running and can stop strapi. This is key, deployment does not depend on the cms, in fact the same `tgz` can be immediately deployed to 1000s of smart edge nginx PoP as in modern CDNs. +Once you have finshed the build, the optimized files are ready in the `out` folder. You will no no longer need the CMS running and can stop strapi. This is key, deployment does not depend on the cms, in fact the same `tgz` can be immediately deployed to 1000s of smart edge nginx PoP as in modern CDNs. -Take a look at `deploy/deploy.sh` to see how to zip up the `out` content into a `site.tgz` file and transfer to your web server (such as nginx in this example) for deployment. +Take a look at `deploy/deploy.sh` to see how to zip up the `out` content into a `site.tgz` file and transfer to your web server (such as nginx in this example) for deployment.