GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - FieldDB/FieldDBWebServer

BranchesTags
Open more actions menu

Latest commit

 

History

830 Commits
830 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
app
app
 
 
bin
bin
 
 
config
config
 
 
lib
lib
 
 
middleware
middleware
 
 
public
public
 
 
routes
routes
 
 
test
test
 
 
views
views
 
 
.babelrc
.babelrc
 
 
.bowerrc
.bowerrc
 
 
.browserslistrc
.browserslistrc
 
 
.eslintignore
.eslintignore
 
 
.eslintrc
.eslintrc
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
README.md
README.md
 
 
bower.json
bower.json
 
 
gulpfile.js
gulpfile.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
server.js
server.js
 
 
start_service
start_service
 
 
stop_service
stop_service
 
 
webpack.config.js
webpack.config.js
 
 
webpack.server.js
webpack.server.js
 
 

Repository files navigation

FieldDBWebServer Build Status

================

Web Server for FieldDB corpus pages, and the project website.

Installation

Install Node.js

You need Node.js to run this webserver.

Mac:

$ brew install node

Linux:

$ sudo apt-get install nodejs

Windows:

You can download node from http://nodejs.org

Install dependancies

$ npm install

Configure

You can create a config/local.js file to point to the corpus service you want to contact. By default it contacts your localhost.

Run

To turn on the server:

$ npm run watch

To develop offline with fixture data:

$ OFFLINE=true npm start --offline

Then open https://localhost:3182 and accept the security certificate warning since you are developing locally with a self signed certificate.

To debug the client side code as well, in another tab turn on the webpack server:

$ node webpack.server.js

Then open https://localhost:3001/ and accept the security certificate warning since you are developing locally with a self signed certificate.


How to set up a production server

Running in production isn't much different from running while developing, except you will probably want to do some more customization of the configuration.

However, if you specified a port in the config, you might need someone with sudo privilges to open the port to the outside world so it will be accessible to the other machines who want to contact this service. Some universities and companies block non-standard ports so if you might have users who might be affected, you could request that someone with sudo priveleges set up a proxy such as Nginx or Apache to serve using a virtual host (eg https://www.example.org) rather than through a port (eg https://example.org:3182);

Configuration

You should copy the config/local.js to config/production.js

$ cp config/local.js config/production.js

Suggested changes:

  • change the port to the port you want to use
  • change ssl to have the path of your ssl certificates and key,
  • change corpus to the corpus service you want to contact, and

Production mode is controlled by an environment variable. Here is how you would set the environment variables if you are running the server via a non-privileged user fielddb.

$ echo FIELDDB_HOME=/home/fielddb/fielddbhome >> ~/.bashrc
$ echo NODE_ENV=production >> ~/.bashrc

Finally turn on the service in a way that it will restart even in the case of errors:

$ gulp build
$ ./start_service

Development

This project uses server-side rendering with the React library so that component code can be shared between server and browser, as well as getting fast initial page loads and search-engine-friendly pages.

Try viewing the page source to ensure the HTML being sent from the server is already rendered (with checksums to determine whether client-side rendering is necessary).

Redux server side render is based on from mz026.

  • Universal rendering, with async data support
  • Server side redirect
  • Separate vendor and app js files
  • Use Immutable as store data

Stack:

  • react@15.4.2
  • react-router@2.8.1
  • Immutable.js
  • Webpack@2.2
  • Babel@6
  • Express as isomorphic server
  • npm as package manager

Testing:

  • Mocha as testing framework
  • Chai as assertion library
  • Rewire and Sinon to mock/stub
  • Enzyme to do React rendering

In development mode:

Assign static folder linking /assets to the folder above

In production mode:

Use a gulp task (gulp build) to handle it:

  • A set of [rev](https://github.com/smysnk/gulp-rev-all)-ed assets with hash code appended would be built into dist/public/assets
  • A static middleware mapping root url to the folder mentioned above is configured in server.js
  • A set of [revReplace](https://github.com/jamesknelson/gulp-rev-replace)-ed server code would be built into dist/server-build, so that the rev-ed assets can be used when doing server rendering

To test your production build:

$ gulp build
$ NODE_ENV=production npm start

Deployment:

To deploy this app to production environment:

  • Run $ NODE_ENV=development npm install on server

    • After the installation above, then run $ npm run build:production which will build the front-end related assets and rev-ed server code under dist/ folder.
  • Kick off the server with:

$ npm run start:production

  • Once you're sure the server is operational, start the service with forever:

$./start_service

Release History

  • v1.62 activity heat map
  • v1.72 display of terms of use and elastic search integration
  • v3.19 refactored server.js into routes and updated express 2.x to 4.x
  • v3.21.15 migrated public urls from jade to handlebars
  • v5.4.21 migrated public urls from handlebars to react
  • v5.168.15 upgraded to node 12

License

Licensed under the Apache, 2.0 licenses.

About

No description, website, or topics provided.

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.