You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-37Lines changed: 31 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,43 +61,39 @@ from a command prompt in your project folder:
61
61
62
62
**Note:** If when starting the application with Docker you get the error `UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte` this may be because you created the `.env`-file using PowerShell. This can be solved by deleting that file and creating a new one using a bash shell (for example Git Bash).
63
63
64
-
### 3. Install and set up the environment
64
+
### 3. Install and set up the environment using docker
65
65
66
-
We recommend using Docker to install and run the application. However alternatively if you prefer, [you can install directly to your system environment instead](https://github.com/codebar/planner/blob/master/native-installation-instructions.md).
66
+
We recommend using Docker to install and run the application. However alternatively if you prefer, [you can install directly to your system environment instead](./native-installation-instructions.md).
67
67
68
-
#### Install using Docker
68
+
Before you start, you will need to have Docker installed and running. You can [download it from the Docker website](https://docker.com/). Once downloaded, install and start the Docker application.
69
69
70
-
Before you start, you will need to have Docker installed and running. You can [download it from the Docker website](https://docker.com/).
70
+
Run `bin/dup` to build and create the docker container. This will also set up the Rails application within the container and start the container. You will only have to run this command once. After initial setup, use `bin/dstart` to start an existing container - using `bin/dup` will recreate an existing container and reset the database.
71
71
72
-
The current Dockerfile and docker-compose were closely copied from [the Docker guide](https://docs.docker.com/compose/rails/).
72
+
### 4. Start the app
73
73
74
-
1. Run `bin/dbuild` to build and setup the docker environment.
75
-
2. Run `bin/drake` to run all the tests and make sure everything works.
74
+
Run `bin/dserver` to start the Rails server.
76
75
77
-
**Note:**If you are using Windows, you can run `bin/dbuild` using Git Bash.
76
+
*If you have previously stopped the container, you will have to first start the container using `bin/dstart`.
78
77
79
-
### 4. Run the tests
78
+
This should run a process which starts a server in a Docker container on your computer. This process won't finish - you'll know the server is ready when it stops doing anything and displays a message like this:
79
+
```
80
+
Rails 4.2.11 application starting in development on http://localhost:3000
81
+
```
80
82
81
-
Run `bin/drake` to run all the tests and make sure everything works.
82
-
You can also use `bin/drails` and `bin/dspec` to run specific rails and rspec commands via docker.
83
+
(Optional) Note that to be able to use the page as an admin, you must first give yourself admin privileges. Make sure you have started your app and signed up as an user on your locally running app. Then run the script `bin/dadmin <your email>`.
83
84
84
-
#### Running single tests/test files
85
+
**You can now view the app at http://localhost:3000**
85
86
86
-
If you just want to run a single test file you can pass the path to the file, either using `rspec` or via the `SPEC` variable with `rake`:
87
-
```bash
88
-
bundle exec rspec <path to test>
89
-
bundle exec rake SPEC=<path to test>
90
-
```
87
+
You can stop the server when you're finished by typing `Ctrl + C`.
91
88
92
-
This can also be used with specific line number (running only that one test), for example:
These also work with the corresponding `bin/dspec` and `bin/drake` commands.
93
+
This command passes any additional arguments into `rspec` in the docker container, so you can run individual tests with `bin/drspec PATH_TO_TEST` and run a single test case in a file with `bin/drspec PATH_TO_TEST:LINE_NUMBER`
99
94
100
95
#### Running JavaScript enabled feature tests with a visible browser
96
+
101
97
There are a small number of feature tests marked with `js: true` which use
102
98
headless Chrome. These can be hard to work with without being able to see what is
103
99
actually happening in the browser. To spin up a visible browser, pass
Running JavaScript enabled tests with a visible browser currently doesn't work with Docker.
111
107
112
-
### 5. Start the app
113
-
114
-
Run `bin/dstart` to start the app.
115
-
116
-
This should run a process which starts a server in a Docker container on your computer. This process won't finish - you'll know the server is ready when it stops doing anything and displays a message like this:
117
-
```
118
-
Rails 4.2.11 application starting in development on http://localhost:3000
119
-
```
120
-
121
-
(Optional) Note that to be able to use the page as an admin, you must first give yourself admin privileges. Make sure you have started your app and signed up as an user on your locally running app. Then run a script `bin/dadmin <your email>`.
122
-
123
-
**You can now view the app at http://localhost:3000**
124
-
125
-
You can stop the server when you're finished by typing `Ctrl + C`.
108
+
### Available Docker commands
109
+
110
+
-`bin/dup`: `docker-compose up --build -d --wait && rake db:drop db:create db:migrate db:seed db:test:prepare`. Rebuilds and boots up a new container, and then initialize the Rails database.
111
+
-`bin/dstart`: `docker-compose start`. Starts the existing container.
112
+
-`bin/dserver`: `docker-compose exec web make serve`. Runs the Rails server. Use this instead of `bin/drails server` to make it bind to the correct IP addresses to allow the server to be viewable outside the container.
113
+
-`drails`: `docker-compose exec web rails $@`. Runs rails within the container.
114
+
-`drspec`: `docker-compose exec web rspec $@`. Runs rspec within the container.
115
+
-`drake`: `docker-compose exec web rake $@`. Runs rake inside the container.
116
+
-`dexec`: `docker-compose exec web bash`. Runs a bash shell inside the container.
117
+
-`dadmin`: Gives the the last user (or the one with a given email) the admin role
118
+
-`bin/dstop`: `docker-compose stop`. Stops container but does not remove it
119
+
-`bin/ddown`: `docker-compose down`. Stops and destroy a container.
0 commit comments