-
Notifications
You must be signed in to change notification settings - Fork 101
Build & run
Before setting up SciNote server, you are advised to read the Technical overview section to get a general idea about the SciNote architecture, and what are the options for setting up SciNote.
This section describes the setup of SciNote server in development mode. If you want to setup SciNote server in a production mode, please visit the Production mode section.
Please make sure to also read the Prerequisites section before proceeding with the SciNote setup below.
Assuming the prerequisites are met, the following are the minimal steps neccesary to start SciNote server in development mode:
git clone https://github.com/biosistemika/scinote-web.git
To setup the basic configuration of SciNote server, create a file config/application.yml
in the root SciNote directory.
Populate it with mandatory environmental variables, as described in the environmental variables section.
The configuration file is used to store the configuration environmental variables in YAML format - basically, it acts as a simple key-value store for variables, which are loaded into the process environment at a run-time.
In SciNote root folder, run the following command:
make docker
This command will build the neccesary SciNote Docker image locally.
This process can take a while, since the Ruby image needs to be pulled from the Internet.
After this is done, run the following command when inside the SciNote root folder:
make run
This command is generally used to start the SciNote server, but at this specific timepoint it is used to build the PostgreSQL Docker image locally. Once the SciNote server starts (it is not yet functional), you should see something similar to this in the console output:
[1] * Preloading application
[1] * Listening on tcp://0.0.0.0:3000
[1] Use Ctrl-C to stop
[1] - Worker 0 (pid: xx) booted, phase: 0
[1] - Worker 1 (pid: yy) booted, phase: 0
Press Ctrl + C
to shutdown the server.
To enter the SciNote container, run the following command when inside the SciNote root folder:
make cli
Once inside the container, run the following sequence of commands:
rails db:drop
rails db:create
rails db:migrate
rails db:seed
This sequence of commands will drop the database, create it, migrate the data schema, and seed the initial data into the PostgreSQL database.
While still inside the container, run the following 2 commands:
yarn
rails webpacker:compile
This will load & bundle the front-end dependencies (JavaScript, CSS assets).
If
yarn
command doesn't work, trynpm install
.
Exit the Docker container by typing exit
.
To finally start the SciNote server, run the following command from the SciNote root folder:
make run
This command will start the SciNote server (web workers), and print the output to the terminal. Wait until the server starts listening on port 3000
.
To also start the background worker process, you should navigate to SciNote root folder in another terminal window, and run the following command:
make worker
The background worker process is used by SciNote for a lot of demanding tasks.
That's it! Open your favourite browser and navigate to http://localhost:3000
. Use the seeded administrator account from seeds.rb (or different admin credentials set up using environmental variables) to login, or sign up for a new account.
SciNote server in development mode uses the following Docker containers:
-
scinote_development_postgres
(persistent) hosts all database engine files, and is placed by default into/var/lib/docker/volumes
folder on the host system; -
scinote_development_files
(persistent) stores all generated & uploaded files when SciNote is configured to use local filesystem for storage (PAPERCLIP_STORAGE
is set to'filesystem'
); it is mapped to thepublic/system
folder within the SciNote root folder; -
scinote_db_development
(non-persistent) hosts the database engine process; - Job worker container (non-persistent) hosts the background worker process;
-
scinote_web_development
(non-persistent) hosts the web application process.
These Docker containers were introduced to SciNote in version 1.10.0; previous versions had a different containers set.