{"id":18510064,"url":"https://github.com/gitana/cloudcms-server","last_synced_at":"2025-04-09T04:33:04.070Z","repository":{"id":8007531,"uuid":"9415508","full_name":"gitana/cloudcms-server","owner":"gitana","description":"Cloud CMS application server module for Node.js / Express.  This module provides middleware for virtualized content retrieval, cluster-wide caching and broadcasting, tag processing and much more.  It is available to be used in building Node.js-based applications that run against Cloud CMS.","archived":false,"fork":false,"pushed_at":"2024-04-11T16:18:34.000Z","size":5090,"stargazers_count":19,"open_issues_count":4,"forks_count":15,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-15T11:25:31.838Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.cloudcms.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2013-04-13T15:19:57.000Z","updated_at":"2024-04-17T16:39:18.983Z","dependencies_parsed_at":"2023-01-13T15:00:31.980Z","dependency_job_id":"dc4cd67e-f651-4bf6-b224-b512728ae080","html_url":"https://github.com/gitana/cloudcms-server","commit_stats":{"total_commits":1172,"total_committers":12,"mean_commits":97.66666666666667,"dds":"0.35750853242320824","last_synced_commit":"325b77d27ed827a7d5f36b37c6600f19b5e9fb6f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fcloudcms-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fcloudcms-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fcloudcms-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fcloudcms-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitana","download_url":"https://codeload.github.com/gitana/cloudcms-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980831,"owners_count":21027803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T15:20:40.748Z","updated_at":"2025-04-09T04:33:04.047Z","avatar_url":"https://github.com/gitana.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"cloudcms-server\n===============\n\nA Node.js module that provides a framework and server-side functionality for Cloud CMS deployed Node.js applications.  This module provides the backbone capabilities for the application server tier of Cloud CMS as hosted at cloudcms.net.\n\nFor more information on Cloud CMS, please visit https://gitana.io.\n\n## Configuration\n\nThe start method takes a configuration object that enables, disables and provides settings for any underlying services.\n\nThis looks like:\n\n````\n{\n    \"setup\": \"single\", // single, cluster, redis\n    \"name\": \"Cloud CMS Application Server\",\n    \"socketFunctions\": [],\n    \"routeFunctions\": [],\n    \"errorFunctions\": [],\n    \"configureFunctions\": {},\n    \"beforeFunctions\": [],\n    \"afterFunctions\": [],\n    \"reportFunctions\": [],\n    \"initFunctions\": [],\n    \"viewEngine\": \"handlebars\",\n    \"storeEngines\": {\n        \"app\": {\n            \"type\": \"fs\",\n            \"config\": {\n                \"basePath\": \"{appBasePath}\"\n            }\n        },\n        \"tmp\": {\n            \"type\": \"fs\",\n            \"config\": {\n                \"basePath\": \"{tmpdirPath}/hosts/{host}\",\n                \"hostsPath\": \"{tmpdirPath}/hosts\"\n            }\n        },\n        \"hosts_fs\": {\n            \"type\": \"fs\",\n            \"config\": {\n                \"basePath\": \"{hostsPath}/{host}\",\n                \"hostsPath\": \"{hostsPath}\"\n            }\n        },\n        \"hosts_s3\": {\n            \"type\": \"s3\",\n            \"config\": {\n                \"accessKey\": \"\",\n                \"secretKey\": \"\",\n                \"bucket\": \"\",\n                \"basePath\": \"{hostsPath}/{host}\",\n                \"hostsPath\": \"{hostsPath}\"\n            }\n        },\n        \"hosts_s3fs\": {\n            \"type\": \"s3fs\",\n            \"config\": {\n                \"accessKey\": \"\",\n                \"secretKey\": \"\",\n                \"bucket\": \"\",\n                \"basePath\": \"{hostsPath}/{host}\",\n                \"hostsPath\": \"{hostsPath}\"\n            }\n        }\n    },\n    \"storeConfigurations\": {\n        \"default\": {\n            \"root\": \"app\",\n            \"config\": \"app\",\n            \"web\": \"app\",\n            \"content\": \"tmp\",\n            \"templates\": \"app\",\n            \"modules\": \"app\"\n        },\n        \"oneteam\": {\n            \"root\": \"hosts_fs\",\n            \"config\": \"app\",\n            \"web\": \"app\",\n            \"content\": \"hosts_fs\",\n            \"templates\": \"app\",\n            \"modules\": \"hosts_fs\"\n        },\n        \"net-development\": {\n            \"root\": \"hosts_fs\",\n            \"config\": \"hosts_fs\",\n            \"web\": \"hosts_fs\",\n            \"content\": \"hosts_fs\",\n            \"templates\": \"hosts_fs\",\n            \"modules\": \"hosts_fs\"\n        },\n        \"net-production\": {\n            \"root\": \"hosts_s3fs\",\n            \"config\": \"hosts_s3fs\",\n            \"web\": \"hosts_s3fs\",\n            \"content\": \"hosts_s3fs\",\n            \"templates\": \"hosts_s3fs\",\n            \"modules\": \"hosts_s3fs\"\n        },\n        \"net-development-s3\": {\n            \"root\": \"hosts_s3\",\n            \"config\": \"hosts_s3\",\n            \"web\": \"hosts_s3\",\n            \"content\": \"hosts_s3\",\n            \"templates\": \"hosts_s3\"\n        },\n        \"net-development-s3fs\": {\n            \"root\": \"hosts_s3fs\",\n            \"config\": \"hosts_s3fs\",\n            \"web\": \"hosts_s3fs\",\n            \"content\": \"hosts_s3fs\",\n            \"templates\": \"hosts_s3fs\",\n            \"modules\": \"hosts_s3fs\"\n        }\n    },\n    \"virtualHost\": {\n        \"enabled\": false\n    },\n    \"wcm\": {\n        \"enabled\": false,\n        \"cache\": false\n    },\n    \"serverTags\": {\n        \"enabled\": false\n    },\n    \"insight\": {\n        \"enabled\": false\n    },\n    \"perf\": {\n        \"enabled\": true\n    },\n    \"driverConfig\": {\n        \"enabled\": true\n    },\n    \"virtualDriver\": {\n        \"enabled\": false\n    },\n    \"virtualContent\": {\n        \"enabled\": true\n    },\n    \"flow\": {\n        \"enabled\": false\n    },\n    \"form\": {\n        \"enabled\": true\n    },\n    \"auth\": {\n        \"enabled\": true,\n        \"providers\": {\n            \"facebook\": {\n                \"enabled\": false\n            },\n            \"twitter\": {\n                \"enabled\": false\n            },\n            \"linkedin\": {\n                \"enabled\": false\n            }\n        }\n    },\n    \"notifications\": {\n        \"enabled\": false,\n        \"log\": true,\n        \"type\": \"sqs\",\n        \"configuration\": {\n            \"queue\": \"\",\n            \"accessKey\": \"\",\n            \"secretKey\": \"\",\n            \"region\": \"\"\n        }\n    },\n    \"broadcast\": {\n        \"enabled\": true\n    },\n    \"local\": {\n        \"enabled\": true\n    },\n    \"welcome\": {\n        \"enabled\": true,\n        \"file\": \"index.html\"\n    },\n    \"config\": {\n        \"enabled\": true\n    },\n    \"cache\": {\n        \"enabled\": true\n    },\n    \"templates\": {\n        \"enabled\": true\n    },\n    \"modules\": {\n        \"enabled\": true\n    },\n    \"debug\": {\n        \"enabled\": false,\n        \"logGlobalTimings\": false\n    },\n    \"cors\": {\n        \"enabled\": true,\n        \"origin\": null,\n        \"methods\": \"GET, POST, PUT, DELETE, OPTIONS\",\n        \"headers\": \"X-Forwarded-Host, X-Requested-With, Content-Type, Authorization, Origin, X-Requested-With, X-Prototype-Version, Cache-Control, Pragma, X-CSRF-TOKEN, X-XSRF-TOKEN\",\n        \"credentials\": false\n    },\n    \"admin\": {\n        \"enabled\": true,\n        \"username\": \"admin\",\n        \"password\": \"admin\"\n    },\n    \"bodyParsers\": {\n        \"multipart\": {\n        },\n        \"json\": {\n            \"limit\": \"100kb\"\n        },\n        \"urlencoded\": {\n            \"extended\": true\n        }\n    }\n}\n````\n\n## Environment Variables\n\nThe following environment variables can be set to control the server's configuration from the container level:\n\n### Virtual Driver Service\nThe virtual driver configuration is used to connect to Cloud CMS and request gitana driver credentials based on\nthe incoming domain name.  These parameters override any settings provided for the \u003ccode\u003evirtualDriver\u003c/code\u003e\nservice block:\n\n- CLOUDCMS_VIRTUAL_DRIVER_BASE_URL\n- CLOUDCMS_VIRTUAL_DRIVER_CLIENT_KEY\n- CLOUDCMS_VIRTUAL_DRIVER_CLIENT_SECRET\n- CLOUDCMS_VIRTUAL_DRIVER_AUTHGRANT_KEY\n- CLOUDCMS_VIRTUAL_DRIVER_AUTHGRANT_SECRET\n\n### Broadcast Service\nThe broadcast service provides a communication and notification facility between nodes in the application server cluster.\nThe cluster is elastic and may grow and shrink in size as demand increases and decreases.  The type can be either\n\u003ccode\u003enoop\u003c/code\u003e (disabled) or \u003ccode\u003eredis\u003c/code\u003e.\n\n- CLOUDCMS_BROADCAST_TYPE\n- CLOUDCMS_BROADCAST_REDIS_PORT\n- CLOUDCMS_BROADCAST_REDIS_ENDPOINT\n\n### Cache Service\nThe cache service provides a cluster-wide cache accessible from any node or process in the cluster.  The type can be\neither \u003ccode\u003ememory\u003c/code\u003e or \u003ccode\u003eredis\u003c/code\u003e.\n\n- CLOUDCMS_CACHE_TYPE\n- CLOUDCMS_CACHE_REDIS_PORT\n- CLOUDCMS_CACHE_REDIS_ENDPOINT\n\n### Hosting Modes\n\nThe server supports three hosting modes: standalone, single virtual tenant, multiple virtual tenants\n\n#### Standalone\n\nBy default, the server will start up in standalone hosting mode.  This is intended for a standalone web application\nwith a local gitana.json file.  The incoming host name is considered to be irrelevant and all on-disk caching is done\nagainst a \"local\" virtual host.  In essence, no matter what the host name is, the same virtual host is considered.\n\nIn this mode, there is no support for virtual driver retrieval.  You must supply the gitana.json locally.\n\nTo change the name of the \"local\" virtual host name, set CLOUDCMS_STANDALONE_HOST environment variable.\nThe default is \"local\".\n\n#### Single Virtual Tenant\n\nIn single virtual tenant mode, all incoming request, no matter the host, are mapped to a single Cloud CMS tenant's\napplication deployment.\n\nThe virtual driver will retrieve the gitana.json for this tenant and maintain it over time.  If the gitana.json\nAPI keys change on the server, they will be retrieved and used by the app server automatically.\n\nTo use this mode, set the following:\n\n    CLOUDCMS_VIRTUAL_HOST\n    \nThis should be set to the host of the Cloud CMS application deployment.\n\n#### Multiple Virtual Tenants\n\nIn multiple virtual tenants mode, all incoming requests have their incoming hosts considered.  Each host may describe\na different Cloud CMS application deployment.  For N hosts, there will be N Cloud CMS application instances.  This mode\nis intended for cases where you wish to have a single application support N customers.\n\nTo use this mode, set the following\n\n    CLOUDCMS_VIRTUAL_HOST_DOMAIN\n    \nThis should be set to a suffix domain that is wildcarded against.  For example, if you set it to \"company.com\", then\nany incoming requests for \"\u003csubdomain\u003e.company.com\" will be served.  Each request will check with Cloud CMS to make\nsure it has the proper gitana.json pulled down for the Cloud CMS application deployment with that host.  Each host\nmaintains it's own location on disk and is served back via virtual hosting.\n\n### Stores\nFor every request, underlying persistence stores are applied that automatically configure to read and write objects\nto the correct place, either a file system or S3.  Performance caching and directory paths are figured out ahead of\ntime so that each virtual host works against the correct storage location.\n\n- CLOUDCMS_STORE_CONFIGURATION\n- CLOUDCMS_STORE_S3_ACCESS_KEY\n- CLOUDCMS_STORE_S3_SECRET_KEY\n- CLOUDCMS_STORE_S3_BUCKET\n\n### GitHub\nThe module supports dynamic application deployment from GitHub or BitBucket.  Application code is deployed into the\nvirtual hosting directories and served from there.\n\n- CLOUDCMS_NET_GITHUB_USERNAME\n- CLOUDCMS_NET_GITHUB_PASSWORD\n- CLOUDCMS_NET_BITBUCKET_USERNAME\n- CLOUDCMS_NET_BITBUCKET_PASSWORD\n\n### Proxy\nThese settings configured where the /proxy endpoint points to be default.\n\nGITANA_PROXY_HOST\nGITANA_PROXY_PORT\nGITANA_PROXY_SCHEME\n\n\n### Runtime\n\nThe module supports dynamic switching of the branch being served from.  It also allows for the runtime cache buster\nvalue to be migrated at any time to allow for cache regeneration.\n\nThe following environment variables can be used to set up the initial state:\n\nCLOUDCMS_RUNTIME_CB\nCLOUDCMS_RUNTIME_RELEASE_ID\nCLOUDCMS_RUNTIME_BRANCH_ID\n\nA runtime.json file is written into each virtual host's content directory.  It can be adjusted at runtime via a\nPOST call to:\n\n    /_runtime/migrate\n    \nAnd the JSON payload should be:\n\n    {\n        \"branchId\": \"\u003cnewBranchId\u003e\",\n        \"releaseId\": \"\u003cnewReleaseId\u003e\",\n        \"cb\": \"\u003cnewCacheBusterValue\u003e\"\n    }\n\nOnly `branchId` is truly required.  If `cb` is specified, it will be used, otherwise a new ID will be auto-generated.\n\n\n### Other Environment Variables\n\nThe following environments are computed automatically and available to services:\n\n- CLOUDCMS_APPSERVER_MODE: either 'development' or 'production', if not specified, derives from NODE_ENV\n- CLOUDCMS_APPSERVER_BASE_PATH: the startup location of the node process, applicable when running locally\n- CLOUDCMS_APPSERVER_PACKAGE_NAME: the name of the module currently beingrun (from package.json)\n- CLOUDCMS_APPSERVER_PACKAGE_VERSION: the version of the module currently being run (from package.json)\n- CLOUDCMS_APPSERVER_TIMESTAMP: the timestamp of server startup\n\n\n- CLOUDCMS_TEMPDIR_PATH: path to a tmp directory\n- CLOUDCMS_HOSTS_PATH: path to the root /hosts directory\n\n\n# node switches\nExamples of Node switches:\n\n    node --max_old_space_size=3000 --prof nodemem.js --trace_incremental_marking=true --incremental_marking_steps=false\n    \n    node --max_old_space_size=3000 --max_new_space_size=3000 --max_executable_size=1000 --gc_global --prof nodemem.js --noincremental_marking --nolazy_sweeping --never_compact --gc_global --gc_interval=100000000\n\n\n# admin mode\nAdministration API functions are available under /_admin.\nThese can be enabled or disabled via the \"admin\" config block.\n\nIf a \"username\" and \"password\" is provided in this config block, it will be asserted via basic configuration ahead of\npermitted access to the admin functions.\n\nAdmin functions include\n\n    /_admin/cache/invalidate\n    \nThis invalidates the full cache.  Or you can invalidate individual nodes:\n\n    /_admin/cache/invalidate?ref=node://{platformId}/{repositoryId}/{branchId}/{nodeId}\n    \nWhere \"ref\" is a standard node reference.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitana%2Fcloudcms-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitana%2Fcloudcms-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitana%2Fcloudcms-server/lists"}