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

Commit 60039c0

Browse files
committed
Set up RubyMine debug functionality and clean up docker configuration
1 parent f26a350 commit 60039c0

File tree

4 files changed

+18
-32
lines changed

4 files changed

+18
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
hitobito
22
hitobito_*
3+
.idea

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ RUN apt-get update && apt-get install -y \
55
imagemagick \
66
&& rm -rf /var/lib/apt/lists/*
77

8-
WORKDIR /app/hitobito/
9-
COPY hitobito/Wagonfile.ci ./Wagonfile
10-
COPY hitobito/Gemfile hitobito/Gemfile.lock ./
11-
RUN bundle install
12-
13-
WORKDIR /app/
14-
COPY ./ ./
15-
168
RUN ln -s /app/.docker/entrypoint /bin/entrypoint; \
179
ln -s /app/.docker/waitfortcp /bin/waitfortcp
1810

1911
WORKDIR /app/hitobito/
12+
COPY hitobito/Wagonfile.ci ./Wagonfile
13+
RUN gem install --prerelease ruby-debug-ide && gem install debase
14+
COPY hitobito/Gemfile hitobito/Gemfile.lock ./
2015
RUN bundle install
2116

2217
####################################################################

README.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The free _Docker Community Edition (CE)_ works perfectly fine.
1616
First, you need to clone this repository:
1717

1818
```bash
19-
git clone https://github.com/nxt-engineering/hitobito-docker.git hitobito \
20-
&& cd hitobito
19+
git clone https://github.com/carlobeltrame/hitobito-docker.git \
20+
&& cd hitobito-docker
2121
```
2222

2323
This contains only the Docker instructions.
@@ -53,14 +53,11 @@ To start the Hitobito application, run the following commands in your shell:
5353
```bash
5454
# Start the application
5555
docker-compose up app
56-
57-
# Open the app:
58-
echo "http://$(docker-compose port app 3000)"
59-
60-
# In order to "receive" emails, open mailcatcher:
61-
echo "http://$(docker-compose port mail 1080)"
6256
```
6357

58+
You can open the app in your browser under [http://localhost:3000].
59+
In order to "receive" emails, you can open mailcatcher under [http://localhost:1080].
60+
6461
It will initially take a while to prepare the initial Docker images, to prepare the database and to start the application.
6562
The process will be shorter on subsequent starts.
6663

@@ -69,7 +66,7 @@ The process will be shorter on subsequent starts.
6966
Get the login information via the Rails console.
7067

7168
```bash
72-
echo 'p=Person.first; p.update(password: "password"); "You can now login as #{p.email} with the password \"password\""' | \
69+
echo 'p=Person.first; p.update(password: "password"); "You can now login under http://localhost:3000 as #{p.email} with the password \'password\'"' | \
7370
docker-compose run --rm -T app rails c
7471
```
7572
@@ -84,6 +81,8 @@ Run the following command, to open it.
8481
docker-compose exec app rails c
8582
```
8683
84+
Also, you can use any IDE which supports the ruby-debug-ide gem (such as RubyMine or NetBeans) to debug the app running in the Docker container.
85+
8786
## Test
8887
8988
The hitobito application has a lot of rspec tests.
@@ -147,20 +146,8 @@ This method is also not too bad if your working environment got screwed up someh
147146
148147
Here follows a dicussion about why certain things were done a certain way in this repository.
149148
150-
### Exposed Ports
151-
152-
The `docker-compose.yml` file does expose all relevant ports.
153-
But it does not assign them a well-known port.
154-
This means, that it is _intentionally_ not possible to access the main application using `http://localhost:3000`!
155-
Either you use `docker-compose ps` (or the `docker-compose port SERVICE PORTNUMBER` command) to get the actual port Docker assigned – or you use something like [Reception](https://github.com/nxt-engineering/reception).
156-
157-
Why would you need this _Reception_ thingy? Because it makes all the services accessible through a reverse proxy that is accessible using `http://SERVICENAME.PROJECTNAME.docker` (or `http://SERVICENAME.PROJECTNAME.local` on Linux).
158-
This makes work more convenient and allows to have multiple projects, that all bind to the same port (e.g. `3000`), running at the same time.
159-
(Because Docker will handle the port conflict for us.)
160-
As an extra you get an overview over all running services and their exposed ports for free at `http://reception.docker` (or `http://reception.local` on linux).
161-
162149
### Mounts
163150
164151
The current directy is mounted by _docker-compose_ into the running containers.
165152
The main advantage is a much simpler workflow, because it allows you to change your 'local' files and they are immediately picked up by the commands in the server.
166-
I.e. you don't have to re-build the Docker images after every time.
153+
I.e. you don't have to re-build the Docker images after every code change.

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ services:
1010
- cache
1111
env_file: .docker/app.env
1212
ports:
13-
- 3000
13+
- "3000:3000"
14+
- "1234:1234"
1415
volumes:
1516
- ./:/app
1617
- seed:/seed
@@ -44,7 +45,7 @@ services:
4445
target: base
4546
command: [ mailcatcher, -f, --ip, '0.0.0.0' ]
4647
ports:
47-
- 1080
48+
- "1080:1080"
4849

4950
cache:
5051
image: memcached:1.5-alpine
@@ -72,6 +73,8 @@ services:
7273
command:
7374
- --sort_buffer_size=2M
7475
env_file: .docker/mysql.env
76+
ports:
77+
- "33066:3306"
7578
volumes:
7679
- db:/var/lib/mysql
7780

0 commit comments

Comments
 (0)