README.md 2.01 KB
Newer Older
1
# RDR: Research Data Repository application for Duke University Libraries
2

3
## Development Environment
4

5
### Requirements
6

7
- Docker Destop for Mac or Windows OR docker-ce + docker-compose for Linux
8

9
### Building the application image
Michael Daul's avatar
Michael Daul committed
10

11
In the root of the project run:
Michael Daul's avatar
Michael Daul committed
12

13
	$ make
Michael Daul's avatar
Michael Daul committed
14

15
### Start the development stack
Michael Daul's avatar
Michael Daul committed
16

17
18
Start the development stack:

19
    $ .docker/dev.sh up
Michael Daul's avatar
Michael Daul committed
20

David Chandek-Stark's avatar
David Chandek-Stark committed
21
(If the app image is not present, it will be built
22
23
before the stack comes up.)

David Chandek-Stark's avatar
David Chandek-Stark committed
24
25
26
27
To initialize the development database for Rails, run the command:

    $ .docker/dev.sh exec app bin/rails db:setup

28
To run a Bash shell on the development app server:
Michael Daul's avatar
Michael Daul committed
29

30
    $ .docker/dev.sh exec app bash
Michael Daul's avatar
Michael Daul committed
31

32
Stop the development stack:
Michael Daul's avatar
Michael Daul committed
33

34
    $ .docker/dev.sh down
Michael Daul's avatar
Michael Daul committed
35

David Chandek-Stark's avatar
David Chandek-Stark committed
36
37
38
(If you use `Ctrl-C`to interrupt the stack running in the foreground, `dev.sh`
has a trap to run `docker-compose down` to clean up resources.)

39
## Test Environment
Michael Daul's avatar
Michael Daul committed
40

41
To get an interactive shell with the test stack, run:
Michael Daul's avatar
Michael Daul committed
42

43
    $ .docker/test-interactive.sh
Michael Daul's avatar
Michael Daul committed
44

45
46
This command will start the app container with the local code directory
bind-mounted, reset the database, and start an interactive bash session.
Michael Daul's avatar
Michael Daul committed
47

48
49
After exiting the bash session, the script will
cleanup the test environment, removing the containers and network.
Michael Daul's avatar
Michael Daul committed
50

51
52
To exercise the full test suite *against the latest build* -- i.e., *not*
including uncommitted changes -- run:
Michael Daul's avatar
Michael Daul committed
53

54
55
56
    $ make clean test

(This is mainly for CI pipelines, FWIW.)
Michael Daul's avatar
Michael Daul committed
57

58
59
If you have made changes since the last build and want to run the test suite
against your local code without doing another build, then use the interactive
60
61
mode below and run the command `bundle exec rake` or `bin/rails spec`  as usual
in the container.
62

63
## Environment Variables
64

65
66
The `app` container has a dedicated environment file at `.docker/app.env`.
Variables set in this file are propagated into the `app` container at runtime.
67

68
Some variables must be exported on the development host:
69

70
    EZID_TEST_PASSWORD
Michael Daul's avatar
Michael Daul committed
71

72
Additional variables can *optionally* be exported to override defaults:
Michael Daul's avatar
Michael Daul committed
73

74
75
76
	CURATION_GROUP_EMAIL
	DEFAULT_FROM_ADDRESS
	EXPORT_FILES_CONTACT_EMAIL