Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jupyter-db-pg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Emmanuel Bruno
jupyter-db-pg
Commits
fa401226
Commit
fa401226
authored
2 years ago
by
Emmanuel Bruno
Browse files
Options
Downloads
Patches
Plain Diff
moves to postgresql package and entrypoint.
parent
2b89e1ee
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
Artefacts/apt_packages
+3
-1
3 additions, 1 deletion
Artefacts/apt_packages
Dockerfile
+9
-10
9 additions, 10 deletions
Dockerfile
entrypoint.sh
+15
-0
15 additions, 0 deletions
entrypoint.sh
initDB.sh
+0
-5
0 additions, 5 deletions
initDB.sh
run.sh
+5
-6
5 additions, 6 deletions
run.sh
with
32 additions
and
22 deletions
Artefacts/apt_packages
+
3
−
1
View file @
fa401226
...
@@ -5,5 +5,7 @@ inkscape
...
@@ -5,5 +5,7 @@ inkscape
iputils-ping
iputils-ping
net-tools
net-tools
postgresql-client
postgresql-client
postgresql
procps
procps
tree
tree
rsync
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dockerfile
+
9
−
10
View file @
fa401226
...
@@ -2,27 +2,26 @@ FROM brunoe/jupyter-base:develop
...
@@ -2,27 +2,26 @@ FROM brunoe/jupyter-base:develop
USER
root
USER
root
COPY
Artefacts/apt_packages /tmp/apt_packages
RUN
--mount
=
type
=
cache,target
=
/var/cache/apt,sharing
=
locked
\
RUN
--mount
=
type
=
cache,target
=
/var/cache/apt,sharing
=
locked
\
apt-get update
&&
\
apt-get update
&&
\
apt-get
install
-qq
--yes
--no-install-recommends
\
apt-get
install
-qq
--yes
--no-install-recommends
\
$(
cat
/tmp/apt_packages
)
&&
\
$(
cat
/tmp/apt_packages
)
&&
\
chown
jovyan /var/run/postgresql/
&&
\
rm
-rf
/var/lib/apt/lists/
*
rm
-rf
/var/lib/apt/lists/
*
# Postgresql python library
# Postgresql python library
# SQL support for ipython and PlantUML
# SQL support for ipython and PlantUML
RUN
conda
install
--quiet
--yes
psycopg2
&&
\
RUN
conda
install
--quiet
--yes
psycopg2
&&
\
conda
install
-y
-c
conda-forge postgresql pgspecial
&&
\
conda clean
-tipy
&&
\
conda clean
-tipy
&&
\
pip
install
ipython-sql iplantuml mocodo
&&
\
pip
install
pgspecial
ipython-sql iplantuml mocodo
&&
\
fix-permissions
"
${
CONDA_DIR
}
"
&&
\
fix-permissions
"
${
CONDA_DIR
}
"
&&
\
fix-permissions
"/home/
${
NB_USER
}
"
fix-permissions
"/home/
${
NB_USER
}
"
ENV
PGDATA=/home/jovyan/work/pgdata
COPY
./entrypoint.sh /
RUN
chmod
+x /entrypoint.sh
COPY
initDB.sh /usr/local/bin/before-notebook.d/
#RUN ipython profile create && \
# sed -i -e '/c.InteractiveShellApp.extensions = / s/= [^\]]*/= ["mocodo_magic","sql"]/' -e 's/# \(c.InteractiveShellApp.extensions\)/\1/' ~/.ipython/profile_default/ipython_config.py
# Switch back to jovyan to avoid accidental container runs as root
# Switch back to jovyan to avoid accidental container runs as root
USER
$NB_UID
USER
$NB_UID
ENTRYPOINT
["/entrypoint.sh"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
entrypoint.sh
0 → 100755
+
15
−
0
View file @
fa401226
#!/bin/bash
set
-e
PGDATA
=
${
PGDATA
:-
/home/jovyan/srv/postgresql
}
DB_NAME
=
DEMO_DB
PG_PATH
=
$(
echo
/usr/lib/postgresql/
*
/bin/
)
rm
-rf
$PGDATA
/
$DB_NAME
sudo
-u
jovyan
$PG_PATH
/initdb
-D
$PGDATA
/
$DB_NAME
--auth-host
=
trust
--encoding
=
UTF8
chown
-R
jovyan:users /var/run/postgresql
sudo
-u
jovyan
$PG_PATH
/pg_ctl
-D
$PGDATA
/
$DB_NAME
-l
$PGDATA
/../
$DB_NAME
.log start
sudo
-u
jovyan createdb
--owner
=
jovyan jovyandb
exec
"
$@
"
This diff is collapsed.
Click to expand it.
initDB.sh
deleted
100755 → 0
+
0
−
5
View file @
2b89e1ee
DB_NAME
=
DEMO_DB
rm
-rf
$PGDATA
/
$DB_NAME
sudo
-u
jovyan initdb
-D
$PGDATA
/
$DB_NAME
sudo
-u
jovyan pg_ctl
-D
$PGDATA
/
$DB_NAME
-l
$PGDATA
/../
$DB_NAME
.log start
sudo
-u
jovyan createdb
--owner
=
jovyan jovyandb
\ No newline at end of file
This diff is collapsed.
Click to expand it.
run.sh
+
5
−
6
View file @
fa401226
#!/usr/bin/env bash
#!/usr/bin/env bash
WORKDIR
=
$HOME
/JUPYTER_WORK_DIR
WORKDIR
=
$HOME
/JUPYTER_WORK
IMAGE_REPO
=
brunoe
echo
brunoe/
${
PWD
##*/
}
:
$(
git rev-parse
--abbrev-ref
HEAD
)
docker run
--rm
-it
\
docker run
--rm
-it
\
--user
root
\
--user
root
\
...
@@ -10,6 +9,6 @@ docker run --rm -it \
...
@@ -10,6 +9,6 @@ docker run --rm -it \
--volume
$WORKDIR
:/home/jovyan/work
\
--volume
$WORKDIR
:/home/jovyan/work
\
--publish
8888:8888
\
--publish
8888:8888
\
--env
NB_UID
=
$UID
\
--env
NB_UID
=
$UID
\
brunoe/
${
PWD
##*/
}
:
$(
git rev-parse
--abbrev-ref
HEAD
)
$@
${
IMAGE_REPO
}
/
${
PWD
##*/
}
:
$(
git rev-parse
--abbrev-ref
HEAD
)
start-notebook.sh
# --env CHOWN_HOME_OPTS='-R' --env CHOWN_HOME=yes \
# start-notebook.sh --notebook-dir=/home/jovyan/notebooks/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment