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

Commit 5d6f00f

Browse files
committed
Improved Documentation
1 parent 9d2832f commit 5d6f00f

File tree

3 files changed

+61
-30
lines changed

3 files changed

+61
-30
lines changed

.docker/Wagonfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

Dockerfile

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

8-
RUN ln -s /app/.docker/entrypoint /bin/entrypoint; \
9-
ln -s /app/.docker/waitfortcp /bin/waitfortcp
10-
118
WORKDIR /app/hitobito/
129
COPY hitobito/Wagonfile.ci ./Wagonfile
1310
COPY hitobito/Gemfile hitobito/Gemfile.lock ./
1411
RUN bundle install
1512

16-
ENV HITOBITO_WAGONS ""
17-
COPY .docker/Wagonfile ./
18-
1913
WORKDIR /app/
2014
COPY ./ ./
2115

16+
RUN ln -s /app/.docker/entrypoint /bin/entrypoint; \
17+
ln -s /app/.docker/waitfortcp /bin/waitfortcp
18+
2219
WORKDIR /app/hitobito/
2320
RUN bundle install
2421

@@ -31,7 +28,7 @@ ENTRYPOINT [ "/bin/entrypoint" ]
3128
CMD [ "rails", "server", "-b", "0.0.0.0" ]
3229

3330
####################################################################
34-
FROM dev as test
31+
FROM base as test
3532

3633
ENV RAILS_ENV=test
3734

README.md

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
# Hitobito
22

3-
_hitobito_ is an open source web application to manage complex group hierarchies with members, events and a lot more.
3+
_Hitobito_ is an open source web application to manage complex group hierarchies with members, events and a lot more.
4+
A quick way to begin working on Hitobito and it's wagons is using _Docker_ and _docker-compose_.
5+
6+
## System Requirements
7+
8+
In order to use this method, you need to have [Docker][docker] and _[docker-compose][doco]_ installed on your computer.
9+
The free _Docker Community Edition (CE)_ works perfectly fine.
10+
11+
[docker]: https://docs.docker.com/install/
12+
[doco]: https://docs.docker.com/compose/install/
413

514
## Preparation
615

7-
Check out the hitobito projects you'd like to build:
16+
First, you need to clone this repository:
17+
18+
```bash
19+
git clone https://github.com/nxt-engineering/hitobito-docker.git hitobito \
20+
&& cd hitobito
21+
```
22+
23+
This contains only the Docker instructions.
24+
But you will also need the Hitobito source code.
25+
That's why you need to clone the Hitobito core project and the specific Hitobito wagon you'd like to work on:
826

927
```bash
1028
# core project
1129
git clone https://github.com/hitobito/hitobito.git
1230

13-
# wagon projects
31+
# wagon project(s)
1432
git clone https://github.com/hitobito/hitobito_generic.git
1533
```
1634

@@ -19,19 +37,18 @@ You need to set up at least one wagon project.
1937
The final structure should look something like this:
2038

2139
```bash
22-
$ ls -l
40+
$ ls -lh
2341
total 16K
2442
-rw-r--r-- 1 user 1.3K Jul 15 10:57 Dockerfile
2543
-rw-r--r-- 1 user 1.4K Jul 15 17:43 README.md
2644
-rw-r--r-- 1 user 625 Jul 15 17:41 docker-compose.yml
2745
drwxr-xr-x 36 user 1.2K Jul 15 13:56 hitobito
2846
drwxr-xr-x 27 user 864 Jun 11 09:30 hitobito_generic
29-
drwxr-xr-x 29 user 928 Jul 15 09:43 hitobito_insieme
3047
```
3148

3249
## Docker Runtime
3350

34-
The simplest way to work on hitobito is to use Docker:
51+
To start the Hitobito application, run the following commands in your shell:
3552

3653
```bash
3754
# Start the application
@@ -44,17 +61,8 @@ echo "http://$(docker-compose port app 3000)"
4461
echo "http://$(docker-compose port mail 1080)"
4562
```
4663

47-
### Exposed Ports
48-
49-
The `docker-compose.yml` file does expose all relevant ports.
50-
But it does not assign them a well-known port.
51-
This means, that it is _intentionally_ not possible to access the main application using `http://localhost:3000`!
52-
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).
53-
54-
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).
55-
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.
56-
(Because Docker will handle the port conflict for us.)
57-
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).
64+
It will initially take a while to prepare the initial Docker images, to prepare the database and to start the application.
65+
The process will be shorter on subsequent starts.
5866

5967
## First Login
6068

@@ -124,3 +132,35 @@ docker-compose up sphinx
124132

125133
The server does not automatically re-index.
126134
In order to re-index, run the indexer again.
135+
136+
## Clean up / Reset
137+
138+
Once you've made your changes and decide to stop working on the project, you should clean up. The following command will remove all data that was created by Docker and _docker-compose_.
139+
140+
```bash
141+
docker-compose down --volumes --remove-orphans --rmi local
142+
```
143+
144+
This method is also not too bad if your working environment got screwed up somehow and you'd like to try a fresh start.
145+
146+
## Internals
147+
148+
Here follows a dicussion about why certain things were done a certain way in this repository.
149+
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+
162+
### Mounts
163+
164+
The current directy is mounted by _docker-compose_ into the running containers.
165+
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.

0 commit comments

Comments
 (0)