Skip to content

Commit

Permalink
Add ability to run jobs inside of the all in one image
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Apr 16, 2021
1 parent bae16ed commit 2d4ff65
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Auto detect text files and perform LF normalization
* text=auto
*.sh text eol=lf

# Custom for Visual Studio
*.cs diff=csharp
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG UI_VERSION=ui:latest
ARG UI_VERSION="ui:latest"
FROM exceptionless/${UI_VERSION} AS ui

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
Expand Down Expand Up @@ -81,6 +81,7 @@ CMD [ "dotnet", "Exceptionless.Web.dll" ]
FROM exceptionless/elasticsearch:7.12.0 AS exceptionless

WORKDIR /app
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
COPY --from=ui /app ./wwwroot
COPY --from=ui /usr/local/bin/bootstrap /usr/local/bin/bootstrap
Expand Down
23 changes: 15 additions & 8 deletions build/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#!/bin/bash

sed -i -E "s/app\//app\/wwwroot\//" /usr/local/bin/bootstrap
sed -i -E "s/echo \"Running NGINX\"//" /usr/local/bin/bootstrap
sed -i -E "s/nginx//" /usr/local/bin/bootstrap
if [ "$#" -ne 0 ]; then
echo "Running Exceptionless Job $@"

/usr/local/bin/bootstrap
mkdir -p /var/log/exceptionless

if [ "$#" -ne 0 ]; then
exec "$@"
echo "Starting Elasticsearch..."
/usr/local/bin/docker-entrypoint.sh eswrapper > /var/log/exceptionless/elasticsearch.log 2>&1 &
sleep 5
eval "dotnet Exceptionless.Job.dll $@"
else
echo "Running Exceptionless Web"

mkdir -p /var/log/supervisor
mkdir -p Temp/

sed -i -E "s/app\//app\/wwwroot\//" /usr/local/bin/bootstrap
sed -i -E "s/app\/app\./app\/wwwroot\/app\./" /usr/local/bin/bootstrap
sed -i -E "s/app\/index\./app\/wwwroot\/index\./" /usr/local/bin/bootstrap
sed -i -E "s/echo \"Running NGINX\"//" /usr/local/bin/bootstrap
sed -i -E "s/nginx//" /usr/local/bin/bootstrap
/usr/local/bin/bootstrap

supervisord -c /etc/supervisord.conf
sleep 3

while [ ! -f /var/log/supervisor/elasticsearch.log ]; do sleep 1; done
while [ ! -f /var/log/supervisor/exceptionless.log ]; do sleep 1; done

tail -f /var/log/supervisor/*.log
fi
19 changes: 19 additions & 0 deletions samples/docker-compose.all-in-one.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.5'

# Runs the all in one Exceptionless docker image and a Kibana instance pointing to the Elasticsearch running inside of it

services:
elasticsearch:
image: exceptionless
ports:
- 5000:80
- 9200:9200
- 9300:9300

kibana:
depends_on:
- elasticsearch
image: docker.elastic.co/kibana/kibana:7.12.0
ports:
- 5601:5601

2 changes: 2 additions & 0 deletions samples/hosting-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ docker run --rm -it -p 5000:80 -p 5001:443 \
-v ~/esdata:/usr/share/elasticsearch/data \
exceptionless/exceptionless:latest

# run the datamigration job
docker run --rm -it exceptionless/exceptionless:latest DataMigration

0 comments on commit 2d4ff65

Please sign in to comment.