Commit
•
b469b43
1
Parent(s):
1777102
chore: Instructions for Livebook (#18)
Browse files
README.md
CHANGED
@@ -11,9 +11,9 @@
|
|
11 |
|
12 |
To start your Phoenix server:
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
19 |
|
@@ -26,29 +26,43 @@ The app is configured to deploy to Fly.io via a `fly.toml` file. To deploy, run
|
|
26 |
### Precomputing code vectors
|
27 |
|
28 |
To build the code vectors for the ICD-9 codelist for the deployed environment:
|
|
|
29 |
1. Connect to the server with `fly ssh console`.
|
30 |
2. Run `/app/bin/medical_transcription eval MedicalTranscription.Release.precompute_code_vectors`. This will prepare the vectors in the database if they are not present.
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
## Run in Docker
|
34 |
|
35 |
1. Create a local volume: `docker volume create ml-data`
|
36 |
2. Ensure the volume is writeable: `docker run --rm -v ml-data:/data busybox /bin/sh -c 'touch /data/.initialized && chmod 1777 /data'`. More background:
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
3. Build the image with: `docker build . -t headwayio/medical_transcription`
|
40 |
4. Run a container with: `docker run --env-file ./.env -p 4000:4000 headwayio/medical_transcription`
|
41 |
|
42 |
### Caveats
|
43 |
|
44 |
You may need to make a few changes to get the app running in Docker at the moment:
|
|
|
45 |
- In `lib/medical_transcription/application.ex`, comment out the `DNSCluster` child spec.
|
46 |
- In `rel/env.sh.eex`, comment out the `ERL_AFLAGS`, `RELEASE_DISTRIBUTION`, and `RELEASE_NODE` environment variables.
|
47 |
|
48 |
## Learn more
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
11 |
|
12 |
To start your Phoenix server:
|
13 |
|
14 |
+
- Run `mix setup` to install and setup dependencies
|
15 |
+
- Run `mix build_code_vectors` to download the ICD-9 codelist, precompute vectors, and store the results in the database.
|
16 |
+
- Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
|
17 |
|
18 |
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
19 |
|
|
|
26 |
### Precomputing code vectors
|
27 |
|
28 |
To build the code vectors for the ICD-9 codelist for the deployed environment:
|
29 |
+
|
30 |
1. Connect to the server with `fly ssh console`.
|
31 |
2. Run `/app/bin/medical_transcription eval MedicalTranscription.Release.precompute_code_vectors`. This will prepare the vectors in the database if they are not present.
|
32 |
|
33 |
+
### Livebook
|
34 |
+
|
35 |
+
In addition to connecting to a the deployed application via `iex`, Livebook supports connecting to the running application. Connecting a Livebook instance to the deployed application involves the following:
|
36 |
+
|
37 |
+
1. Install and setup Wireguard with a peer connection for Fly.io: [Step by Step](https://fly.io/docs/networking/private-networking/#install-your-wireguard-app)
|
38 |
+
2. Install and start Livebook: [Livebook.dev](https://livebook.dev/)
|
39 |
+
3. [Connecting Livebook to a Production App](https://fly.io/docs/elixir/advanced-guides/connect-livebook-to-your-app/) requires a node name and cookie value:
|
40 |
+
|
41 |
+
- Node name: `medical-transcription-cpu@myipfromfly` ("myipfromfly" can be retrieved with `fly ips private --app medical-transcription-cpu`)
|
42 |
+
- Cookie value: `0gfxcPtwryKxI2O1N0eFAg9p4MJGC-oUGShgj_wgvNEGiba5EDEJFA==` (this value is set in `fly.toml`)
|
43 |
|
44 |
## Run in Docker
|
45 |
|
46 |
1. Create a local volume: `docker volume create ml-data`
|
47 |
2. Ensure the volume is writeable: `docker run --rm -v ml-data:/data busybox /bin/sh -c 'touch /data/.initialized && chmod 1777 /data'`. More background:
|
48 |
+
|
49 |
+
- What the initial `1` for `chmod` means: <https://www.linuxnix.com/sticky-bit-set-linux/>
|
50 |
+
- How to update the permissions of a mounted volume: <https://serverfault.com/a/984599>
|
51 |
+
|
52 |
3. Build the image with: `docker build . -t headwayio/medical_transcription`
|
53 |
4. Run a container with: `docker run --env-file ./.env -p 4000:4000 headwayio/medical_transcription`
|
54 |
|
55 |
### Caveats
|
56 |
|
57 |
You may need to make a few changes to get the app running in Docker at the moment:
|
58 |
+
|
59 |
- In `lib/medical_transcription/application.ex`, comment out the `DNSCluster` child spec.
|
60 |
- In `rel/env.sh.eex`, comment out the `ERL_AFLAGS`, `RELEASE_DISTRIBUTION`, and `RELEASE_NODE` environment variables.
|
61 |
|
62 |
## Learn more
|
63 |
|
64 |
+
- Official website: <https://www.phoenixframework.org/>
|
65 |
+
- Guides: <https://hexdocs.pm/phoenix/overview.html>
|
66 |
+
- Docs: <https://hexdocs.pm/phoenix>
|
67 |
+
- Forum: <https://elixirforum.com/c/phoenix-forum>
|
68 |
+
- Source: <https://github.com/phoenixframework/phoenix>
|