|
1 | | -# OS2Forms Drupal 8 project [](https://travis-ci.org/OS2Forms/os2forms8) |
| 1 | +# OS2Forms Drupal 8 project |
2 | 2 |
|
3 | | -## Development usage |
| 3 | +[](https://travis-ci.org/OS2Forms/os2forms8) |
4 | 4 |
|
5 | | -* Clone the repository |
| 5 | +## Getting Started |
6 | 6 |
|
7 | | - ``` |
8 | | - git clone [email protected]:OS2Forms/os2forms8.git |
9 | | - ``` |
10 | | -* Rename your project folder if needed (default is os2forms8) |
| 7 | +These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. |
11 | 8 |
|
12 | | -* Install Docksal if not yet installed: |
| 9 | +### Prerequisites |
13 | 10 |
|
14 | | - ``` |
15 | | - curl -fsSL https://get.docksal.io | bash |
16 | | - ``` |
17 | | -* Check Docksal version (optional): |
| 11 | +* [Docksal](https://docksal.io/) |
18 | 12 |
|
19 | | - ``` |
20 | | - fin version |
21 | | - ``` |
22 | | -* Check system info (optional): |
| 13 | +### Installing |
23 | 14 |
|
24 | | - ``` |
25 | | - fin sysinfo |
26 | | - ``` |
27 | | -* Initialize the OS2forms8 project: |
| 15 | +1. Clone the git repository |
| 16 | + ```sh |
| 17 | + git clone [email protected]:OS2Forms/os2forms8.git |
| 18 | + ``` |
28 | 19 |
|
29 | | - ``` |
30 | | - fin init |
31 | | - ``` |
32 | | -* Script to reinstall drupal from scratch based on os2forms8 profile: |
| 20 | +2. Enter the newly created project directory |
| 21 | + ```sh |
| 22 | + cd os2forms8 |
| 23 | + ``` |
33 | 24 |
|
34 | | - ``` |
35 | | - fin rebuild-test |
36 | | - ``` |
37 | | -* Add trusted host patterns to `web/sites/default/settings.php`: |
| 25 | +3. Start docksal environment |
| 26 | + ```sh |
| 27 | + fin start |
| 28 | + ``` |
38 | 29 |
|
39 | | - ``` |
40 | | - $settings['trusted_host_patterns'] = ['^os2forms8\.docksal$']; |
41 | | - ``` |
42 | | - |
43 | | -* The installation should now be available on url: `http://os2forms8.docksal` and ready for further development, |
44 | | -eg. by adding a `custom` directory to `web/modules`, `web/themes` and `web/profiles`. |
| 30 | +4. Install dependencies and enable modules |
| 31 | + ```sh |
| 32 | + fin rebuild-test |
| 33 | + ``` |
45 | 34 |
|
46 | | -### Drupal settings |
| 35 | +5. Create local settings |
| 36 | + ```sh |
| 37 | + cp web/sites/example.settings.local.php web/sites/default/settings.local.php |
| 38 | + ``` |
47 | 39 |
|
48 | | -Main Drupal setting file `web/sites/default/settings.php` has been added to git index. |
49 | | -By this way all os2forms projects are getting default settings, like temporary |
50 | | -directory, private directory, sync directory. |
| 40 | +6. Configure trusted hosts in settings.local.php (add the following if not present) |
| 41 | + ```php |
| 42 | + // web/sites/default/settings.local.php |
51 | 43 |
|
52 | | -All project's sensitive configuration should be stored in `settings.local.php` |
53 | | -file. This file will be included from main `settings.php` settings. |
| 44 | + $settings['trusted_host_patterns'] = ['^os2forms8.docksal$', '^localhost$']; |
| 45 | + ``` |
54 | 46 |
|
55 | | -#### Multisite/Subsite configuration. |
| 47 | +You should now be able to browse to the application at `http://os2forms8.docksal` |
56 | 48 |
|
57 | | -On multisite solution main Drupal setting file`web/sites/default/settings.php` |
58 | | -should be included into subsite's `settings.php` file. The easiest way to get |
59 | | -the new configuration on a subsite is to copy prepared template |
60 | | -`web/sites/subsite.settings.php` and add DB configuration, salt. |
| 49 | +## Deployment |
61 | 50 |
|
62 | | -Hint to generate salt string: |
63 | | -``` |
64 | | -drush php-eval 'echo \Drupal\Component\Utility\Crypt::randomBytesBase64(55) . "\n";' |
65 | | -``` |
66 | | -
|
67 | | -## Contribution |
| 51 | +These instructions will get you a copy of the project up and running on a live system. |
| 52 | +For a more detailed description, you could look at the `web/core/INSTALL.txt` [here](./web/core/INSTALL.txt). |
68 | 53 |
|
69 | | -OS2Forms projects is an opened for new features and os course bugfixes. |
70 | | -If you have any suggestion, or you found a bug in project, you are very welcome |
71 | | -to create an issue in github repository issue tracker. |
72 | | -For issue description there is expected that you will provide clear and |
73 | | -sufficient information about your feature request or bug report. |
| 54 | +### Prerequisites |
74 | 55 |
|
75 | | -### Development environment |
| 56 | +* A HTTP server such as [Apache](https://httpd.apache.org/) that supports PHP |
| 57 | +* A database service such as [MySQL](https://www.mysql.com/) |
| 58 | +* PHP 7 with the following extensions enabled: |
| 59 | + * gd |
| 60 | + * curl |
| 61 | + * simplexml |
| 62 | + * xml |
| 63 | + * dom |
| 64 | + * soap |
| 65 | + * mbstring |
| 66 | + * database specific extension such as the mysql extension |
| 67 | +* [Composer](https://getcomposer.org/) |
76 | 68 |
|
77 | | -For development purposes there has been included development environment driven |
78 | | -by [Docksal](https://docksal.io/). You can find all settings related to in |
79 | | -`/.docksal` folder. |
| 69 | +### Installing |
80 | 70 |
|
81 | | -See official manual on [how to install docksal](https://docksal.io/installation) on your local |
82 | | -development machine. |
83 | | -
|
84 | | -Since you have installed docksal it's easy to get installed default installation. |
85 | | -Use following commands: |
86 | | -``` |
87 | | -# Clone project if you didn't do it yet |
88 | | -git clone [email protected]:OS2Forms/os2forms8.git os2forms8-dev |
89 | | -cd os2forms8-dev |
90 | | -# Start docksal environment |
91 | | -fin start |
| 71 | +1. Clone the git repository |
| 72 | +```sh |
| 73 | +git clone [email protected]:OS2Forms/os2forms8.git |
92 | 74 | ``` |
93 | | -As result, you will get URL like `http://os2forms8-dev.docksal` that is going to |
94 | | - be used for access os2forms application. |
95 | | -
|
96 | | -Run `fin help` to see commands you may need. You see [more information about docksal `fin` command](https://docs.docksal.io/fin/fin/) |
97 | 75 |
|
98 | | -Most useful commands: |
99 | | -- `fin start/stop/restart` - start/stop/restart environment |
100 | | -- `fin bash` - get ssh access in CLI container |
101 | | -- `fin drush [comnnand]` - run drush command from host mashine in CLI container |
102 | | -- `fin composer [comnnand]` - run composer command from host mashine in CLI container |
103 | | -- `fin exec 'command'` - run any command from host machine in CLI container |
| 76 | +2. Enter the newly created project directory |
| 77 | +```sh |
| 78 | +cd os2forms8 |
| 79 | +``` |
104 | 80 |
|
105 | | -### Install default installation |
| 81 | +3. Install dependencies without development dependencies |
| 82 | +```sh |
| 83 | +composer install --no-dev |
| 84 | +``` |
106 | 85 |
|
107 | | -To get default installation just run `fin rebuild-test` command. Docksal will |
108 | | -create default os2forms installation for you. |
| 86 | +4. Generate a salt string and insert it in web/sites/default/settings.php |
| 87 | + ```sh |
| 88 | + # Generate salt string - this will output a new salt string |
| 89 | + ./vendor/bin/drush php-eval 'echo \Drupal\Component\Utility\Crypt::randomBytesBase64(55) . "\n";' |
| 90 | + ``` |
109 | 91 |
|
110 | | -Before start using it you need to add trusted hosts settings. See next section. |
| 92 | + ```php |
| 93 | + // web/sites/default/settings.php |
| 94 | + $settings['hash_salt'] = ''; // Insert the generated salt string here |
| 95 | + ``` |
111 | 96 |
|
112 | | -### Upload existing db |
113 | | -If you have existing database you want to upload and use, then you have to |
114 | | -configure Drupal settings (see section above). NOTE: It's recommended to add |
115 | | -settings `settings.local.php` file. |
| 97 | +5. Configure trusted hosts in web/sites/default/settings.php. |
| 98 | + For more information on how to write this, see the section for [Trusted Host settings](https://www.drupal.org/docs/installing-drupal/trusted-host-settings) |
| 99 | + in the official Drupal installation guide. |
| 100 | + ```php |
| 101 | + // web/sites/default/settings.php |
116 | 102 |
|
117 | | -Default db service credentials: |
| 103 | + $settings['trusted_host_patterns'] = ['']; |
| 104 | + ``` |
| 105 | +6. Visit the url for the os2forms application and follow the instructions |
| 106 | + * Select the os2forms install profile for a default os2forms installation |
118 | 107 |
|
119 | | -``` |
120 | | -$databases['default']['default'] = array ( |
121 | | - 'database' => 'default', |
122 | | - 'username' => 'root', |
123 | | - 'password' => 'root', |
124 | | - 'prefix' => '', |
125 | | - 'host' => 'db', |
126 | | - 'port' => '', |
127 | | - 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', |
128 | | - 'driver' => 'mysql', |
129 | | -); |
130 | | -``` |
| 108 | +7. Enable OS2Forms modules |
| 109 | + ```sh |
| 110 | + ./vendor/bin/drush en os2forms, os2forms_nemid, os2forms_dawa, os2forms_sbsys |
| 111 | + ``` |
131 | 112 |
|
132 | | -Use `fin bash` or `fin drush [command]` to upload your database |
| 113 | +## Contributing |
133 | 114 |
|
134 | | -You also need to add the rest drupal settings such as salt, sync/tmp folders, |
135 | | -trusted hosts |
136 | | -``` |
137 | | -$settings['trusted_host_patterns'] = ['^os2forms8-dev.docksal$', '^localhost$']; |
138 | | -``` |
| 115 | +OS2Forms projects is open for new features and os course bugfixes. If you have any suggestion, or you found a bug in project, you are very welcome to create an issue in github repository issue tracker. For issue description there is expected that you will provide clear and sufficient information about your feature request or bug report. |
139 | 116 |
|
140 | 117 | ### Code review policy |
141 | 118 | See [OS2Forms code review policy](https://github.com/OS2Forms/docs#code-review) |
|
0 commit comments