mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 12:09:17 +08:00
Change rake -> rails
parent
7120f93efd
commit
00f9c23c6e
1 changed files with 19 additions and 19 deletions
|
@ -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.
|
||||||
|
@ -58,7 +58,7 @@ On Windows 10, you can use [Docker for Windows](https://docs.docker.com/docker-f
|
||||||
|
|
||||||
### Docker structure
|
### Docker structure
|
||||||
|
|
||||||
**For version 1.10.0 and later**
|
**For version 1.10.0 and later**
|
||||||
When starting SciNote application in development mode it runs in a Docker container called `scinote_web_development`, which uses volume `scinote_development_files` for storing uploaded files and `scinote_development_bundler` for storing program dependencies. The database runs in a separate container, called `scinote_db_development`. This database container makes use of a persistent volume called `scinote_development_postgres` for storing database files.
|
When starting SciNote application in development mode it runs in a Docker container called `scinote_web_development`, which uses volume `scinote_development_files` for storing uploaded files and `scinote_development_bundler` for storing program dependencies. The database runs in a separate container, called `scinote_db_development`. This database container makes use of a persistent volume called `scinote_development_postgres` for storing database files.
|
||||||
|
|
||||||
**For versions prior to 1.10.0**
|
**For versions prior to 1.10.0**
|
||||||
|
@ -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. |
|
||||||
|
@ -147,7 +147,7 @@ The mentioned variable is used to configure database connection and by default i
|
||||||
You can generate default (minimal) `production.env` file with the following command: `make config-production`. This command will also generate `SECRET_KEY_BASE` and `PAPERCLIP_HASH_SECRET` variables automatically.
|
You can generate default (minimal) `production.env` file with the following command: `make config-production`. This command will also generate `SECRET_KEY_BASE` and `PAPERCLIP_HASH_SECRET` variables automatically.
|
||||||
|
|
||||||
After setting all the required variables you need to build the Docker image with `make docker-production`; this command will install all needed Gems and precompile assets.
|
After setting all the required variables you need to build the Docker image with `make docker-production`; this command will install all needed Gems and precompile assets.
|
||||||
|
|
||||||
When the above build is finished, database needs to be initialized (if you're performing a new install). This can be done by running `make database-production`. This will initialize the database and start a running process; the database will be hosted in the `scinote_db_production` container. This container is configured to keep all database files in the persistent Docker volume named `scinote_production_postgres`, which is (by default) placed in `/var/lib/docker/volumes` of the host system.
|
When the above build is finished, database needs to be initialized (if you're performing a new install). This can be done by running `make database-production`. This will initialize the database and start a running process; the database will be hosted in the `scinote_db_production` container. This container is configured to keep all database files in the persistent Docker volume named `scinote_production_postgres`, which is (by default) placed in `/var/lib/docker/volumes` of the host system.
|
||||||
|
|
||||||
There is also another persistent Docker volume called `scinote_production_files`; this container is used for storing generated and uploaded files if you configure local file storage.
|
There is also another persistent Docker volume called `scinote_production_files`; this container is used for storing generated and uploaded files if you configure local file storage.
|
||||||
|
@ -168,7 +168,7 @@ make database-production
|
||||||
docker-compose -f ./docker-compose.production.yml up
|
docker-compose -f ./docker-compose.production.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
### Migrating to new production setup
|
### Migrating to new production setup
|
||||||
|
|
||||||
If you are using some old/custom setup, and want to switch to production mode which was introduced in version 1.10.0 (see above), you will need to perform the following steps before updating the application files.
|
If you are using some old/custom setup, and want to switch to production mode which was introduced in version 1.10.0 (see above), you will need to perform the following steps before updating the application files.
|
||||||
|
|
||||||
|
@ -200,11 +200,11 @@ 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**
|
||||||
|
|
||||||
After migrations are finished, you can start the application normally with the command `docker-compose -f ./docker-compose.production.yml up`.
|
After migrations are finished, you can start the application normally with the command `docker-compose -f ./docker-compose.production.yml up`.
|
||||||
|
|
||||||
## Rake tasks
|
## Rake tasks
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ SciNote needs a configured SMTP mail server to work properly. See [environmental
|
||||||
|
|
||||||
## Office Online integration
|
## Office Online integration
|
||||||
|
|
||||||
SciNote can be integrated with an Office Online Server to enable viewing and edition of documents directly in the browser. To enable this integration using the Microsoft Office Online servers, you will need to join the [Office Cloud Storage Partner Program](https://dev.office.com/programs/officecloudstorage) and set up the `WOPI_*` environment variables.
|
SciNote can be integrated with an Office Online Server to enable viewing and edition of documents directly in the browser. To enable this integration using the Microsoft Office Online servers, you will need to join the [Office Cloud Storage Partner Program](https://dev.office.com/programs/officecloudstorage) and set up the `WOPI_*` environment variables.
|
||||||
|
|
||||||
## Deploy onto Heroku
|
## Deploy onto Heroku
|
||||||
|
|
||||||
|
@ -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`.
|
Loading…
Reference in a new issue