Change rake -> rails

Luka Murn 2018-06-02 10:43:35 +02:00
parent 7120f93efd
commit 00f9c23c6e

@ -16,7 +16,7 @@ The following are minimal steps needed to start SciNote in development environme
2. Create a file `config/application.yml`. Populate it with mandatory environmental variables (see [environmental variables](#user-content-environmental-variables)). 2. Create a file `config/application.yml`. Populate it with mandatory environmental variables (see [environmental variables](#user-content-environmental-variables)).
3. In SciNote folder, run the following command: `make docker`. This can take a while, since Docker must first pull an image from the Internet, and then also install all neccesary Gems required by SciNote. 3. In SciNote folder, run the following command: `make docker`. This can take a while, since Docker must first pull an image from the Internet, and then also install all neccesary Gems required by SciNote.
4. Once the Docker image is created, run `make run` command. This will install all the required Gems, and spin-off a (not-yet-working) server. 4. Once the Docker image is created, run `make run` command. This will install all the required Gems, and spin-off a (not-yet-working) server.
4. Once all Gems are installed, and server starts, stop it (`Ctrl + C`). Run `make cli` command. Once inside the running Docker container, run the following commands: `rake db:drop` - `rake db:create` - `rake db:migrate` - `rake db:seed`. This should initialize the database and fill it with (very minimal) seed data. 4. Once all Gems are installed, and server starts, stop it (`Ctrl + C`). Run `make cli` command. Once inside the running Docker container, run the following commands: `rails db:drop` - `rails db:create` - `rails db:migrate` - `rails db:seed`. This should initialize the database and fill it with (very minimal) seed data.
5. Exit the Docker container by typing `exit`. 5. Exit the Docker container by typing `exit`.
6. To start the server, run command `make run`. Wait until the server starts listening on port `3000`. 6. To start the server, run command `make run`. Wait until the server starts listening on port `3000`.
7. Inside another CLI window (also from SciNote folder), run command `make worker`. This command should start the background worker process which is used by SciNote for a lot of demanding tasks. 7. Inside another CLI window (also from SciNote folder), run command `make worker`. This command should start the background worker process which is used by SciNote for a lot of demanding tasks.
@ -79,7 +79,7 @@ Following commands are available:
| `make run` | Runs the `db` container & starts the Rails server in `web` container. | | `make run` | Runs the `db` container & starts the Rails server in `web` container. |
| `make start` | Runs the `db` container & starts the Rails server in `web` container in background. | | `make start` | Runs the `db` container & starts the Rails server in `web` container in background. |
| `make stop` | Stops the `db` & `web` containers. | | `make stop` | Stops the `db` & `web` containers. |
| `make worker` | Runs the `rake jobs:work` (worker process) in `web` container. | | `make worker` | Runs the `rails jobs:work` (worker process) in `web` container. |
| `make cli` | Runs a `/bin/bash` inside the `web` container. | | `make cli` | Runs a `/bin/bash` inside the `web` container. |
| `make tests` | Execute all Rails tests. | | `make tests` | Execute all Rails tests. |
| `make console` | Enters the Rails console in `web` container. | | `make console` | Enters the Rails console in `web` container. |
@ -200,7 +200,7 @@ First of all, you will need to rebuild Docker images using the new version of Sc
**2. Migrate database data** **2. Migrate database data**
Open command prompt inside the web container with `make cli-production` and, once inside it, run migrations with the following command: `rake db:migrate`. On rare occasions, you will also need to run additional migration scripts, please check Release Notes for that. Open command prompt inside the web container with `make cli-production` and, once inside it, run migrations with the following command: `rails db:migrate`. On rare occasions, you will also need to run additional migration scripts, please check Release Notes for that.
**3. Restart** **3. Restart**
@ -219,37 +219,37 @@ SciNote uses [delayed jobs](https://github.com/tobi/delayed_job) library to do b
Best option to run delayed jobs is inside a worker process. To start a background worker process that will execute delayed jobs, run the following command: Best option to run delayed jobs is inside a worker process. To start a background worker process that will execute delayed jobs, run the following command:
``` ```
rake jobs:work rails jobs:work
``` ```
To clear all currently queued jobs, you can use the following command: To clear all currently queued jobs, you can use the following command:
``` ```
rake jobs:clear rails jobs:clear
``` ```
> **Warning!** This is not advised to do on production environments. > **Warning!** This is not advised to do on production environments.
### Adding users ### Adding users
To simplify adding of new users to the system, couple of special `rake` tasks have been created. To simplify adding of new users to the system, couple of special `rails` tasks have been created.
The first, `rake db:add_user` simply queries all the information for a specific user via STDIN, and then proceeds to create the user. The first, `rails db:add_user` simply queries all the information for a specific user via STDIN, and then proceeds to create the user.
The second task, `rake db:load_users[file_path,create_orgs]` takes 2 parameters as an input: The second task, `rails db:load_users[file_path,create_orgs]` takes 2 parameters as an input:
* Path to `.yml` file containing list of users & teams to be added. The YAML file needs to be structured properly - field names must match those in the database, users need to have a name `user_<id>`, and teams name `team_<id>`. For an example load users file, see [db/load_users_template.yml](https://github.com/biosistemika/scinote-web/blob/master/db/load_users_template.yml) file. * Path to `.yml` file containing list of users & teams to be added. The YAML file needs to be structured properly - field names must match those in the database, users need to have a name `user_<id>`, and teams name `team_<id>`. For an example load users file, see [db/load_users_template.yml](https://github.com/biosistemika/scinote-web/blob/master/db/load_users_template.yml) file.
* A boolean ('true' or 'false') whether to create individual teams for each user or not. * A boolean ('true' or 'false') whether to create individual teams for each user or not.
### Web statistics ### Web statistics
To check current login statistics of registered users, use `rake web_stats:login` task. To check the last login of any user to the system, use `rake web_stats:last_login` task. To check current login statistics of registered users, use `rails web_stats:login` task. To check the last login of any user to the system, use `rails web_stats:last_login` task.
### Clearing data ### Clearing data
Execute `rake data:clean_temp_files` to remove all temporary files. Temporary files are used when importing samples. Execute `rails data:clean_temp_files` to remove all temporary files. Temporary files are used when importing samples.
Execute `rake data:clean_unconfirmed_users` to remove all users that registered, but never confirmed their email. Execute `rails data:clean_unconfirmed_users` to remove all users that registered, but never confirmed their email.
Calling `rake data:clean` will execute both above tasks. Calling `rails data:clean` will execute both above tasks.
### Notifications ### Notifications
To generate a new system notification that will be sent to all SciNote users, execute `rake notifications:new_system[title, message]`. Title & message can contain `HTML` tags. To generate a new system notification that will be sent to all SciNote users, execute `rails notifications:new_system[title, message]`. Title & message can contain `HTML` tags.
## Mailer ## Mailer
@ -305,4 +305,4 @@ For deployment of SciNote onto Heroku, additional environmental variables need t
## Testing ## Testing
In current version, only *model* tests are implemented for SciNote. To execute them, call `rake test:models`. In current version, only *model* tests are implemented for SciNote. To execute them, call `rails test:models`.