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.
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.
The project was inspired by this blog post. We use the renowned Model-View-Controller (MVC) architecture.
We use Express and Sequelize for the backend.
We use VueJS v2 for the frontend.
There are two skeleton projects and two code generator projects forming ScienceDb.
A default Backend providing User, Roles, Authentication and Authorization, optional support for multipe relational databases, and a REPL is ScienceDbBackend.
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'
To generate controller files, use our code generator project express_route_gen_js
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.
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.
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.
- Download the shell script initUserDb.sh, docker-compose file docker-compose.yml, Dockerfiles debian_science_db.txt and postgres_db.txt
- 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
- start up your application by running:
docker-compose up
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 ).
Checkout projects with git and run initial setup. Within the above SSH session, execute
sh /root/setup_projects
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...
Open ~/projects/ScienceDbGui and run:
PORT=3333 npm run dev