@@ -22,22 +22,82 @@ The use of this portal is optional and you can easily integrate the code creatio
22
22
The setup steps expect the following tools to be installed on the system:
23
23
24
24
- [ Ruby] ( https://guides.rubyonrails.org/getting_started.html#installing-ruby )
25
+ - [ Rails] ( https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails-installing-rails )
25
26
- [ MySQL] ( https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/ )
26
27
- [ Node.js] ( https://guides.rubyonrails.org/getting_started.html#installing-node-js-and-yarn )
27
- - [ Rails] ( https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails-installing-rails )
28
- - [ COVID Shield Diagnosis Server] ( https://github.com/CovidShield/backend )
28
+ - [ Webpack] ( https://github.com/webpack/webpack#install )
29
+ - [ Yarn] ( https://yarnpkg.com/getting-started/install#global-install )
30
+ - [ COVID Shield Diagnosis Server] ( https://github.com/CovidShield/server )
31
+ - [ Docker/Docker Compose] ( https://docs.docker.com/get-started/#set-up-your-docker-environment )
29
32
30
- ### 1. Check out the repository
33
+ ### Check out the repository
31
34
32
35
``` bash
33
36
git clone git@github.com:CovidShield/portal.git
34
37
```
35
38
36
- ### 2. Update database.yml file
39
+ ### Install dependencies
40
+
41
+ ``` bash
42
+ # If you don't have the bundler gem, do this next line too:
43
+ # gem install bundler
44
+
45
+ bundle install
46
+ ```
47
+
48
+ On MacOS, you may get issues installing the ` mysql2 ` Gem. If you have [ Homebrew] ( https://brew.sh/ ) , you can install it this way:
49
+
50
+ ``` bash
51
+ brew install mysql openssl
52
+ gem install mysql2 -- --with-cflags=\" -I/usr/local/opt/openssl@1.1/include\" --with-ldflags=\" -L/usr/local/opt/openssl@1.1/lib\"
53
+ bundle install
54
+ ```
55
+ ### (Optional) Create a new MySQL Database using Docker
56
+
57
+ If you don't already have a local MySQL database, you can create one easily.
58
+
59
+ First, create a directory for the local data storage:
60
+
61
+ ``` bash
62
+ mkdir mysql-data
63
+ ```
64
+
65
+ Second, start the database using Docker:
37
66
38
- Update the database.yml file with your MySQL configuration as required.
67
+ ``` bash
68
+ docker run -it --rm -p 3306:3306 --name portal-db -v $PWD /mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=stayhealthy -d mysql
69
+ ```
70
+
71
+ This will create a database with the following properties:
72
+
73
+ - IP: ` 127.0.0.1 `
74
+ - Port: ` 3306 `
75
+ - User: ` root `
76
+ - Password: ` stayhealthy `
77
+
78
+ To kill it later, use:
79
+
80
+ ```
81
+ docker kill portal-db
82
+ ```
39
83
40
- ### 3. Create and set up the database
84
+ ### Update database.yml file
85
+
86
+ Update the [ database.yml] ( config/database.yml ) file with your MySQL configuration as required.
87
+
88
+ If you're using the Docker-based MySQL from the above section, your ` default ` section will look like this:
89
+
90
+ ``` yaml
91
+ default : &default
92
+ adapter : mysql2
93
+ encoding : utf8mb4
94
+ pool : <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
95
+ username : root
96
+ password : stayhealthy
97
+ host : 127.0.0.1
98
+ ` ` `
99
+
100
+ ### Create and set up the database
41
101
42
102
Run the following commands to create and set up the database.
43
103
@@ -47,12 +107,18 @@ bundle exec rake db:setup
47
107
bundle exec rake db:seed
48
108
```
49
109
50
- ### 4. Start the Rails server
110
+ ### Start the Webpack Server
111
+
112
+ Open a new terminal window, navigating into the base of the repo, and start the Webpack server:
113
+
114
+ ` ./bin/webpack -w `
115
+
116
+ ### Start the Rails server
51
117
52
118
You can start the rails server using the command given below (replacing the KEY_CLAIM_HOST to match your running diagnosis server config).
53
119
54
120
``` ruby
55
- KEY_CLAIM_HOST = localhost: 3000 bundle exec rails s
121
+ KEY_CLAIM_HOST = 127.0 . 0.1 : 8000 bundle exec rails s
56
122
```
57
123
58
124
And now you can visit the site with the URL http://localhost:3000
0 commit comments