Skip to content

Commit 87a97f4

Browse files
committed
[New] fix startup steps.
1 parent 7203acf commit 87a97f4

File tree

6 files changed

+83
-182
lines changed

6 files changed

+83
-182
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
files/supervisor/*
2+
NVIDIA*

Diff for: 2-start-mldm.sh

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
#!/bin/bash
22

3-
mkdir $HOME/workspace/notebooks
3+
4+
# [prepare dir for Jupyter]
5+
mkdir -p $HOME/workspace/notebooks
6+
7+
# [start container with GPU support]
48
nvidia-docker run -d \
59
--name=mldm_gpu \
610
-v $HOME/workspace:/home/workspace \
7-
-p 8880-8899:8880-8899 \
8-
-it marsan/mldm_gpu ipynb
11+
-p 8880-8900:8880-8900 -p 80:80 -p 443:443 \
12+
-it marsan/mldm_gpu
913

10-
# --device /dev/nvidia0:/dev/nvidia0 \
11-
# --device /dev/nvidia1:/dev/nvidia1 \
12-
# --device /dev/nvidia2:/dev/nvidia2 \
13-
# --device /dev/nvidia3:/dev/nvidia3 \
14-
# --device /dev/nvidiactl:/dev/nvidiactl \
15-
# --device /dev/nvidia-uvm:/dev/nvidia-uvm \
16-
17-
1814
## -h mldm_env \
1915
## -p 6800-6810:6800-6810 \
2016
##docker run -it kaggle/python bash

Diff for: Dockerfile

+52-17
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,31 @@ RUN pip install --upgrade mpld3 && \
9393
RUN conda install mkl
9494
RUN conda install libgfortran
9595

96-
RUN pip install -U \
96+
RUN pip install \
9797
pandas \
9898
mongoengine \
9999
bottle \
100100
cherrypy \
101101
jieba3k \
102102
yolk3k \
103-
azure \
103+
azure
104+
105+
RUN pip install \
104106
cython \
105-
html5lib \
107+
html5lib
108+
109+
RUN pip install \
106110
pyyaml \
107111
demjson \
108-
hanziconv \
112+
hanziconv
113+
114+
RUN pip install \
109115
ftfy \
110116
hiredis \
111-
google-api-python-client
117+
google-api-python-client \
118+
regex
112119

113-
RUN pip install -U \
120+
RUN pip install \
114121
Django \
115122
django-pipeline \
116123
django-bootstrap3 \
@@ -125,9 +132,9 @@ RUN pip install \
125132
django-dashing
126133

127134

128-
# MySQL
129-
RUN apt-get install -y python3-dev libmysqlclient-dev
130-
RUN pip install mysqlclient
135+
## MySQL
136+
#RUN apt-get install -y python3-dev libmysqlclient-dev
137+
#RUN pip install mysqlclient
131138

132139

133140
# pathos (python parallel process)
@@ -137,7 +144,35 @@ RUN pip install mysqlclient
137144
# newspaper3k
138145

139146
# Tensorflow GPU supported version
140-
RUN pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl
147+
RUN pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
148+
149+
150+
#---------------------------------
151+
# Supervisord
152+
#---------------------------------
153+
# Install Supervisor.
154+
RUN \
155+
apt-get update && \
156+
apt-get install -y supervisor && \
157+
rm -rf /var/lib/apt/lists/* && \
158+
sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf
159+
160+
# Define mountable directories.
161+
VOLUME ["/etc/supervisor/conf.d"]
162+
163+
# ------------------------------------------------------------------------------
164+
# Security changes
165+
# - Determine runlevel and services at startup [BOOT-5180]
166+
RUN update-rc.d supervisor defaults
167+
168+
# - Check the output of apt-cache policy manually to determine why output is empty [KRNL-5788]
169+
RUN apt-get update | apt-get upgrade -y
170+
171+
# - Install a PAM module for password strength testing like pam_cracklib or pam_passwdqc [AUTH-9262]
172+
RUN apt-get install libpam-cracklib -y
173+
RUN ln -s /lib/x86_64-linux-gnu/security/pam_cracklib.so /lib/security
174+
175+
141176

142177
#---------------------------------
143178
# Enviroment
@@ -146,18 +181,18 @@ RUN pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0
146181
RUN echo "Asia/Taipei" > /etc/timezone
147182
RUN dpkg-reconfigure -f noninteractive tzdata
148183

149-
# Add runner script
150-
COPY files/runner.sh /runner.sh
151-
RUN chmod +x /runner.sh
152-
WORKDIR /root
184+
# conventions
153185
COPY files/bashrc .bashrc
154186
COPY files/vimrc .vimrc
155187

188+
# setup supervisor apps & start supervisor
189+
COPY files/supervisor/* /etc/supervisor/conf.d/
190+
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
191+
156192
## Set the working directory
157193
WORKDIR /home/workspace
158-
#RUN mkdir /home/workspace/notebooks
159-
#VOLUME /Users/marsan/wordspace
160194

161195
EXPOSE 8880:8900
196+
EXPOSE 80
197+
EXPOSE 443
162198

163-
ENTRYPOINT ["/runner.sh"]

Diff for: files/bashrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@ alias vi='vim'
9696
alias svi='vim'
9797
alias sget='apt-get install'
9898
alias psg='ps ax | grep'
99-
alias psga='psg "parse\|flow\|train\|maxminer\|_rtbminer\|_tnative\|ipython-notebook\|submit"'
99+
alias psga='psg "python"'
100100
alias python='python3'
101101
alias shup='stdbuf -o0 nohup'
102102
alias kget='wget -x --load-cookies ~/.ssh/cookies.txt -P data -nH --cut-dirs=5 '
103103
alias wat='watch tail -n 30 '
104+
bkill() {
105+
sudo kill -9 `ps aux | grep "$1" | awk '{print $2}'`
106+
}
104107

105108
# Add an "alert" alias for long running commands. Use like so:
106109
# sleep 10; alert

Diff for: files/runner.sh

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
#!/bin/bash
22
set -e
33

4-
case "$1" in
5-
"")
6-
bash
7-
;;
8-
ipynb)
9-
cd '/home/workspace/notebooks'
10-
ipython3 notebook --no-browser --ip='*' --matplotlib="inline"
11-
;;
12-
*)
13-
$@
14-
;;
15-
esac
4+
# start supervisor
5+
supervisord -c /etc/supervisor/supervisord.conf
6+
7+
#cd '/home/workspace/notebooks'; ipython3 notebook --no-browser --ip='*' --matplotlib="inline";
8+
9+
10+
#case "$1" in
11+
# "")
12+
# bash
13+
# ;;
14+
# ipynb)
15+
# cd '/home/workspace/notebooks'
16+
# ipython3 notebook --no-browser --ip='*' --matplotlib="inline"
17+
# ;;
18+
# *)
19+
# $@
20+
# ;;
21+
#esac
1622

1723
exit 0
1824

Diff for: files/supervisord.conf

-141
This file was deleted.

0 commit comments

Comments
 (0)