Skip to content

Commit cd05696

Browse files
committed
Merge pull request #890 from ohmage/ohmage-2.18
ohmage 2.18 release
2 parents 4a0d739 + cc7e56d commit cd05696

85 files changed

Lines changed: 7113 additions & 734 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git/objects/pack

Dockerfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
FROM debian:jessie
2+
MAINTAINER Steve Nolen <technolengy@gmail.com>
3+
# Report issues here: https://github.com/ohmage/server
4+
5+
RUN set -x \
6+
&& export DEBIAN_FRONTEND=noninteractive \
7+
&& apt-get update \
8+
&& apt-get install -y openjdk-7-jdk ant curl libtcnative-1 netcat git mysql-client\
9+
&& apt-get clean \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# download tomcat
13+
ENV CATALINA_HOME /usr/local/tomcat
14+
ENV PATH $CATALINA_HOME/bin:$PATH
15+
RUN mkdir -p "$CATALINA_HOME"
16+
WORKDIR $CATALINA_HOME
17+
18+
# see https://www.apache.org/dist/tomcat/tomcat-8/KEYS
19+
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys \
20+
05AB33110949707C93A279E3D3EFE6B686867BA6 \
21+
07E48665A34DCAFAE522E5E6266191C37C037D42 \
22+
47309207D818FFD8DCD3F83F1931D684307A10A5 \
23+
541FBE7D8F78B25E055DDEE13C370389288584E7 \
24+
61B832AC2F1C5A90F0F9B00A1C506407564C17A3 \
25+
713DA88BE50911535FE716F5208B0AB1D63011C7 \
26+
79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED \
27+
9BA44C2621385CB966EBA586F72C284D731FABEE \
28+
A27677289986DB50844682F8ACB77FC2E86E29AC \
29+
A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 \
30+
DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 \
31+
F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE \
32+
F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23
33+
34+
ENV TOMCAT_MAJOR 7
35+
ENV TOMCAT_VERSION 7.0.67
36+
ENV TOMCAT_TGZ_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
37+
38+
RUN set -x \
39+
&& curl -fSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
40+
&& curl -fSL "$TOMCAT_TGZ_URL.asc" -o tomcat.tar.gz.asc \
41+
&& gpg --verify tomcat.tar.gz.asc \
42+
&& tar -xvf tomcat.tar.gz --strip-components=1 \
43+
&& rm bin/*.bat \
44+
&& rm tomcat.tar.gz* \
45+
&& rm -rf /usr/local/tomcat/webapps/ROOT \
46+
&& rm -rf /usr/local/tomcat/webapps/docs \
47+
&& rm -rf /usr/local/tomcat/webapps/examples \
48+
&& rm -rf /usr/local/tomcat/webapps/manager \
49+
&& rm -rf /usr/local/tomcat/webapps/host-manager
50+
51+
#### download flyway (ohmage doesn't do migrations) ####
52+
WORKDIR /flyway
53+
ENV FLYWAY_TGZ_URL http://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/3.2.1/flyway-commandline-3.2.1.tar.gz
54+
RUN set -x \
55+
&& curl -fSL "$FLYWAY_TGZ_URL" -o flyway.tar.gz \
56+
&& tar -xvf flyway.tar.gz --strip-components=1 \
57+
&& rm flyway.tar.gz
58+
59+
WORKDIR /app
60+
ADD . /app
61+
RUN cp db/migration/* /flyway/sql/ \
62+
&& ant clean dist \
63+
&& cp dist/webapp-ohmage* "$CATALINA_HOME"/webapps/app.war \
64+
&& cp docker_entrypoint.sh /run.sh \
65+
&& chmod +x /run.sh \
66+
&& rm -rf /app
67+
68+
RUN mkdir -p /var/lib/ohmage && ln -s /var/lib/ohmage /ohmage
69+
RUN useradd -ms /bin/bash ohmage && \
70+
chown -R ohmage.ohmage "$CATALINA_HOME" && \
71+
chown -R ohmage.ohmage /var/lib/ohmage
72+
73+
EXPOSE 8080
74+
75+
VOLUME /ohmage
76+
77+
CMD ["/run.sh"]

Dockerfile.wildfly

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM jboss/wildfly
2+
MAINTAINER Steve Nolen <technolengy@gmail.com>
3+
# Report issues here: https://github.com/ohmage/server
4+
5+
USER root
6+
7+
RUN yum install -y ant ant-junit curl nc git mysql
8+
9+
#### download flyway (ohmage doesn't do migrations) ####
10+
WORKDIR /flyway
11+
ENV FLYWAY_TGZ_URL http://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/3.2.1/flyway-commandline-3.2.1.tar.gz
12+
RUN set -x \
13+
&& curl -fSL "$FLYWAY_TGZ_URL" -o flyway.tar.gz \
14+
&& tar -xvf flyway.tar.gz --strip-components=1 \
15+
&& rm flyway.tar.gz
16+
17+
WORKDIR /app
18+
ADD . /app
19+
RUN cp db/migration/* /flyway/sql/ \
20+
&& ant clean dist \
21+
&& cp dist/webapp-ohmage* /opt/jboss/wildfly/standalone/deployments/app.war \
22+
&& cp docker_entrypoint.sh /run.sh \
23+
# modify run.sh to run wildfly instead of tomcat!
24+
&& sed -i 's|^exec.*$|exec /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0|g' /run.sh \
25+
&& chmod +x /run.sh \
26+
&& rm -rf /app
27+
28+
RUN mkdir -p /var/lib/ohmage && ln -s /var/lib/ohmage /ohmage
29+
RUN useradd -ms /bin/bash ohmage && \
30+
chown -R ohmage.ohmage /opt/jboss/wildfly/ && \
31+
chown -R ohmage.ohmage /var/lib/ohmage
32+
33+
EXPOSE 8080
34+
35+
VOLUME /ohmage
36+
37+
CMD ["/run.sh"]

build.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<property file="build.properties"/>
44
<property name="library" location="lib"/>
55
<property name="app_name" value="ohmage"/>
6-
<property name="app_version" value="2.17.3"/>
6+
<property name="app_version" value="2.18.0"/>
77
<property name="src" location="src"/>
88
<property name="test" location="test"/>
99
<property name="view" location="view"/>
@@ -41,6 +41,7 @@
4141
<include name="js.jar"/>
4242
<include name="catalina-2012-09-10.jar"/>
4343
<include name="RunKeeperOmhLayer.jar"/>
44+
<include name="jose4j-0.4.4.jar"/>
4445
</fileset>
4546

4647
<fileset id="run-dependencies" dir="${library}">
@@ -76,6 +77,8 @@
7677
<include name="slf4j-log4j12-1.7.5.jar"/>
7778
<include name="tomcat-dbcp-7.0.42.jar" />
7879
<include name="tomcat-jdbc-7.0.42.jar" />
80+
<include name="tomcat-juli.jar" />
81+
<include name="jose4j-0.4.4.jar"/>
7982
</fileset>
8083

8184
<path id="compile-classpath">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Adds a bit column in campaign table to determine if campaign is editable or not.
2+
-- defaults to false since the "participatory sensing"-ness of it is a bit lacking.
3+
ALTER TABLE campaign
4+
ADD COLUMN `editable` bit NOT NULL DEFAULT FALSE;

db/migration/V5__2.17_cleanup_user_role_campaign.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ WHERE id IN (
3838
GROUP BY u.id, cp.id, ur.id
3939
HAVING count(cc.class_id) - SUM(IF(uc.class_id IS NULL, 1, 0)) = 0
4040
) t1
41-
)
41+
);
4242

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- ----------------------------------------------------------------------
2+
-- The table to store the user access request
3+
-------------------------------------------------------------------------
4+
-- use status:varchar for simplicity. possible values: pending/approved/rejected
5+
CREATE TABLE IF NOT EXISTS access_request (
6+
id int unsigned NOT NULL auto_increment,
7+
uuid CHAR(36) NOT NULL UNIQUE,
8+
user_id int unsigned NOT NULL,
9+
email_address varchar(320) NOT NULL,
10+
type varchar(25) NOT NULL,
11+
status varchar(25) NOT NULL,
12+
content mediumtext NOT NULL,
13+
creation_timestamp datetime NOT NULL,
14+
last_modified_timestamp timestamp DEFAULT now() ON UPDATE now(),
15+
PRIMARY KEY (id),
16+
UNIQUE (uuid),
17+
INDEX (uuid),
18+
INDEX (user_id),
19+
CONSTRAINT FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE
20+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21+
22+
INSERT INTO preference (p_key, p_value) VALUES
23+
('mail_admin_address', 'root@localhost'),
24+
('mail_access_request_notify_admin', 'false'),
25+
('mail_access_request_sender_address', 'no-reply@ohmage.org'),
26+
('mail_access_request_subject', 'ohmage: Access Request Status')
27+
ON DUPLICATE KEY UPDATE p_value=VALUES(p_value);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- ----------------------------------------------------------------------
2+
-- Inserts a default preference key so as not to be statefully reliant on
3+
-- the compiled war file.
4+
-------------------------------------------------------------------------
5+
6+
INSERT INTO preference (p_key, p_value) VALUES
7+
('application_name', 'ohmage')
8+
ON DUPLICATE KEY UPDATE p_value=VALUES(p_value);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Inserts a default preference key to determine keycloak enabledness
2+
INSERT INTO preference (p_key, p_value) VALUES
3+
('keycloak_auth_enabled', 'false')
4+
ON DUPLICATE KEY UPDATE p_value=VALUES(p_value);
5+
6+
-- Inserts a default preference key to determine local auth enabledness
7+
INSERT INTO preference (p_key, p_value) VALUES
8+
('local_auth_enabled', 'true')
9+
ON DUPLICATE KEY UPDATE p_value=VALUES(p_value);
10+
11+
-- Adds a bit column in user table to determine if user is local or external
12+
ALTER TABLE user
13+
ADD COLUMN `external` bit NOT NULL DEFAULT FALSE;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- get public class id
2+
SET @public_class_id =
3+
(SELECT id
4+
FROM class
5+
WHERE urn IN
6+
(SELECT p_value
7+
FROM preference
8+
WHERE p_key="public_class_id"));
9+
10+
-- perhaps the analyst role isn't id=3 ?
11+
SET @analyst_role_id =
12+
(SELECT id
13+
FROM user_role
14+
WHERE role = "analyst");
15+
16+
-- add users who are currently *only* "participants" in public campaigns
17+
-- as "analysts" as well. so they can see shared data.
18+
INSERT INTO user_role_campaign (user_id, campaign_id, user_role_id)
19+
SELECT user_id,
20+
campaign_id,
21+
@analyst_role_id
22+
FROM user_role_campaign
23+
WHERE campaign_id IN
24+
(SELECT campaign.id
25+
FROM campaign
26+
JOIN campaign_class ON campaign.id = campaign_class.campaign_id
27+
WHERE campaign_class.class_id = @public_class_id)
28+
GROUP BY user_id,
29+
campaign_id
30+
HAVING sum(user_role_id) = 1;

0 commit comments

Comments
 (0)