Skip to content

Commit 8426668

Browse files
authored
Merge pull request #463 from topcoder-platform/develop
v1.3
2 parents 16d596d + 4a8afa4 commit 8426668

28 files changed

+6308
-157
lines changed

.circleci/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ builddeploy_steps: &builddeploy_steps
2929
- run: *install_dependency
3030
- run: *install_deploysuite
3131
#- restore_cache: *restore_cache_settings_for_build
32-
- run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN} ${LOGICAL_ENV}
32+
- run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN} ${LOGICAL_ENV} ${BRANCH}
3333
#- save_cache: *save_cache_settings
3434
- deploy:
3535
name: Running MasterScript.
@@ -43,13 +43,15 @@ builddeploy_steps: &builddeploy_steps
4343
4444
jobs:
4545
# Build & Deploy against development backend
46+
# 'BRANCH' is used for plugins and other dependency repos
4647
"build-dev":
4748
<<: *defaults
4849
environment:
4950
DEPLOY_ENV: "DEV"
5051
LOGICAL_ENV: "dev"
5152
APPNAME: "vanilla-forums"
5253
CI_DEPLOY_TOKEN: $CI_DEPLOY_TOKEN
54+
BRANCH: "develop"
5355
steps: *builddeploy_steps
5456

5557
"build-prod":
@@ -59,6 +61,7 @@ jobs:
5961
LOGICAL_ENV: "prod"
6062
APPNAME: "vanilla-forums"
6163
CI_DEPLOY_TOKEN: $CI_DEPLOY_TOKEN
64+
BRANCH: "master"
6265
steps: *builddeploy_steps
6366

6467
workflows:

Dockerfile

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ FROM webdevops/php-apache
33
ARG CI_DEPLOY_TOKEN
44
ARG VANILLA_VERSION=3.3
55
ARG ENV
6+
ARG BRANCH
67

8+
ENV TIDEWAYS_SERVICE vanilla
79
ENV WEB_DOCUMENT_ROOT /vanillapp
810

911
# Get the latest release of Vanilla Forums
@@ -14,33 +16,42 @@ RUN chmod -R 777 /vanillapp
1416

1517
# Delete the auto-enabled 'stubcontent' plugin which adds stub contents
1618
RUN rm -R /vanillapp/plugins/stubcontent
19+
20+
RUN echo "'$BRANCH' branch will be used for dependency repos ..."
21+
1722
# Clone the forum-plugins repository
18-
RUN git clone https://github.com/topcoder-platform/forums-plugins.git /tmp/forums-plugins
23+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-plugins.git /tmp/forums-plugins
24+
25+
# Copy the Filestack plugin
26+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-filestack-plugin /tmp/forums-plugins/Filestack
27+
28+
# Copy the Groups plugin
29+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-groups-plugin /tmp/forums-plugins/Groups
30+
31+
# Copy the SumoLogic plugin
32+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-sumologic-plugin /tmp/forums-plugins/Sumologic
33+
34+
# Copy the TopcoderEditor plugin
35+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-topcoder-editor-plugin /tmp/forums-plugins/TopcoderEditor
36+
37+
# Copy the forum-theme repository
38+
RUN git clone --branch ${BRANCH} https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-theme.git /vanillapp/themes/topcoder
1939

2040
# Remove DebugPlugin from PROD env
2141
# RUN if [ "$ENV" = "prod" ]; \
2242
# then rm -R /tmp/forums-plugins/DebugPlugin; \
2343
# fi
2444

25-
# Copy the Filestack plugin
26-
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-filestack-plugin /tmp/forums-plugins/Filestack
27-
28-
#Copy the Groups plugin
29-
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-groups-plugin /tmp/forums-plugins/Groups
30-
31-
#Copy the SumoLogic plugin
32-
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-sumologic-plugin /tmp/forums-plugins/Sumologic
33-
34-
#Copy the TopcoderEditor plugin
35-
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-topcoder-editor-plugin /tmp/forums-plugins/TopcoderEditor
3645

3746
# Copy all plugins to the Vanilla plugins folder
3847
RUN cp -r /tmp/forums-plugins/. /vanillapp/plugins
3948

40-
#Get the debug bar plugin
41-
RUN wget https://us.v-cdn.net/5018160/uploads/addons/KSBIPJYMC0F2.zip
42-
RUN unzip KSBIPJYMC0F2.zip
43-
RUN cp -r debugbar /vanillapp/plugins
49+
# Get the debug bar plugin
50+
RUN if [ "$ENV" = "dev" ]; then \
51+
wget https://us.v-cdn.net/5018160/uploads/addons/KSBIPJYMC0F2.zip; \
52+
unzip KSBIPJYMC0F2.zip; \
53+
cp -r debugbar /vanillapp/plugins; \
54+
fi
4455

4556
# Install Topcoder dependencies
4657
RUN composer install --working-dir /vanillapp/plugins/Topcoder
@@ -57,5 +68,17 @@ COPY ./vanilla/. /vanillapp/.
5768
# Set permissions on config file
5869
RUN chown application:application /vanillapp/conf/config.php
5970
RUN chmod ug=rwx,o=rx /vanillapp/conf/config.php
60-
# Clone the forum-theme repository
61-
RUN git clone 'https://github.com/topcoder-platform/forums-theme.git' /vanillapp/themes/topcoder
71+
72+
73+
# Tideways
74+
RUN if [ "$ENV" = "dev" ]; then \
75+
apt-get update && apt-get install -y gnupg2; \
76+
echo 'deb https://packages.tideways.com/apt-packages debian main' > /etc/apt/sources.list.d/tideways.list && \
77+
curl -L -sS 'https://packages.tideways.com/key.gpg' | apt-key add - && \
78+
apt-get update && \
79+
DEBIAN_FRONTEND=noninteractive apt-get -yq install tideways-php && \
80+
apt-get autoremove --assume-yes && \
81+
apt-get clean && \
82+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \
83+
echo 'extension=tideways.so\ntideways.connection=tcp://tideways-daemon:9135\ntideways.enable_cli=0\n' >> opt/docker/etc/php/php.ini; \
84+
fi

build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ set -eo pipefail
33
APP_NAME=$1
44
CI_DEPLOY_TOKEN=$2
55
ENV=$3
6+
BRANCH=$4
67
UPDATE_CACHE=""
78
echo "" > vanilla.env
8-
ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN docker-compose -f docker-compose.yml build $APP_NAME
9+
if [ "$ENV" = "dev" ]; then
10+
ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN BRANCH=$BRANCH docker-compose -f docker-compose.yml -f docker-compose.dev.yml build $APP_NAME
11+
else
12+
ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN BRANCH=$BRANCH docker-compose -f docker-compose.yml build $APP_NAME
13+
fi
914
#docker create --name app $APP_NAME:latest

config/vanilla/bootstrap.before.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ function watchButton($categoryID) {
374374
* @return bool return true if user has a permission
375375
*/
376376
function checkGroupPermission($userID,$groupID, $categoryID = null , $permissionCategoryID = null , $permission = null, $fullMatch = true) {
377-
$groupModel = new GroupModel();
378-
return $groupModel->checkPermission($userID,$groupID, $categoryID,$permissionCategoryID , $permission, $fullMatch);
377+
return GroupModel::checkPermission($userID,$groupID, $categoryID,$permissionCategoryID , $permission, $fullMatch);
379378
}
380379
}
381380

config/vanilla/bootstrap.early.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,19 @@
137137
Gdn::sql()->query($emptyAncestorQuery);
138138
}
139139

140+
// FIX: https://github.com/topcoder-platform/forums/issues/449
141+
if(!Gdn::structure()->tableExists('GroupInvitation')) {
142+
// Group Invitation Table
143+
Gdn::structure()->table('GroupInvitation')
144+
->primaryKey('GroupInvitationID')
145+
->column('GroupID', 'int', false, 'index')
146+
->column('Token', 'varchar(32)', false, 'unique')
147+
->column('InvitedByUserID', 'int', false, 'index')
148+
->column('InviteeUserID', 'int', false, 'index')
149+
->column('DateInserted', 'datetime', false, 'index')
150+
->column('Status', ['pending', 'accepted', 'declined', 'deleted'])
151+
->column('DateAccepted', 'datetime', true)
152+
->column('DateExpires', 'datetime')
153+
->set(false, false);
154+
}
140155
}

config/vanilla/config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@
113113
$Configuration['Plugins']['Sumologic']['HttpSourceURL'] = '';
114114
$Configuration['Plugins']['Sumologic']['BatchSize'] = 10;
115115

116+
// e.g. '+15 min', '+1 day'
117+
$Configuration['Plugins']['Groups']['InviteExpiration']= '+20 min';
116118

117119
// RichEditor
118120
$Configuration['RichEditor']['Quote']['Enable'] = true;

docker-compose.dev.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
version: '3'
22
services:
3-
mysql-local:
4-
image: mysql
5-
container_name: mysql-local
6-
ports:
7-
- 3306:3306
8-
env_file:
9-
- ./mysql.env
10-
security_opt:
11-
- seccomp:unconfined
12-
command: --default-authentication-plugin=mysql_native_password
133
vanilla-forums:
144
links:
15-
- mysql-local
16-
- memcached-local
17-
memcached-local:
18-
image: memcached:1.5
19-
container_name: memcached-local
5+
- tideways-daemon
6+
tideways-daemon:
7+
container_name: tideways-daemon
8+
build:
9+
context: ./tideways-daemon
2010
ports:
21-
- "11211:11211"
11+
- 9135:9135

docker-compose.local.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3'
2+
services:
3+
mysql-local:
4+
image: mysql
5+
container_name: mysql-local
6+
ports:
7+
- 3306:3306
8+
env_file:
9+
- ./mysql.env
10+
security_opt:
11+
- seccomp:unconfined
12+
command: --default-authentication-plugin=mysql_native_password
13+
vanilla-forums:
14+
links:
15+
- mysql-local
16+
- memcached-local
17+
memcached-local:
18+
image: memcached:1.5
19+
container_name: memcached-local
20+
ports:
21+
- "11211:11211"

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ services:
1111
- ENV
1212
- VANILLA_VERSION=3.3
1313
- CI_DEPLOY_TOKEN
14+
- BRANCH
1415
ports:
1516
- 80:80

tideways-daemon/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM debian:stable-slim
2+
3+
ARG TIDEWAYS_ENVIRONMENT_DEFAULT=production
4+
ENV TIDEWAYS_ENVIRONMENT=$TIDEWAYS_ENVIRONMENT_DEFAULT
5+
6+
RUN useradd --system tideways
7+
RUN apt-get update && apt-get install -yq --no-install-recommends gnupg2 curl sudo ca-certificates
8+
9+
RUN echo 'deb https://packages.tideways.com/apt-packages debian main' > /etc/apt/sources.list.d/tideways.list && \
10+
curl -L -sS 'https://packages.tideways.com/key.gpg' | apt-key add -
11+
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -yq tideways-daemon && \
12+
apt-get autoremove --assume-yes && \
13+
apt-get clean && \
14+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
15+
16+
EXPOSE 9135
17+
18+
USER tideways
19+
20+
ENTRYPOINT ["tideways-daemon","--hostname=tideways-daemon","--address=0.0.0.0:9135"]

0 commit comments

Comments
 (0)