portal-service v2.24.0
Portal Service
š There are lot of information about Portal Service in the Portals 2.0 knowledge-base.
Development
- You should have NodeJS LTS and Docker installed on your machine.
- Ensure that your
.npmrcis properly configured: https://nimbus.nimbusweb.me/space/1hud9hwogrlikxnc/page/j1rFDie5f9YuFJWk#b4108205607_76.NPM_TOKENandGITLAB_NPM_TOKENenv variables should be exposed to the shell. - Ensure that you're authenticated in the Fusebase Docker registry: https://nimbus.nimbusweb.me/space/1hud9hwogrlikxnc/page/j1rFDie5f9YuFJWk#b4102880193_89
- Install npm dependencies by running
npm install. - Enter the rebuild-on-change cycle by running
npm run watch. - Run
cp ./docker-compose.example.yml ./docker-compose.yml. It's hard to cover all the cases that may be needed during development, so you'll most likely need to adjust the configuration for your needs. - Set your DB credentials in the
docker-compose.ymlfile. - Run
cp ./config.local.example.js ./config.local.js - Run
docker compose upto start the development environment. NOTE: we should consider to modify docker-compose.yml to read env variables from user's shell.Another Docker Compose file
docker-compose.develop.ymlis needed only for Nimdev that isn't configured properly for this repository at this moment (Jul 3, 2024). - After making changes to the source code, you can restart the service by running
npm run docker:local:restart.
Custom Domains for Portals Using Cloudflare
Portal admins are able to set custom domains for their portals.
At the date of Jul 2, 2024, the
awsoption is used for PROD environment at AWS, and thecloudflarefor the new DEV environment at Google Cloud. In this paragraph we describe thecloudflareoption. Feel free to remove this note after PROD migration to Google Cloud.
Configuration
- At first, you should have a domain registered in Cloudflare.
- You should set the Fallback Origin in order to use the Custom Hostnames Cloudflare feature.
- At Cloudflare admin console home page select the account.
- Click Websites at the left sidebar and select the domain.
- Navigate to SSL/TLS -> Custom Hostnames
- Ensure that you have configured Fallback Origin e.g.
cname-portals.dev-thefusebase.com
In order to use custom domains for Portals, you need to set the following configuration params:
CNAME_TYPE=cloudflareCLOUDFLARE_ZONE_ID=<your_zone_id>. You can find it in the Cloudflare admin console, in the Overview tab for selected domain. Right hand column in the API section.CLOUDFLARE_API_TOKEN=<your_api_token>. You can create a new token in the Cloudflare admin console, in the My Profile tab, API Tokens section. You need to create a token with the following permissions:Zone : Zone Settings : ReadZone : SSL and Certificates : Edit- Select the specific zone you want to manage
š ļø Operations
CLOUDFLARE_ERROR code in the service logs or portals table failure column.
CLOUDFLARE_ERROR code is used to indicate that the custom domain is not configured properly.
You can try to get more error details by following these steps:
- At the Cloudflare admin console admin console select the account.
- Click Websites at the left sidebar and select the domain.
- Navigate to SSL/TLS -> Custom Hostnames
- Find the custom hostname in the list and click on it to see the details.
Useful Resources
- You can find the implementation details explanations in the video attached to the original JIRA task: https://nimbusweb.atlassian.net/browse/NIM-34519
- How Custom Domain feature is implemented for Organizations. We use almost identical setup for Portals: https://nimbus.nimbusweb.me/space/1hud9hwogrlikxnc/page/rWcYDTh1Vfhj6Fej