Skip to content

Commit 5057534

Browse files
authored
Merge pull request #3 from zkhan12/dev
dockerize application
2 parents 18851e0 + 7b6f99c commit 5057534

File tree

6 files changed

+79
-33
lines changed

6 files changed

+79
-33
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:18.04
2+
3+
USER root
4+
5+
RUN apt-get update \
6+
&& apt-get -y install curl \
7+
&& chmod 777 /opt
8+
9+
ENV PATH="/opt/miniconda-latest/bin:$PATH"
10+
11+
RUN useradd --create-home --shell /bin/bash coder
12+
USER coder
13+
14+
RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
15+
&& conda_installer="/tmp/miniconda.sh" \
16+
&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
17+
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
18+
&& mkdir /home/coder/projects
19+
20+
WORKDIR /home/coder/projects
21+
22+
COPY --chown=coder . /home/coder/projects/
23+
24+
RUN conda env create -f environment.yml
25+
RUN bash -c 'conda init && . /home/coder/.bashrc'
26+
27+
ENTRYPOINT ["/opt/miniconda-latest/envs/log/bin/python", "./logToHtml.py"]

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# log-html
1+
# log-html
2+
Log-html is a command line tool which generates html summary files for directories with log files.
3+
4+
# Usage
5+
Log-html can be run
6+
## Python (via conda)
7+
Options inside of <> are where user specific information is entered
8+
- Create conda environment (inside cloned directory): `conda env create -f environment.yml`
9+
- Activate conda environment: `conda activate log`
10+
- Run script: `python logToHtml.py <location of log directory> <location of output file> <location of template file> <path to log directory on rdss (note this may be different than the first path to the log directory)>`
11+
- Example run script command: `python logToHtml.py ${PWD}/logs/ ${PWD}/outputs/summary.html templates/temp.tpl /home/user/Accelerometer/logs/`
12+
13+
## Docker
14+
Options inside of <> are where user specific information is entered
15+
- Build docker image (inside cloned directory): `docker build -t <image tag> .`
16+
- Run docker container: `docker run -v <path to log directory>:/home/coder/projects/logs -v <path to where outputs should be stored>:/home/coder/projects/outputs <image tag> /home/coder/projects/logs/ /home/coder/projects/outputs/<name of output html file> /home/coder/projects/templates/temp.tpl <path to log directory on rdss where output file will be opened from (note: this may be different than the first path to the log directory)>`
17+
- Example run command: `docker run -v ${PWD}/logs/:/home/coder/projects/logs -v ${PWD}/outputs/:/home/coder/projects/outputs htmllog:latest /home/coder/projects/logs/ /home/coder/projects/outputs/summary.html /home/coder/projects/templates/temp.tpl /home/user/Accelerometer/logs/`
18+
19+
## Singularity
20+
This image is available on dockerhub at: `hbclab/log-html` and can be pulled to run with singularity.

environment.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: log
2+
channels:
3+
- defaults
4+
dependencies:
5+
- _libgcc_mutex=0.1
6+
- ca-certificates=2020.1.1
7+
- certifi=2020.4.5.2
8+
- ld_impl_linux-64=2.33.1
9+
- libedit=3.1.20181209
10+
- libffi=3.3
11+
- libgcc-ng=9.1.0
12+
- libstdcxx-ng=9.1.0
13+
- ncurses=6.2
14+
- openssl=1.1.1g
15+
- pip=20.1.1
16+
- python=3.7.7
17+
- readline=8.0
18+
- setuptools=47.3.0
19+
- sqlite=3.31.1
20+
- tk=8.6.8
21+
- wheel=0.34.2
22+
- xz=5.2.5
23+
- zlib=1.2.11
24+
- pip:
25+
- jinja2==2.11.2
26+
- markupsafe==1.1.1
27+

logToHtml.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ def build_parser():
99
formatter_class=RawTextHelpFormatter
1010
)
1111
parser.add_argument('log_dir', help='(must be absolute path) directory where log '
12-
'files are kept')
12+
'files are mounted')
1313
parser.add_argument('output_file', help='location of the html output')
1414
parser.add_argument('template_file', help='location of the html template')
15+
parser.add_argument('rdss_log_dir', help='(must be absolute path) directory on '
16+
'rdss drive containing logs')
1517

1618
return parser
1719

@@ -40,10 +42,10 @@ def __init__(self, filename, status, path, date, time):
4042
time = contents[11:19]
4143
if 'ERROR' in contents:
4244
accel_files.append(Accel(fil, 'ERROR', 'file:///' +
43-
os.path.join(opts.log_dir, fil), date, time))
45+
os.path.join(opts.rdss_log_dir, fil), date, time))
4446
else:
4547
accel_files.append(Accel(fil, 'SUCCESS', 'file:///' +
46-
os.path.join(opts.log_dir, fil), date, time))
48+
os.path.join(opts.rdss_log_dir, fil), date, time))
4749

4850
env = jinja2.Environment(
4951
loader=jinja2.FileSystemLoader(searchpath=os.path.dirname(opts.template_file))

logs/successfulLog.log

Lines changed: 0 additions & 1 deletion
This file was deleted.

logs/unsuccessfulLog.log

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

0 commit comments

Comments
 (0)