Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit 3db4cd5

Browse files
committed
Make Wagons work
1 parent 8063716 commit 3db4cd5

File tree

5 files changed

+53
-10
lines changed

5 files changed

+53
-10
lines changed

.docker/Wagonfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
group :development do
2+
ENV.fetch('HITOBITO_WAGONS', '').split(',').each do |wagon_name|
3+
wagon_name = wagon_name.strip
4+
gem wagon_name, path: "../#{wagon_name}"
5+
end
6+
end

.docker/entrypoint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ echo "✅ DB is ready"
99
if [ "$RAILS_ENV" != "production" ]; then
1010
echo "⚙️ Performing migrations"
1111
bundle exec rake db:migrate
12+
bundle exec rake wagon:migrate
1213
echo "✅ Migrations done"
1314
else
1415
echo "↪️ Skipping migrations because RAILS_ENV='$RAILS_ENV'"

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
FROM ruby:2.3 as base
22

3-
WORKDIR /app/hitobito/
4-
53
RUN apt-get update && apt-get install -y \
64
graphviz \
75
imagemagick \
86
&& rm -rf /var/lib/apt/lists/*
97

8+
RUN ln -s /app/.docker/entrypoint /bin/entrypoint; \
9+
ln -s /app/.docker/waitfortcp /bin/waitfortcp
10+
11+
WORKDIR /app/hitobito/
12+
COPY hitobito/Wagonfile.ci ./Wagonfile
1013
COPY hitobito/Gemfile hitobito/Gemfile.lock ./
1114
RUN bundle install
1215

16+
ENV HITOBITO_WAGONS ""
17+
COPY .docker/Wagonfile ./
18+
1319
WORKDIR /app/
1420
COPY ./ ./
1521

16-
RUN ln -s /app/.docker/entrypoint /bin/entrypoint; \
17-
ln -s /app/.docker/waitfortcp /bin/waitfortcp
18-
1922
WORKDIR /app/hitobito/
20-
RUN cp Wagonfile.ci Wagonfile && bundle install
23+
RUN bundle install
2124

2225
####################################################################
2326
FROM base as dev

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,27 @@ git clone https://github.com/hitobito/hitobito_generic.git
1616

1717
You need to set up at least one wagon project.
1818

19+
The final structure should look something like this:
20+
21+
```bash
22+
$ ls -l
23+
total 16K
24+
-rw-r--r-- 1 user 1.3K Jul 15 10:57 Dockerfile
25+
-rw-r--r-- 1 user 1.4K Jul 15 17:43 README.md
26+
-rw-r--r-- 1 user 625 Jul 15 17:41 docker-compose.yml
27+
drwxr-xr-x 36 user 1.2K Jul 15 13:56 hitobito
28+
-rw-r--r-- 1 user 153 Jul 15 10:35 hitobito.code-workspace
29+
drwxr-xr-x 27 user 864 Jun 11 09:30 hitobito_generic
30+
drwxr-xr-x 29 user 928 Jul 15 09:43 hitobito_insieme
31+
```
32+
1933
## Docker Runtime
2034

2135
The simplest way to work on hitobito is to use Docker:
2236

2337
```bash
2438
# First time
25-
docker-compose run --rm app rake db:seed
39+
docker-compose run --rm app rake db:seed wagon:seed
2640

2741
# Every other time
2842
docker-compose up app
@@ -36,9 +50,28 @@ echo "http://$(docker-compose port mail 1080)"
3650

3751
## First Login
3852

39-
Use the password reset flow and use the e-mail address `[email protected]`.
53+
Use the password reset flow and use the e-mail address of the root account.
54+
You find it as `root_email` in the `settings.yml` file of the wagon.
4055

4156
Then open the mailcatcher and copy the path.
4257
**Don't forget to adjust the host & port in that url!**
4358

4459
Now you should be able to log-in.
60+
61+
## Debug
62+
63+
The Rails console is your friend.
64+
Run the following command, to open it.
65+
66+
```bash
67+
docker-compose exec app rails c
68+
```
69+
70+
## Test
71+
72+
The hitobito application has a lot of rspec tests.
73+
To run them all, use the following command:
74+
75+
```bash
76+
docker-compose run --rm app rspec
77+
```

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ services:
1111
- cache
1212
ports:
1313
- 3000
14-
# volumes:
15-
# - './:/app'
14+
volumes:
15+
- ./:/app:ro
1616

1717
worker:
1818
<<: *app

0 commit comments

Comments
 (0)