Dev Environment Recommendations

Hello,

I’ve been looking at modifying the theme. Is there a recommended dev environment setup document or is everyone just using like a local lamp/wamp install? Also, is there an additional element cheat sheet anyone can share?

It’s been a few years. I imagine there’s gotta be something better than constantly F5’ing a browser to see updates right?

I don’t think we have much to share on dev environment per se: the Omeka team itself uses a mixture of local Linux desktops/laptops, physical and cloud servers, as well as some Macs.

There’s no special tooling in Omeka S for making changes to the PHP views for themes that try to modify the “F5” approach you mentioned. On the CSS side since Omeka S generally uses Sass, there’s supplied tooling for building compiled CSS from Sass, and also for watching for changes to the Sass source files and auto-rebuilding on changes.

In general I myself rely more on tooling provided by the browsers to make live updates and edits to markup, styling, and scripting, though “F5” still does have its place at times.

I have had good luck using Docker to create a virtual machine (oracle virtualbox) on my PC. There are some useful Omeka-S docker file templates you can find on GitHub. It takes a little while to wrap your head around docker, but the payoff is that you get a way to spin up fresh variations on your development environment very quickly. I use a very similar dockerfile to set up my production server in a cloud provider.

With VirtualBox you can attach a folder on the host PC as shared volume that can hold your Themes, Modules and Config folders so that you can manage using your familiar windows file management and editing tools (I use VS Code with the SCSS auto-compile module.) So that changes you make to styles and over-ridden php resources are immediately reflected on your dev machine. When these are tested, it is easy to move these to a similarly accessible volume in your production server.

Sorry that I have not posted my Docker set-up on Git yet. I do plan top do this when I get a chance. For what its worth, I copied my docker file and focker-compose.yml below. In any case, I hope this helps.

–Paul Cote

Dockerfile:
/////////////////////////////////////////////////////////////////////

#Omeka-S web publishing platform for digital heritage collections (https://omeka.org/s/)

FROM php:7.2-apache
MAINTAINER Paul Cote paulbcote@gmail.com
RUN a2enmod rewrite
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends apt-utils
unzip
libfreetype6-dev
libjpeg62-turbo-dev
libmcrypt-dev
libpng-dev
libzip-dev
libjpeg-dev
libmemcached-dev
zlib1g-dev
ghostscript
imagemagick
libmagickwand-dev
libgs-dev
vim
cgi-mapserver
gdal-bin
proj-bin

###for mapserver
RUN a2enmod cgi
RUN export MS_ERRORFILE="/var/www/html/chc_omeka_files/mapserver/tmp/mapserver.log"

###Install the PHP extensions we need
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-install -j$(nproc) iconv pdo pdo_mysql mysqli gd xml zip
RUN pecl install mcrypt-1.0.2 && docker-php-ext-enable mcrypt && pecl install imagick && docker-php-ext-enable imagick
COPY ./imagemagick-policy.xml /etc/ImageMagick/policy.xml

##Add the Omeka-S PHP code
RUN mkdir -p /var/www/html/omeka-s/
COPY ./omeka-s-2.1.0.zip /var/www/html
RUN unzip -q /var/www/html/omeka-s-2.1.0.zip -d /var/www/html
RUN cd /var/www/html/omeka-s && chgrp www-data files && chmod g+w files
COPY ./database.ini /var/www/html/omeka-s/config/

Below we create symlinks for all of the installation-specific Omeks-S resources

that we need to persist when the Omeka container is re-spawned.

##Dummy directories are created here to be the targets of the symlinks. THese are
##clobbered by the persistent data from the chcomekafiles volume is that is mounted
##to this container according to the Azure container’s application settings.

RUN rm -r /var/www/html/omeka-s/config \
&& ln -sfv /var/www/html/chc_omeka_files/config/ /var/www/html/omeka-s/config \
&& rm -r /var/www/html/omeka-s/files \
&& ln -sfv /var/www/html/chc_omeka_files/files /var/www/html/omeka-s/files \
&& rm -r /var/www/html/omeka-s/themes \
&& ln -sfv /var/www/html/chc_omeka_files/themes /var/www/html/omeka-s/themes \
&& rm -r /var/www/html/omeka-s/modules \
&& ln -sfv /var/www/html/chc_omeka_files/modules /var/www/html/omeka-s/modules 

RUN ln -s /var/www/html/chc_omeka_files/themes/cdash_images/cdash_ico.ico /var/www/html/favicon.ico

CMD [“apache2-foreground”]

/////////////////////////////////////////////////////////////////
##docker-compose.yml
//////////////////////////////////
version: “3.2”
services:

mariadb:
image: mariadb:10.3.21
restart: always
networks:
- network1
volumes:
- mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: blabla
MYSQL_DATABASE: omeka
MYSQL_USER: omeka
MYSQL_PASSWORD: omeka
explicit_defaults_for_timestamp: 1

adminer:
image: adminer
restart: always
networks:
- network1
ports:
- 8080:8080
environment:
ADMINER_DEFAULT_DB_DRIVER: mysql
ADMINER_DEFAULT_DB_HOST: mariadb

omeka:
depends_on:
- mariadb
image: pbcote/omeka-s_dev:v2.4
restart: always
networks:
- network1
ports:
- “80:80”
links:
- mariadb:db
volumes:
- type: bind
### The root of this path is specifies in my virtual box settings for the vm that is used as my docker container host/.
source: /current_work/projects/cambridge/chc_omeka/cdash_dev/chc_omeka_files
target: /var/www/html/chc_omeka_files
volumes:
mysql-data:
networks:
network1:

///////////////////////////////////////////////////////

Hi Thanks for your via detailed answers and confirming just what I had sort of expected but wasn’t confident in.

I’m familiar with docker, hypervisors, and virtual box. I also found out from another developer that they use visual studio code to edit with dynamic updating directly to a server which is kind of neat too.

Thanks for sharing your thoughts.