Skip to content

Commit ccfe201

Browse files
committed
# This is a combination of 12 commits.
# This is the 1st commit message: ADD: add clone feature for edly wp repos # The commit message #2 will be skipped: # ADD: add wordpress clone support # The commit message #3 will be skipped: # WIP: add WP container # The commit message #4 will be skipped: # ADD: add config for wordpress plugins, themes and env # The commit message #5 will be skipped: # MOD: refine the config for WP container # The commit message #6 will be skipped: # ADD: add custom build script for edly/wp docker image # The commit message #7 will be skipped: # FIX: remove unnecessary keys # The commit message #8 will be skipped: # FIX: add correct settings in wp-config.php # The commit message #9 will be skipped: # MOD: add custom config for WP image # The commit message #10 will be skipped: # FIX: use proper docker image # The commit message #11 will be skipped: # ADD: add must install wp plugins # The commit message #12 will be skipped: # FIX: fix version of wordpress docker image
1 parent 9c1f879 commit ccfe201

File tree

7 files changed

+289
-32
lines changed

7 files changed

+289
-32
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Open edX Devstack |Build Status|
2-
================================
1+
Edly's Open edX Devstack
2+
========================
33

4-
Get up and running quickly with Open edX services.
4+
Get up and running quickly with Edly's Open edX services.
55

66
If you are seeking info on the Vagrant-based devstack, please see
77
https://openedx.atlassian.net/wiki/spaces/OpenOPS/pages/60227787/Running+Vagrant-based+Devstack. This

docker-compose-host.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
- credentials_node_modules:/edx/app/credentials/credentials/node_modules
88
- ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
99
discovery:
10-
volumes:
10+
volumes:
1111
- ${DEVSTACK_WORKSPACE}/course-discovery:/edx/app/discovery/discovery:cached
1212
- discovery_node_modules:/edx/app/discovery/discovery/node_modules
1313
- ${DEVSTACK_WORKSPACE}/src:/edx/src:cached
@@ -37,7 +37,7 @@ services:
3737
volumes:
3838
- ${DEVSTACK_WORKSPACE}/gradebook:/edx/app/gradebook:cached
3939
- gradebook_node_modules:/edx/app/gradebook/node_modules
40-
40+
4141
volumes:
4242
credentials_node_modules:
4343
discovery_node_modules:

docker-compose.yml

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# - Every service's container name should be prefixed with "edx.devstack." to avoid conflicts with other containers
99
# that might be running for the same service.
1010

11-
version: "2.1"
11+
version: '2.1'
1212

1313
services:
1414
# Third-party services
@@ -18,8 +18,8 @@ services:
1818
image: edxops/chrome:${OPENEDX_RELEASE:-latest}
1919
shm_size: 2g
2020
ports:
21-
- "15900:5900"
22-
volumes: # for file uploads
21+
- '15900:5900'
22+
volumes: # for file uploads
2323
- ../edx-e2e-tests/upload_files:/edx/app/e2e/edx-e2e-tests/upload_files
2424
- ../edx-platform/common/test/data:/edx/app/edxapp/edx-platform/common/test/data
2525

@@ -41,8 +41,8 @@ services:
4141
image: edxops/firefox:${OPENEDX_RELEASE:-latest}
4242
shm_size: 2g
4343
ports:
44-
- "25900:5900"
45-
volumes: # for file uploads
44+
- '25900:5900'
45+
volumes: # for file uploads
4646
- ../edx-e2e-tests/upload_files:/edx/app/e2e/edx-e2e-tests/upload_files
4747
- ../edx-platform/common/test/data:/edx/app/edxapp/edx-platform/common/test/data
4848

@@ -71,8 +71,8 @@ services:
7171
container_name: edx.devstack.mysql
7272
hostname: mysql.devstack.edx
7373
environment:
74-
MYSQL_ROOT_PASSWORD: ""
75-
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
74+
MYSQL_ROOT_PASSWORD: ''
75+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
7676
image: mysql:5.6
7777
# ports:
7878
# - "3306:3306"
@@ -97,7 +97,7 @@ services:
9797
ENABLE_DJANGO_TOOLBAR: 1
9898
image: edxops/credentials:${OPENEDX_RELEASE:-latest}
9999
ports:
100-
- "18150:18150"
100+
- '18150:18150'
101101

102102
discovery:
103103
command: bash -c 'source /edx/app/discovery/discovery_env && while true; do python /edx/app/discovery/discovery/manage.py runserver 0.0.0.0:18381; sleep 2; done'
@@ -111,11 +111,11 @@ services:
111111
stdin_open: true
112112
tty: true
113113
environment:
114-
TEST_ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"
114+
TEST_ELASTICSEARCH_URL: 'http://edx.devstack.elasticsearch:9200'
115115
ENABLE_DJANGO_TOOLBAR: 1
116116
image: edxops/discovery:${OPENEDX_RELEASE:-latest}
117117
ports:
118-
- "18381:18381"
118+
- '18381:18381'
119119
volumes:
120120
- discovery_assets:/edx/var/discovery/
121121

@@ -133,7 +133,7 @@ services:
133133
ENABLE_DJANGO_TOOLBAR: 1
134134
image: edxops/ecommerce:${OPENEDX_RELEASE:-latest}
135135
ports:
136-
- "18130:18130"
136+
- '18130:18130'
137137

138138
lms:
139139
command: bash -c 'source /edx/app/edxapp/edxapp_env && while true; do python /edx/app/edxapp/edx-platform/manage.py lms runserver 0.0.0.0:18000 --settings devstack_docker; sleep 2; done'
@@ -155,8 +155,8 @@ services:
155155
NO_PYTHON_UNINSTALL: 1
156156
image: edxops/edxapp:${OPENEDX_RELEASE:-latest}
157157
ports:
158-
- "18000:18000"
159-
- "19876:19876" # JS test debugging
158+
- '18000:18000'
159+
- '19876:19876' # JS test debugging
160160
# - "18003:18003"
161161
# - "18031:18031"
162162
volumes:
@@ -172,16 +172,16 @@ services:
172172
- mysql
173173
image: edxops/notes:${OPENEDX_RELEASE:-latest}
174174
ports:
175-
- "18120:18120"
175+
- '18120:18120'
176176
environment:
177-
DB_ENGINE: "django.db.backends.mysql"
178-
DB_HOST: "edx.devstack.mysql"
179-
DB_NAME: "notes"
180-
DB_PASSWORD: "password"
181-
DB_PORT: "3306"
182-
DB_USER: "notes001"
177+
DB_ENGINE: 'django.db.backends.mysql'
178+
DB_HOST: 'edx.devstack.mysql'
179+
DB_NAME: 'notes'
180+
DB_PASSWORD: 'password'
181+
DB_PORT: '3306'
182+
DB_USER: 'notes001'
183183
ENABLE_DJANGO_TOOLBAR: 1
184-
ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"
184+
ELASTICSEARCH_URL: 'http://edx.devstack.elasticsearch:9200'
185185

186186
studio:
187187
command: bash -c 'source /edx/app/edxapp/edxapp_env && while true; do python /edx/app/edxapp/edx-platform/manage.py cms runserver 0.0.0.0:18010 --settings devstack_docker; sleep 2; done'
@@ -203,8 +203,8 @@ services:
203203
NO_PYTHON_UNINSTALL: 1
204204
image: edxops/edxapp:${OPENEDX_RELEASE:-latest}
205205
ports:
206-
- "18010:18010"
207-
- "19877:19877" # JS test debugging
206+
- '18010:18010'
207+
- '19877:19877' # JS test debugging
208208
# - "18103:18103"
209209
# - "18131:18131"
210210
volumes:
@@ -220,14 +220,14 @@ services:
220220
- elasticsearch
221221
image: edxops/forum:${OPENEDX_RELEASE:-latest}
222222
ports:
223-
- "44567:4567"
223+
- '44567:4567'
224224

225225
devpi:
226226
container_name: edx.devstack.devpi
227227
hostname: devpi.devstack.edx
228228
image: edxops/devpi:${OPENEDX_RELEASE:-latest}
229229
ports:
230-
- "3141:3141"
230+
- '3141:3141'
231231
volumes:
232232
- devpi_data:/data
233233

@@ -237,10 +237,22 @@ services:
237237
container_name: edx.devstack.gradebook
238238
image: node:10
239239
ports:
240-
- "1994:1994"
240+
- '1994:1994'
241241
environment:
242242
- NODE_ENV=development
243-
243+
244+
wordpress:
245+
depends_on:
246+
- mysql
247+
image: asamolion/edly-wp:latest
248+
hostname: wp.devstack.edx
249+
container_name: edx.devstack.wp
250+
ports:
251+
- '8888:80'
252+
volumes:
253+
- ${DEVSTACK_WORKSPACE}/wp_plugins/edly-wp-plugin:/var/www/html/wp-content/plugins/edly-wp-plugin
254+
- ${DEVSTACK_WORKSPACE}/wp_themes/edly-wp-theme:/var/www/html/wp-content/themes/edly-wp-theme
255+
244256
volumes:
245257
discovery_assets:
246258
edxapp_lms_assets:

provision.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ GRANT ALL ON notes.* TO 'notes001'@'%' IDENTIFIED BY 'password';
1616
CREATE DATABASE IF NOT EXISTS registrar;
1717
GRANT ALL ON registrar.* TO 'registrar001'@'%' IDENTIFIED BY 'password';
1818

19+
20+
CREATE DATABASE IF NOT EXISTS wordpress;
21+
GRANT ALL ON wordpress.* TO 'wordpress001'@'%' IDENTIFIED BY 'password';
22+
1923
CREATE DATABASE IF NOT EXISTS edxapp;
2024
CREATE DATABASE IF NOT EXISTS edxapp_csmh;
2125
GRANT ALL ON edxapp.* TO 'edxapp001'@'%' IDENTIFIED BY 'password';

repo.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ private_repos=(
4141
"https://github.com/edx/edx-themes.git"
4242
)
4343

44+
wp_plugin_repos=(
45+
"[email protected]:edly-io/edly-wp-plugin.git"
46+
)
47+
48+
wp_theme_repos=(
49+
"[email protected]:edly-io/edly-wp-theme.git"
50+
)
51+
4452
name_pattern=".*/(.*).git"
53+
eldy_repo_pattern=".*edly-io/(.*).git"
54+
4555

4656
_checkout ()
4757
{
@@ -115,9 +125,51 @@ _checkout_and_update_branch ()
115125
find . -name '*.pyc' -not -path './.git/*' -delete
116126
}
117127

128+
129+
_get_latest_wp_tag() {
130+
curl --silent "https://api.github.com/repos/WordPress/WordPress/tags" | # Get latest release from GitHub>
131+
python -c "import sys, json; print json.load(sys.stdin)[0]['name']"
132+
}
133+
118134
clone ()
119135
{
120136
_clone "${repos[@]}"
137+
138+
WP_PLUGIN_DIR=$DEVSTACK_WORKSPACE/wp_plugins
139+
WP_THEME_DIR=$DEVSTACK_WORKSPACE/wp_themes
140+
141+
[ -d $WP_PLUGIN_DIR ] || mkdir $WP_PLUGIN_DIR
142+
[ -d $WP_THEME_DIR ] || mkdir $WP_THEME_DIR
143+
144+
# clone WP plugins
145+
cd $WP_PLUGIN_DIR
146+
for repo in "${wp_plugin_repos[@]}"
147+
do
148+
[[ $repo =~ $eldy_repo_pattern ]]
149+
name="${BASH_REMATCH[1]}"
150+
151+
if [ ! -d $name ]; then
152+
git clone $repo --branch develop
153+
else
154+
printf "The [%s] repo is already checked out. \n" $repo
155+
fi
156+
done
157+
158+
# clone themes
159+
cd $WP_THEME_DIR
160+
for repo in "${wp_theme_repos[@]}"
161+
do
162+
[[ $repo =~ $eldy_repo_pattern ]]
163+
name="${BASH_REMATCH[1]}"
164+
165+
if [ ! -d $name ]; then
166+
git clone $repo --branch develop
167+
else
168+
printf "The [%s] repo is already checked out. \n" $repo
169+
fi
170+
done
171+
172+
cd $DEVSTACK_WORKSPACE/devstack &> /dev/null
121173
}
122174

123175
clone_private ()

wordpress/Dockerfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
FROM php:7.2-apache
2+
3+
# install the PHP extensions we need
4+
RUN set -ex; \
5+
\
6+
savedAptMark="$(apt-mark showmanual)"; \
7+
\
8+
apt-get update; \
9+
apt-get install -y \
10+
unzip \
11+
libjpeg-dev \
12+
libpng-dev \
13+
; \
14+
\
15+
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
16+
docker-php-ext-install gd mysqli opcache zip; \
17+
\
18+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
19+
apt-mark auto '.*' > /dev/null; \
20+
apt-mark manual $savedAptMark; \
21+
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
22+
| awk '/=>/ { print $3 }' \
23+
| sort -u \
24+
| xargs -r dpkg-query -S \
25+
| cut -d: -f1 \
26+
| sort -u \
27+
| xargs -rt apt-mark manual;
28+
29+
# set recommended PHP.ini settings
30+
# see https://secure.php.net/manual/en/opcache.installation.php
31+
RUN { \
32+
echo 'opcache.memory_consumption=128'; \
33+
echo 'opcache.interned_strings_buffer=8'; \
34+
echo 'opcache.max_accelerated_files=4000'; \
35+
echo 'opcache.revalidate_freq=2'; \
36+
echo 'opcache.fast_shutdown=1'; \
37+
echo 'opcache.enable_cli=1'; \
38+
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
39+
# https://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Logging
40+
RUN { \
41+
echo 'error_reporting = 4339'; \
42+
echo 'display_errors = Off'; \
43+
echo 'display_startup_errors = Off'; \
44+
echo 'log_errors = On'; \
45+
echo 'error_log = /dev/stderr'; \
46+
echo 'log_errors_max_len = 1024'; \
47+
echo 'ignore_repeated_errors = On'; \
48+
echo 'ignore_repeated_source = Off'; \
49+
echo 'html_errors = Off'; \
50+
} > /usr/local/etc/php/conf.d/error-logging.ini
51+
52+
RUN a2enmod rewrite expires
53+
54+
ARG WORDPRESS_DIR=/var/www/html
55+
ENV WORDPRESS_VERSION 5.1.1
56+
ENV WORDPRESS_SHA1 f1bff89cc360bf5ef7086594e8a9b68b4cbf2192
57+
58+
RUN set -ex; \
59+
curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \
60+
echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \
61+
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
62+
tar -xzf wordpress.tar.gz -C /usr/src/; \
63+
rm wordpress.tar.gz; \
64+
chown -R www-data:www-data /usr/src/wordpress
65+
66+
67+
RUN cp -R /usr/src/wordpress/. $WORDPRESS_DIR
68+
69+
ADD --chown=www-data:www-data "https://downloads.wordpress.org/plugin/edunext-openedx-integrator.1.9.0.zip" $WORDPRESS_DIR/wp-content/plugins/
70+
ADD --chown=www-data:www-data "https://downloads.wordpress.org/plugin/advanced-custom-fields.5.7.12.zip" $WORDPRESS_DIR/wp-content/plugins/
71+
ADD --chown=www-data:www-data "https://downloads.wordpress.org/plugin/elementor.2.5.14.zip" $WORDPRESS_DIR/wp-content/plugins/
72+
ADD --chown=www-data:www-data "https://downloads.wordpress.org/plugin/classic-editor.1.4.zip" $WORDPRESS_DIR/wp-content/plugins/
73+
74+
RUN unzip -d $WORDPRESS_DIR/wp-content/plugins/ '/var/www/html/wp-content/plugins/*.zip'; \
75+
rm $WORDPRESS_DIR/wp-content/plugins/*.zip; \
76+
ls $WORDPRESS_DIR/wp-content/plugins/
77+
78+
RUN rm -rf $WORDPRESS_DIR/wp-content/plugins/akismet; \
79+
rm $WORDPRESS_DIR/wp-content/plugins/hello.php
80+
81+
RUN chown -R www-data:www-data $WORDPRESS_DIR
82+
83+
COPY ./wp-config.php $WORDPRESS_DIR/
84+
85+
VOLUME $WORDPRESS_DIR
86+
87+
88+
CMD ["apache2-foreground"]

0 commit comments

Comments
 (0)