Skip to content

Zendro-dev/dockerfiles

 
 

Repository files navigation

dotfiles

This project holds a Docker container setup used as development environment, and also as a source for production / deployment environment. It enables distributed developer of "ScienceDb" to have a well defined environment.

A presentation of ScienceDb can be found here.

Structure

Science Db is a collection of four NodeJS projects providing an easy to setup, extend, and maintain knowledge management system for science. It is greatly influenced by e.g. RailsAdmin or Django. It follows the philosophy of code generation to define and migrate data models. Access to these is provided through a backend in the form of RESTful web services, and an optional Graphical User Interface (GUI) in the form of a single page web application (SPA). Both interfaces provide the standard Create, Read, Update, and Delete (CRUD) use cases.

Philosphy / Frameworks

The project was inspired by this blog post. We use the renowned Model-View-Controller (MVC) architecture.

Backend

We use Express and Sequelize for the backend.

Frontend

We use VueJS v2 for the frontend.

Sub-Projects

There are two skeleton projects and two code generator projects forming ScienceDb.

ScienceDbBackend

A default Backend providing User, Roles, Authentication and Authorization, optional support for multipe relational databases, and a REPL is ScienceDbBackend.

ScienceDbBackend code generators

Model and Migration

Model and migration files are created using Sequelize command line interface. For example to create a new model plant use

sequelize model:create --name Plant --attributes 'title:string, taxon:string, gmo:boolean'

Controller

To generate controller files, use our code generator project express_route_gen_js

Frontend

A skeleton frontend single page web application (SPA) using VueJs v2 and vuetable-2 is provided as ScienceDbGui.

To add the GUI for a new data model use the frontend code generator.

ScienceDb Frontend Code generator

The frontend code generator admin_gui_gen is a subproject of ScienceDb. For example to generate the GUI components for a new data model plant issue

admin_gui_gen --baseUrl 'www.scienceDb.org' --name Plant --attributes 'title:string, taxon:string, gmo:boolean'

Note, that the baseUrl points to your backend server.

Developmental work cycle

The basic idea is to build the development Docker-Image, start it as a daemon, and connect to it using SSH. Within the Docker image the four above sub-projects are already checked out (git) and can be started.

This usage of a development docker container enables distributed programmers to share a unified well defined development platform.

Installation / Developmental Usage

Setup the Developmental Docker Images

  1. Download the shell script initUserDb.sh, docker-compose file docker-compose.yml, Dockerfiles debian_science_db.txt and postgres_db.txt
  2. Open the folder with files downloaded in the Terminal/Cmd; Note In order to have the possibility to edit the code within the projects you can download/save projects in the folder where all previous files were downloaded
  3. start up your application by running:
 docker-compose up

SSH into the development container

Enable SSH connection to the docker container (use poiuyt098 as a password for SSH connection):

 ssh root@localhost -p 2939

Notes for Windows users:

  • you can use any windows app that provides the possibility to make a ssh connection to the server;
  • Linux Bash Shell;
  • or cygwin ).

Setup projects

Checkout projects with git and run initial setup. Within the above SSH session, execute

 sh /root/setup_projects

Start the ScienceDb Backend

Open ~/projects/ScienceDbBackend using SSH session and run:

 PORT=3000 npm start

Note, that 3000 is an arbitrary port. You can specify a different one, but in that case need to adjust the frontend...

Run the ScienceDb Frontend (SPA GUI)

Open ~/projects/ScienceDbGui and run:

 PORT=3333 npm run dev

About

My personal *nix system configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 98.2%
  • Batchfile 1.8%