Contensive can be configured to store file content either locally on the web-server or on Amazon AWS S3 (a remote file store). This article defines the terms involved, describes how each works, the advantages of each, and now to convert from one to the other.
Online Application vs Website
A website is typically delivered from one or more web-servers and may include either or both static resources like html, and dynamic resources like PHP code.
An online application is similar to website but may have it's static components delivered from a web-server and it's data from a different server that we call an application server.
File Storage Usage
Online applications and websites store files several places based on the files use. This is a list of what these file stores are called in Contensive
These files are typically stored with and delivered directly by the webserver. They are likely static in that they are not edited online and are often created by the application designer and loaded directly into the website. An example of a wwwFile might be the index.html file that represents the landing page for a website. For an Angular application, it might be the entire front-end html, code and styles.
Application files are those stored with the application and executed by the application. For a Wordpress website, these would be the PHP pages that run the site. In the case of a Wordpress website, you would expect the appFiles to be the same as the wwwFiles as they are both executed by and delivered by the same process, the webserver.
These are files the application or website uses that you do not want to have a public URL. For example the website may store text in a file that is used on the site only if the user is authorized to see the content.
These are files an application might use that are temporary and are never needed after the single page is created. You might need to create a zip file on the server and in preparation you copy a list of files into a directory, zip the directory then copy your zip file to publicFiles. You can manually delete the temporary directory but if you want to avoid the delay you can do the zip operation in tempFiles
These are files that the application or website uploads and you want to make available for future users.
Local File Mode
In local file mode, there is only one webserver or application server and files stored on the server can be stored on that machine.
Remote File Mode
In remote mode, files save to privateFiles, publicFiles and appFiles are automatically uploaded to Amazon S3. Files read are first downloaded.
Convert a Local Mode site to Remote Mode
Before starting the conversion
- stop or redirect traffic from all iis websites and stop all task services to prevent exposing customers to failing responses or invalid email, etc.
- backup the application database and all content files.
- Upgrade to the latest version of Dot Net Framework (4.7.2+ is required but the latest version is recommended)
- Upgrade Contensive to latest version, http://contensive.io/downloads, and after upgrading, always run >>cc.exe -u before hitting the site
The first step is to add the Amazon S3 resource and authorize the application to manage objects on the resource.
- Create a Amazon S3 bucket. If you create it as a website you can later add a domain name, otherwise you can use the Amazon URL provided.
- Create an Amazon IAM user and give the user full access to the bucket.
Next, if this application was originally created before June 2019, use the command line cc.exe program to change cdn file folders to lowercase
- Run >>cc --FixTableFolderCase
The next step is to add the bucket and Amazon credentials to the server group.
- Connect remotely to the server and run the command >>cc --configure
Next, setup the application's file prefixes and cdnFiles public Url. These are typical values
- "remoteWwwPath": "appFiles"
- "remoteFilePath": "publicFiles"
- "remotePrivatePath": "privateFiles"
- "cdnFileUrl": "http://bucket-name/publicFiles/"
Next, upload all local files to the remote file store using the command line
- Run >>cc --FileUpload www cdn private
Now change the application's configuration to use the remote file store.