Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field Publication as replacement for the old idai.field web platform #199

Merged
merged 430 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
430 commits
Select commit Hold shift + click to select a range
087af35
Delete publications when deleting project
dersmon Nov 3, 2023
cea37cb
Remove publications column on project index page
dersmon Nov 3, 2023
3a18dba
Handle publications without any images
dersmon Nov 3, 2023
7eee2f6
Remove publications silently when deleting project
dersmon Nov 3, 2023
f3603aa
Only show input if publication date is off
dersmon Nov 3, 2023
9eb701c
Fix compiler warnings about unused code
dersmon Nov 3, 2023
8938eb0
Display icon when listing publications
dersmon Nov 3, 2023
d1afe10
Remove unused alias and variables
dersmon Nov 3, 2023
7066cf0
Add "for" attribute to stop compiler warning
dersmon Nov 3, 2023
309286a
Apply `mix format`
dersmon Nov 3, 2023
05efc81
Refactor pubsub messages
dersmon Nov 3, 2023
d0e90f0
Further refactors to publication view
dersmon Nov 3, 2023
b5df0b0
Harmonize handling of process results
dersmon Nov 3, 2023
53a9d97
Fix progress bar for replication
dersmon Nov 3, 2023
9d0547c
Navigate to newly created projects
dersmon Nov 3, 2023
2cca750
Show "-" if no publications for project exist
dersmon Nov 3, 2023
c60ac5a
Remove deprecated/duplicate functions
dersmon Nov 7, 2023
d7d6d86
Add fallback error match
dersmon Nov 7, 2023
7ecfedb
Add doc strings
dersmon Nov 8, 2023
65fd42b
Remove unnecessary function calls
dersmon Nov 9, 2023
ad038e2
Add troubleshooting section
eighttrigrams Nov 13, 2023
199f7d3
Add getting started section
eighttrigrams Nov 13, 2023
6e99bcb
Increase timeouts for file replication
dersmon Nov 22, 2023
b83813a
Update doc strings and comments
dersmon Dec 1, 2023
4d5ec78
Rework replication as GenServer
dersmon Jan 8, 2024
4dcec60
Apply `mix format`
dersmon Jan 10, 2024
2ddf0e4
Refactor replication
dersmon Jan 10, 2024
046ad6c
Remove unused function
dersmon Jan 10, 2024
abbaa27
Delete all relevant data when stopping replication
dersmon Jan 10, 2024
a63373b
Refactor function name
dersmon Jan 10, 2024
c1e4b2e
Remove alias to removed module
dersmon Jan 10, 2024
1e8eb96
Rework display replication input errors
dersmon Jan 10, 2024
dbae046
Fix wildcard selector
dersmon Jan 11, 2024
bd94c40
Transform legacy data following database replication
dersmon Jan 11, 2024
65cc70c
Break legacy data transformations nito separate functions
dersmon Jan 11, 2024
0738203
Remove case statement
dersmon Jan 11, 2024
1d56250
Minor refactoring in database replication
dersmon Jan 11, 2024
550bccf
Show all replication logs while replication is running
dersmon Jan 11, 2024
ea4dad8
Fix return value
dersmon Jan 11, 2024
c75cac3
Rephrase log
dersmon Jan 11, 2024
0dcfea3
Hide progress bar if there is no data
dersmon Jan 11, 2024
a48723a
Move/rename PublicationsData module
dersmon Jan 16, 2024
28b6986
Add search index processing
dersmon Jan 16, 2024
20d4e4e
Use Elixir standard function instead of own implementation
dersmon Jan 16, 2024
3627f58
Add option to start data processing immediately after replication
dersmon Jan 16, 2024
b8e1a64
Handle missing processing evaluation correctly
dersmon Jan 16, 2024
635e4a6
Do not add comments when starting replication
dersmon Jan 16, 2024
adf4f8f
Do not use Stream module function before async_stream
dersmon Feb 18, 2024
6d37ea4
Add experimental open layers live component
dersmon Mar 4, 2024
565d893
Refactor open layers hook
dersmon Mar 4, 2024
6280234
Create `Presentation` module to group all presentation live views
dersmon Mar 5, 2024
5693bbd
Use inspect/1 on error before logging it
dersmon Mar 6, 2024
7857013
Wait up to a minute when asking FieldHub for file index
dersmon Mar 6, 2024
c8ad1a6
Fix open layers css preprocessing by tailwind
dersmon Mar 6, 2024
6bdefc4
Center on feature if there is only one present
dersmon Mar 6, 2024
6a86b22
Make resolving the coordinates behind a gazetteer a legacy transforma…
dersmon Mar 6, 2024
dcab390
Use replication log for crashed tasks
dersmon Mar 9, 2024
303cbc6
Refactor variable name
dersmon Mar 9, 2024
0e519c8
Throw on error in couch replication
dersmon Mar 9, 2024
8e8babd
Delete incomplete publications on failure
dersmon Mar 9, 2024
58bcb6e
Add function to check if replication is already running
dersmon Mar 9, 2024
3b85105
Add Earmark for markdown to html transformations
dersmon Mar 9, 2024
1873ebf
Add stubs for i18n component and project landing page
dersmon Mar 9, 2024
a15aa06
Bump idai-field-core dependency
dersmon Mar 9, 2024
c36f0ea
Only ignore top level `data/` directory
dersmon Mar 9, 2024
17252c0
Correctly evaluate if publication date already reached
dersmon Mar 10, 2024
bf260c5
Save languages used in publication when finalizing replication
dersmon Mar 10, 2024
cd49ee3
Use FieldPublication's project name instead of the identifier used by…
dersmon Mar 10, 2024
47d2490
Sort published publications by newest first
dersmon Mar 17, 2024
a5b0b28
Add some basic ideas for i18n and usage in components
dersmon Mar 17, 2024
e583d71
Remove unused handle_event/3
dersmon Mar 18, 2024
dac42f9
Experiment with Open Layers and IIIF
dersmon Mar 18, 2024
4231afc
Handle 404 by cantaloupe in the reverse proxy plug
dersmon Mar 19, 2024
f050268
Attachments are now already deleted after replication
dersmon Mar 19, 2024
8c5a4c8
Relations are already being extended in `apply_project_configuration/2`
dersmon Mar 19, 2024
bb50fea
Add fields for drafted_by and publication version to Publication schema
dersmon Mar 22, 2024
afabc9f
Use plain form instead of phoenix components
dersmon Mar 22, 2024
483d064
Prevent deselection of "initial" publication
dersmon Mar 22, 2024
7adf6f9
Add live component for creating translations
dersmon Mar 26, 2024
1bf58b7
Create form assign for publication
dersmon Mar 26, 2024
cf56d2b
Downgrade reverse proxy plug to fix cantaloupe proxy
dersmon Mar 26, 2024
f003d54
Also update form assign once replication finishes
dersmon Mar 26, 2024
d9854ef
Add todo
dersmon Mar 26, 2024
178e5c4
Remove unused `handle_params/3`
dersmon Mar 26, 2024
0571403
Split and group live view attributes over two elements
dersmon Mar 26, 2024
58c9b39
Switch the order of logging and setting the lanagues/replication fini…
dersmon Mar 27, 2024
e0ac66f
Update dependencies
dersmon Mar 27, 2024
a3e1d15
Only display editable publication fields after replication is done
dersmon Mar 27, 2024
42d74f3
Allow free selection of publication version for now
dersmon Mar 27, 2024
0e7dace
Add a link from publication edit directly to publication presentation
dersmon Mar 27, 2024
feeaebc
Refactor presentation views and component structure
dersmon Mar 27, 2024
fe5f543
Add helper functions to grab field labels or values
dersmon Mar 27, 2024
5c3c235
Use gettext for UI localization
dersmon Mar 28, 2024
2318353
Remove deprecated home controller and template
dersmon Mar 28, 2024
23b2b42
Return to initial path after switching UI locale
dersmon Mar 30, 2024
5d08f3e
Try english default before falling back to first language found in map
dersmon Mar 30, 2024
8cbf441
Experiment with generic document component
dersmon Mar 30, 2024
a60b2fb
Keep document UUID when switching project date or language
dersmon Mar 31, 2024
e883653
Add image document component
dersmon Apr 1, 2024
d330b00
Reduce home map height
dersmon Apr 3, 2024
62f6327
Add raw data downloads to components
dersmon Apr 3, 2024
4b47346
Use I18n component also for single value fields
dersmon Apr 3, 2024
3bde618
Render dates, integer and radio button values with the same component
dersmon Apr 3, 2024
75b4566
Rename component and hook
dersmon Apr 5, 2024
9634abb
Add stub for project map component and hook
dersmon Apr 5, 2024
b43d172
Remove unused functions
dersmon Apr 8, 2024
e447fed
Use assign/3 consistently
dersmon Apr 8, 2024
3deddca
Encode cantaloupe JSON 404 response
dersmon Apr 8, 2024
89340b6
Bump idai-field-core dependency for recreating project configurations
dersmon Apr 8, 2024
64ea736
Present institution names in different languages correctly
dersmon Apr 8, 2024
63a804f
Apply DAI styling to .markdown content
dersmon Apr 8, 2024
c1de354
Add support for further fields
dersmon Apr 8, 2024
46bcc2e
Remove inspect
dersmon Apr 8, 2024
950c20a
Handle projects without coordinates in project document
dersmon Apr 8, 2024
0a4813c
Do not call Map.get/2 on potential nil values
dersmon Apr 8, 2024
47d3226
Only show project language dropdown if multiple languages present
dersmon Apr 9, 2024
f721b3c
Avoid data restructuring in heex template
dersmon Apr 9, 2024
016eee4
Add shadow for IIIF viewer
dersmon Apr 9, 2024
f2ab7e5
Reject field groups without actual data
dersmon Apr 9, 2024
816ed59
Reformat project link and email display
dersmon Apr 9, 2024
77b6113
Fix html tags
dersmon Apr 9, 2024
28bd48a
Remove IO.inspect/1
dersmon Apr 9, 2024
99eaad7
Move UI language route to correct router position
dersmon Apr 9, 2024
2e33f05
Include old idai.field web CSS as a default
dersmon Apr 9, 2024
4cec936
Add link from document to home view
dersmon Apr 9, 2024
2af6270
Override default link color for publication list text
dersmon Apr 9, 2024
259aadd
Remove "hidden" field for projects and rework editor selection
dersmon Apr 9, 2024
6bf189f
Remove "initial" publication version
dersmon Apr 9, 2024
dca7a7d
Trigger actions using links not buttons
dersmon Apr 9, 2024
51770a3
Rework publication input comment interface
dersmon Apr 12, 2024
8cd441f
Remove unused form module
dersmon Apr 12, 2024
0fa8f83
Remove unused function and inspects
dersmon Apr 12, 2024
a334d99
Reject publications with future publication dates
dersmon Apr 12, 2024
4b8846b
Reduce background intensity
dersmon Apr 12, 2024
f2c1764
Support CouchDBs _bulk_get endpoint for retrieving a lot of docs at once
dersmon Apr 12, 2024
eaa347f
Use better margin definition
dersmon Apr 12, 2024
fe5459e
Push current project map implementation
dersmon Apr 12, 2024
98120ae
Build special document link if it is the project document
dersmon Apr 12, 2024
371e2f6
Style image previews for generic documents
dersmon Apr 12, 2024
9db8d8b
Style image previews and project map for project document
dersmon Apr 12, 2024
a80038b
Do not add geometry fields to document data list
dersmon Apr 12, 2024
7d2755d
Render "dimension" type fields
dersmon Apr 12, 2024
3a01302
Add rough version for raw JSON data endpoint
dersmon Apr 12, 2024
2974251
Remove IO.inspect/1
dersmon Apr 12, 2024
9a1b744
Fix color code for publication state
dersmon Apr 12, 2024
b33b409
Process images sequentially
dersmon Apr 15, 2024
7818a01
Implement processing tasks for indexing in open search
dersmon Apr 15, 2024
75d9192
Clear unused search index at the end of successful indexing
dersmon Apr 15, 2024
3c9259a
Check for correct processing task
dersmon Apr 16, 2024
10a29e1
Add basic search for landig page
dersmon Apr 16, 2024
31cf470
Replace browsing history when redirecting
dersmon Apr 16, 2024
9dc6df7
Use live view navigate instead of standard href
dersmon Apr 16, 2024
da99339
Add translated labels and color for categories when applying configur…
dersmon Apr 17, 2024
f7de6f9
Add bottom margin to every document link
dersmon Apr 17, 2024
05b0a90
Cache configuration docs for 7 days
dersmon Apr 17, 2024
1328935
Patch query parameter for navigation
dersmon Apr 17, 2024
17b4d2d
Update reverse proxy plug dependency
dersmon Apr 17, 2024
b5ab741
Show shortDescription in document links
dersmon Apr 17, 2024
a67926e
Display category label behind identifier in h1
dersmon Apr 17, 2024
348fce8
Display relation count in heading
dersmon Apr 17, 2024
bee7c0d
Correctly handle "checkboxes" field type with only one value instead …
dersmon Apr 17, 2024
a6daa27
Display short description also for search results
dersmon Apr 17, 2024
f8f4894
Add admin button to re-index search for all publications
dersmon Apr 18, 2024
4c9d47f
Set English as the default language for legacy projects
dersmon Apr 18, 2024
41e4f1b
Use `Task.async_stream/3` instead of custom batching
dersmon Apr 18, 2024
8ec49d2
Move project contact towards the top
dersmon Apr 18, 2024
b41391d
Float project images to the top right of the project description
dersmon Apr 18, 2024
169f7ea
Join names in staff list into single string
dersmon Apr 18, 2024
eec63a6
Rework publication input form
dersmon Apr 18, 2024
6c3011d
Reduce max height for project doc image panel
dersmon Apr 18, 2024
633feaf
Display error if IIIFViewer gets 404 from cantaloupe
dersmon Apr 18, 2024
3b8e750
Update README
dersmon Apr 19, 2024
c800be7
Fix typo
dersmon Apr 19, 2024
3da7186
Check for correct processing task
dersmon Apr 19, 2024
cd7c222
Commit latest project map tinkering...
dersmon Apr 19, 2024
25f971a
Get project map js running again
dersmon Apr 19, 2024
4dc78c6
Add publication hierarchy document
dersmon Apr 19, 2024
bd5dabb
Set IIIF viewer height based on vh
dersmon Apr 19, 2024
c03e154
Limit document link height in image document component
dersmon Apr 19, 2024
7b15a72
Remove unused live view
dersmon Apr 19, 2024
d384e7f
Add hint that translations were provided but the current selection di…
dersmon Apr 22, 2024
440278c
Add "unsignedFloat" generic field
dersmon Apr 22, 2024
da1a166
Rearrange and rename directory/module structure
dersmon Apr 24, 2024
41afc4e
Add hierarchy view
dersmon Apr 24, 2024
843dcee
Fix module names I forgot to update
dersmon Apr 24, 2024
ec4a9a3
Decrease space between top bar and content
dersmon Apr 24, 2024
d0bbb56
Push map feature creation from home view to world map component
dersmon Apr 26, 2024
cb236e5
Copy default cantaloupe properties
dersmon Apr 26, 2024
d25162d
Clean up cantaloupe service configuration/setup
dersmon Apr 26, 2024
e5f0852
Add button search navigation
dersmon Apr 26, 2024
855442c
Remove single line pipe
dersmon Apr 26, 2024
7a005c1
Optimize retrieval of current publications
dersmon May 6, 2024
ecce3d9
Re-add function for retrieving current publication for single project
dersmon May 6, 2024
2a0d916
Automatically create CouchDB index for `doc_type` queries
dersmon May 6, 2024
2daebb9
Use document links in document heading
dersmon May 7, 2024
a02bf8e
Add plug for checking image publication status
dersmon May 7, 2024
c300004
Add padding to label
dersmon May 7, 2024
bfe0b65
Add "identifier" when applying project configuration
dersmon May 7, 2024
d2a19b8
Experiment with setting page title
dersmon May 7, 2024
02e4855
Replace empty icon
dersmon May 7, 2024
7cca3fe
Use title suffix again
dersmon May 7, 2024
f7933a8
Move some configurations from dev.exs to general config
dersmon May 7, 2024
319e5b2
Mirror `FileStore` structure in cantaloupe configuration
dersmon May 10, 2024
c57735e
Handle OpenSearch url as runtime config
dersmon May 13, 2024
ce3fb2f
Fix module references
dersmon May 13, 2024
c245773
Make locale selection work on Chrome
dersmon May 14, 2024
630591e
Correctly set forward proxy headers for cantaloupe
dersmon May 14, 2024
bb464ce
Introduce docker deployment workflow
dersmon May 14, 2024
bb95fab
Add fullscreen button to image viewer
dersmon May 14, 2024
43ee8dc
Update example docker compose swarm
dersmon May 14, 2024
9540b6d
Pin docker compose to specific cantaloupe image version
dersmon May 14, 2024
b3f74a5
Align order of service definitions in docker compose files
dersmon May 14, 2024
25f9f7d
Add comment regarding exposing CouchDB
dersmon May 14, 2024
0ad245d
Do not add specific elixir project into the vscode configuration
dersmon May 10, 2024
b53cacc
Add basic map tile processing
dersmon May 14, 2024
17e244c
Remove copy-pasted function call
dersmon May 14, 2024
1b05071
Add rough implementation of tile generator and endpoint
dersmon May 16, 2024
79640be
Add rough optimization for the tiling process
dersmon May 17, 2024
35499d6
Optimize tiling logic
dersmon May 17, 2024
c7ca4fd
Only display default map layer on project document view
dersmon May 24, 2024
6caa3a6
Add quotes around variable values in log
dersmon May 24, 2024
d08e936
Add first very version of project map
dersmon May 24, 2024
4e8aed6
Move imagemagick calls into separate module
dersmon May 28, 2024
dc66641
Revert "Add mix alias to seed FieldWeb via Desktop"
dersmon May 29, 2024
9b8a964
Revert "Create document if it does not exist"
dersmon May 29, 2024
58f7d2c
Revert "Fix condition"
dersmon May 29, 2024
c291b82
Revert "Return data on example routes"
dersmon May 29, 2024
abe2789
Revert "Implement project authorization"
dersmon May 29, 2024
2c47cfe
Revert "Split projects and their publications"
dersmon May 29, 2024
7c754f7
Revert "Remove project membership from user documents"
dersmon May 29, 2024
d95a0fe
Revert "Remove unused pattern match"
dersmon May 29, 2024
a265588
Revert "Hash passwords using Argon2"
dersmon May 29, 2024
478e9ad
Revert "Add user database based basic authentication"
dersmon May 29, 2024
57e2e83
Revert "Remove IO.inspect and TODO"
dersmon May 29, 2024
815e71f
Revert "Increase HTTPoison timeout for replication"
dersmon May 29, 2024
81bd6ab
Revert "Add port check when starting API server"
dersmon May 29, 2024
d843e87
Revert "Upgrade CouchDB version"
dersmon May 29, 2024
aa3a978
Revert "Upgrade to Elixir 1.14"
dersmon May 29, 2024
43cb3dc
Revert "Initial hacky introduction of FieldHub-to-Web"
dersmon May 29, 2024
8ef9a5e
Do partial revert affecting idai.field web
dersmon May 29, 2024
81240c9
Display dropdownRange fields
dersmon May 29, 2024
2e44e5d
Handle multiselect dropdowns
dersmon May 29, 2024
aa6e235
Hide group headings that do not contain any fields
dersmon May 29, 2024
c0b25b5
Remove UI elements without functionality
dersmon May 29, 2024
0dda38d
Fix json download links
dersmon May 29, 2024
c533f5f
Fix module reference
dersmon May 29, 2024
ae286ec
Update pattern match
dersmon May 29, 2024
531b8e8
Add tile generation to publishing interface
dersmon May 29, 2024
8644a43
Set valid log message
dersmon May 29, 2024
bb531bf
Wrap final replication steps into supervised task
dersmon May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"files.watcherExclude": {
"**/node_modules/*/**": true
},
"elixirLS.projectDir": "server"
}

}
}
47 changes: 47 additions & 0 deletions publication/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This file excludes paths from the Docker build context.
#
# By default, Docker's build context includes all files (and folders) in the
# current directory. Even if a file isn't copied into the container it is still sent to
# the Docker daemon.
#
# There are multiple reasons to exclude files from the build context:
#
# 1. Prevent nested folders from being copied into the container (ex: exclude
# /assets/node_modules when copying /assets)
# 2. Reduce the size of the build context and improve build time (ex. /build, /deps, /doc)
# 3. Avoid sending files containing sensitive information
#
# More information on using .dockerignore is available here:
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

.dockerignore

# Ignore git, but keep git HEAD and refs to access current commit hash if needed:
#
# $ cat .git/HEAD | awk '{print ".git/"$2}' | xargs cat
# d0b8727759e1e0e7aa3d41707d12376e373d5ecc
.git
!.git/HEAD
!.git/refs

# Common development/test artifacts
/cover/
/doc/
/test/
/tmp/
.elixir_ls

# Mix artifacts
/_build/
/deps/
*.ez

# Generated on crash by the VM
erl_crash.dump

# Static artifacts - These should be fetched and built inside the Docker image
/assets/node_modules/
/priv/static/assets/
/priv/static/cache_manifest.json

/data
5 changes: 5 additions & 0 deletions publication/.formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
import_deps: [:phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"]
]
41 changes: 41 additions & 0 deletions publication/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Temporary files, for example, from tests.
/tmp/

# Ignore package tarball (built via "mix hex.build").
field_publication-*.tar

# Ignore assets that are produced by build tools.
/priv/static/assets/

# Ignore digested assets cache.
/priv/static/cache_manifest.json

# In case you use Node.js/npm, you want to ignore these.
npm-debug.log
/assets/node_modules/

/data/
!/data/**/.gitkeep

test/file_store
117 changes: 117 additions & 0 deletions publication/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
# instead of Alpine to avoid DNS resolution issues in production.
#
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu
# https://hub.docker.com/_/ubuntu?tab=tags
#
# This file is based on these images:
#
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20240130-slim - for the release image
# - https://pkgs.org/ - resource for finding needed packages
# - Ex: hexpm/elixir:1.16.1-erlang-26.2.2-debian-bullseye-20240130-slim
#
ARG ELIXIR_VERSION=1.16.1
ARG OTP_VERSION=26.2.2
ARG DEBIAN_VERSION=bullseye-20240130-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"

FROM ${BUILDER_IMAGE} as builder

# install build dependencies
RUN apt-get update -y && apt-get install -y build-essential git curl \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash
RUN apt-get install -y nodejs

# prepare build dir
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force

# set build ENV
ENV MIX_ENV="prod"

# install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config

# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/

RUN mix deps.compile

COPY priv priv

RUN npm install --prefix priv/publication_enricher

COPY lib lib

COPY assets assets

RUN npm install --prefix assets
# compile assets
RUN mix assets.deploy

# Compile the release
RUN mix compile

# Changes to config/runtime.exs don't require recompiling the code
COPY config/runtime.exs config/

COPY rel rel
RUN mix release

# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}

RUN apt-get update -y

RUN apt-get install -y imagemagick libopenjp2-tools ffmpeg curl

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash
RUN apt-get install -y nodejs

COPY ./cantaloupe/imagemagick-policy.xml /usr/share/ImageMagick-6/policy.xml

RUN apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN mkdir -p "/files"
RUN chown nobody /files

WORKDIR "/app"
RUN chown nobody /app

# set runner ENV
ENV MIX_ENV="prod"

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/field_publication ./

USER nobody



# If using an environment that doesn't automatically reap zombie processes, it is
# advised to add an init process such as tini via `apt-get install`
# above and adding an entrypoint. See https://github.com/krallin/tini for details
# ENTRYPOINT ["/tini", "--"]

CMD ["/app/bin/server"]
43 changes: 43 additions & 0 deletions publication/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Field Publication

Field Publication is the publication plattform for Field projects.

# Development

## Prerequisites

* [Docker](https://www.docker.com/)
* [Elixir](https://elixir-lang.org/) >= 1.14

## 1. Starting auxiliary services with docker

Field Publication relies on several services:
- [OpenSearch](https://opensearch.org/) as the search engine.
- [CouchDB](https://couchdb.apache.org) as the database.
- [Cantaloupe](https://cantaloupe-project.github.io/) as the [IIIF](https://iiif.io/) image server.

The [docker-compose.yml](docker-compose.yml) defines all three services for development. For starting the dockerized services run:
```
docker-compose up
```

## 2. Running the setup

We define a mix command `alias` for the setup (see [mix.exs](mix.exs)):
```
mix setup
```

## 3. Running the application
Now you may start the Phoenix application with either
```
mix phx.server
```

or, if you want to use Elixir's interactive `iex` REPL to interact with the application directly from the command line

```
iex -S mix phx.server
```

Now you can visit [`localhost:4001`](http://localhost:4001) in your browser and should see the landing page. The next step would be to login as the COUCHDB_USER as defined in the [docker-compose.yml](docker-compose.yml).
Loading