Skip to content

Commit 14d8a66

Browse files
committed
Add mysql and postgres tags for liquibase
1 parent 1e05f81 commit 14d8a66

File tree

15 files changed

+645
-14
lines changed

15 files changed

+645
-14
lines changed

bin/provision.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,5 +431,12 @@ function header() {
431431
header "certbot"
432432
}
433433

434+
## Build liquibase
435+
[[ $(checkBuildTarget liquibase) ]] && {
436+
header "liquibase"
437+
clearConfiguration liquibase '*'
438+
deployConfiguration liquibase/general liquibase '*'
439+
}
440+
434441

435442
exit 0

bin/webdevops/Dockerfile.pyc

3.08 KB
Binary file not shown.

bin/webdevops/Provisioner.pyc

6.16 KB
Binary file not shown.

bin/webdevops/__init__.pyc

149 Bytes
Binary file not shown.

docker/liquibase/latest/Dockerfile.jinja2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
{{ docker.version() }}
44

5-
{{ environment.liquibase('3.5.1') }}
5+
{{ environment.liquibase('3.5.1', 'com.mysql.jdbc.Driver', '/usr/share/java/mysql.jar') }}
66

77
{{ docker.copy('conf/', '/opt/docker/') }}
88

9-
{{ liquibase.default() }}
9+
{{ liquibase.mysql() }}
1010

1111
{{ docker.entrypoint("/opt/docker/bin/entrypoint.sh") }}
1212

docker/liquibase/mysql/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#+++++++++++++++++++++++++++++++++++++++
2+
# Dockerfile for webdevops/liquibase:mysql
3+
# -- automatically generated --
4+
#+++++++++++++++++++++++++++++++++++++++
5+
6+
FROM java:latest
7+
8+
9+
LABEL vendor=WebDevOps.io
10+
LABEL io.webdevops.layout=8
11+
LABEL io.webdevops.version=0.57.0
12+
13+
ENV LIQUIBASE_VERSION "3.5.1"
14+
ENV LIQUIBASE_DRIVER "com.mysql.jdbc.Driver"
15+
ENV LIQUIBASE_CLASSPATH "/usr/share/java/mysql.jar"
16+
ENV LIQUIBASE_URL ""
17+
ENV LIQUIBASE_USERNAME ""
18+
ENV LIQUIBASE_PASSWORD ""
19+
ENV LIQUIBASE_CHANGELOG "/liquibase/changelog.xml"
20+
ENV LIQUIBASE_CONTEXTS ""
21+
ENV LIQUIBASE_OPTS ""
22+
23+
COPY conf/ /opt/docker/
24+
25+
RUN apt-get update \
26+
&& apt-get install -yq --no-install-recommends \
27+
libmysql-java \
28+
&& wget -q -O/tmp/liquibase.tar.gz "https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz" \
29+
&& mkdir -p /opt/liquibase \
30+
&& tar -xzf /tmp/liquibase.tar.gz -C /opt/liquibase \
31+
&& rm -f /tmp/liquibase.tar.gz \
32+
&& chmod +x /opt/liquibase/liquibase \
33+
&& ln -s /opt/liquibase/liquibase /usr/local/bin/ \
34+
&& chmod +x /opt/docker/bin/entrypoint.sh \
35+
&& apt-get clean \
36+
&& rm -r /var/lib/apt/lists/*
37+
38+
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
39+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{ docker.fromOfficial("java") }}
2+
3+
{{ docker.version() }}
4+
5+
{{ environment.liquibase('3.5.1', 'com.mysql.jdbc.Driver', '/usr/share/java/mysql.jar') }}
6+
7+
{{ docker.copy('conf/', '/opt/docker/') }}
8+
9+
{{ liquibase.mysql() }}
10+
11+
{{ docker.entrypoint("/opt/docker/bin/entrypoint.sh") }}
12+
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#!/bin/bash
2+
3+
set -o pipefail
4+
set -o errtrace
5+
set -o nounset
6+
set -o errexit
7+
8+
LIQUIBASE_OPTS="$LIQUIBASE_OPTS --defaultsFile=/liquibase.properties"
9+
10+
echo -n > /liquibase.properties
11+
12+
## Database driver
13+
if [[ -n "$LIQUIBASE_DRIVER" ]]; then
14+
echo "driver: ${LIQUIBASE_DRIVER}" >> /liquibase.properties
15+
fi
16+
17+
## Classpath
18+
if [[ -n "$LIQUIBASE_CLASSPATH" ]]; then
19+
echo "classpath: ${LIQUIBASE_CLASSPATH}" >> /liquibase.properties
20+
fi
21+
22+
## Database url
23+
if [[ -n "$LIQUIBASE_URL" ]]; then
24+
echo "url: ${LIQUIBASE_URL}" >> /liquibase.properties
25+
fi
26+
27+
## Database username
28+
if [[ -n "$LIQUIBASE_USERNAME" ]]; then
29+
echo "username: ${LIQUIBASE_USERNAME}" >> /liquibase.properties
30+
fi
31+
32+
## Database password
33+
if [[ -n "$LIQUIBASE_PASSWORD" ]]; then
34+
echo "password: ${LIQUIBASE_PASSWORD}" >> /liquibase.properties
35+
fi
36+
37+
## Database contexts
38+
if [[ -n "$LIQUIBASE_CONTEXTS" ]]; then
39+
echo "contexts: ${LIQUIBASE_CONTEXTS}" >> /liquibase.properties
40+
fi
41+
42+
## Database changelog file
43+
if [[ -n "$LIQUIBASE_CHANGELOG" ]]; then
44+
echo "changeLogFile: ${LIQUIBASE_CHANGELOG}" >> /liquibase.properties
45+
fi
46+
47+
function executeLiquibase() {
48+
exec /opt/liquibase/liquibase $LIQUIBASE_OPTS "$@"
49+
}
50+
51+
52+
if [[ "$#" -ge 1 ]]; then
53+
TASK="$1"
54+
shift
55+
56+
case "$TASK" in
57+
## Custom liquibase command
58+
liquibase)
59+
executeLiquibase "$@"
60+
;;
61+
62+
## Database Update Commands
63+
update|updateCount|updateSQL|updateCountSQL) ;&
64+
## Database Rollback Commands
65+
rollback|rollbackToDate|rollbackCount|rollbackSQL|rollbackToDateSQL|rollbackCountSQL|updateTestingRollback) ;&
66+
## Diff Commands
67+
diff|diffChangeLog) ;&
68+
## Documentation Commands
69+
dbDoc) ;&
70+
## Maintenance Commands
71+
status|validate|changelogSync|changelogSyncSQL|markNextChangeSetRan|listLocks|releaseLocks|dropAll|clearCheckSums)
72+
if [[ "$#" -eq 0 ]]; then
73+
executeLiquibase "$TASK"
74+
else
75+
executeLiquibase "$TASK" "$@"
76+
fi
77+
;;
78+
79+
## show configuration
80+
showConf)
81+
cat /liquibase.properties
82+
;;
83+
84+
## Help
85+
help)
86+
cat <<EOF
87+
Database Update Commands
88+
-------------------------------------------------------------------------------
89+
update Updates database to current version.
90+
updateCount <value> Applies the next <value> change sets.
91+
updateSQL Writes SQL to update database to current
92+
version to STDOUT.
93+
updateCountSQL <value> Writes SQL to apply the next <value>
94+
change sets to STDOUT.
95+
96+
Database Rollback Commands
97+
-------------------------------------------------------------------------------
98+
rollback <tag> Rolls back the database to the state it
99+
was in when the tag was applied.
100+
rollbackToDate <date/time> Rolls back the database to the state it
101+
was in at the given date/time.
102+
rollbackCount <value> Rolls back the last <value> change sets.
103+
rollbackSQL <tag> Writes SQL to roll back the database to
104+
the state it was in when the tag was
105+
applied to STDOUT.
106+
rollbackToDateSQL <date/time> Writes SQL to roll back the database to
107+
the state it was in at the given date/time
108+
version to STDOUT.
109+
rollbackCountSQL <value> Writes SQL to roll back the last <value>
110+
change sets to STDOUT.
111+
futureRollbackSQL Writes SQL to roll back the database to
112+
the current state after the changes in
113+
the changeslog have been applied.
114+
updateTestingRollback Updates the database, then rolls back
115+
changes before updating again.
116+
generateChangeLog generateChangeLog of the database to
117+
standard out. v1.8 requires the dataDir
118+
parameter currently.
119+
120+
Diff Commands
121+
-------------------------------------------------------------------------------
122+
diff [diff parameters] Writes description of differences to
123+
standard out.
124+
diffChangeLog [diff parameters] Writes Change Log XML to update the base
125+
database to the target database to
126+
standard out.
127+
128+
Documentation Commands
129+
-------------------------------------------------------------------------------
130+
dbDoc <outputDirectory> Generates Javadoc-like documentation based
131+
on current database and change log.
132+
133+
Maintenance Commands
134+
-------------------------------------------------------------------------------
135+
tag <tag> "Tags" the current database state for
136+
future rollback.
137+
tagExists <tag> Checks whether the given tag is already
138+
existing.
139+
status Outputs count (list if --verbose) of unrun
140+
change sets.
141+
validate Checks the changelog for errors.
142+
changelogSync Mark all changes as executed in the
143+
database.
144+
changelogSyncSQL Writes SQL to mark all changes as executed
145+
in the database to STDOUT.
146+
markNextChangeSetRan Mark the next change set as executed in
147+
the database.
148+
listLocks Lists who currently has locks on the
149+
database changelog.
150+
releaseLocks Releases all locks on the database
151+
changelog.
152+
dropAll Drops all database objects owned by the
153+
user. Note that functions, procedures
154+
and packages are not dropped
155+
(limitation in 1.8.1).
156+
clearCheckSums Removes current checksums from database.
157+
On next run checksums will be recomputed.
158+
EOF
159+
exit 1
160+
;;
161+
162+
## Default task (eg. sh, bash)
163+
*)
164+
exec "$TASK" "$@"
165+
;;
166+
esac
167+
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#+++++++++++++++++++++++++++++++++++++++
2+
# Dockerfile for webdevops/liquibase:postgres
3+
# -- automatically generated --
4+
#+++++++++++++++++++++++++++++++++++++++
5+
6+
FROM java:latest
7+
8+
9+
LABEL vendor=WebDevOps.io
10+
LABEL io.webdevops.layout=8
11+
LABEL io.webdevops.version=0.57.0
12+
13+
ENV LIQUIBASE_VERSION "3.5.1"
14+
ENV LIQUIBASE_DRIVER "org.postgresql.Driver"
15+
ENV LIQUIBASE_CLASSPATH "/usr/share/java/postgresql.jar"
16+
ENV LIQUIBASE_URL ""
17+
ENV LIQUIBASE_USERNAME ""
18+
ENV LIQUIBASE_PASSWORD ""
19+
ENV LIQUIBASE_CHANGELOG "/liquibase/changelog.xml"
20+
ENV LIQUIBASE_CONTEXTS ""
21+
ENV LIQUIBASE_OPTS ""
22+
23+
COPY conf/ /opt/docker/
24+
25+
RUN apt-get update \
26+
&& apt-get install -yq --no-install-recommends \
27+
libpostgresql-jdbc-java \
28+
&& wget -q -O/tmp/liquibase.tar.gz "https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz" \
29+
&& mkdir -p /opt/liquibase \
30+
&& tar -xzf /tmp/liquibase.tar.gz -C /opt/liquibase \
31+
&& rm -f /tmp/liquibase.tar.gz \
32+
&& chmod +x /opt/liquibase/liquibase \
33+
&& ln -s /opt/liquibase/liquibase /usr/local/bin/ \
34+
&& chmod +x /opt/docker/bin/entrypoint.sh \
35+
&& apt-get clean \
36+
&& rm -r /var/lib/apt/lists/*
37+
38+
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
39+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{ docker.fromOfficial("java") }}
2+
3+
{{ docker.version() }}
4+
5+
{{ environment.liquibase('3.5.1', 'org.postgresql.Driver', '/usr/share/java/postgresql.jar') }}
6+
7+
{{ docker.copy('conf/', '/opt/docker/') }}
8+
9+
{{ liquibase.postgres() }}
10+
11+
{{ docker.entrypoint("/opt/docker/bin/entrypoint.sh") }}
12+

0 commit comments

Comments
 (0)