Skip to content

Commit

Permalink
fix startup script
Browse files Browse the repository at this point in the history
  • Loading branch information
CrowdHailer committed Oct 29, 2017
1 parent fa5ab48 commit 64f9e8c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,3 @@ for i in `docker ps -q`; do echo $i; echo " : "; docker inspect $i | grep -i ipa
```
docker-compose run web mix test
```

## TODO

- use registry
- Add Spec
- Add coverage
- Add live reloading
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ services:
environment:
- PORT=8080
- SECURE_PORT=8443
- SERVICE_NAME=www
- ERLANG_COOKIE=asd&%rewss
volumes:
- ./www:/home/elixir/app
Expand Down
7 changes: 4 additions & 3 deletions www/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ ARG CONTAINER_USER='elixir'

ARG APP_DIR=/home/"${CONTAINER_USER}"/app

RUN useradd -m -u 1000 -s /usr/bin/bash "${CONTAINER_USER}"
# RUN useradd -m -u 1000 -s /usr/bin/bash "${CONTAINER_USER}"

USER "${CONTAINER_USER}"
# USER "${CONTAINER_USER}"

WORKDIR "${APP_DIR}"

RUN mix local.hex --force && mix local.rebar --force
# TODO get + build deps

CMD elixir --sname app --cookie $ERLANG_COOKIE -S mix run --no-halt
COPY . ./
CMD ["sh", "bin/start"]
1 change: 1 addition & 0 deletions www/bin/start
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
elixir --sname app --cookie $ERLANG_COOKIE -S mix run --no-halt
10 changes: 7 additions & 3 deletions www/lib/www/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ defmodule WWW.Application do
{:ok, secure_port} = env.secure_port

IO.inspect("---------------")
IO.inspect(Node.self)
IO.inspect(Node.get_cookie)
Node.connect(:"app@www-1")
Node.connect(:"app@www-2")
Node.connect(:"app@www-3")
IO.inspect(Node.list)

options = [port: secure_port, certfile: "/run/secrets/certfile", keyfile: "/run/secrets/keyfile"]

children = [
# worker(WWW, [[port: port()]], id: :http),
# worker(WWW, [[port: secure_port(), tls: tls_options]], id: :https),
supervisor(Ace.HTTP.Service, [{WWW, :config}, options]),
supervisor(Ace.HTTP.Service, [{WWW, :config}, [port: 8080, cleartext: true]], id: :www_cleartext),
supervisor(Ace.HTTP.Service, [{WWW, :config}, options], id: :www_secure),
]

opts = [strategy: :one_for_one, name: WaterCooler.Supervisor]
Expand Down

0 comments on commit 64f9e8c

Please sign in to comment.