Skip to content

Commit

Permalink
Dev docker compose setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtarcommunications committed Nov 16, 2023
1 parent dbf7105 commit 7f89f3e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,37 @@ does not include the Tabroom code itself, just the packages required to run it.
That way a new code checkin to Tabroom's own code (which happens frequently)
does not kick off a (slow, expensive) build of the Docker image each time.

Specific configuration files that change depending on the run location,
General.pm configuration file and Apache configuration files, are not included
General.pm configuration file and production Apache configuration files are not included
in this image and instead run from ansible for production.

PREREQUISITES TO RUN A STAGING INSTANCE:

1. A copy of the Tabroom.com web code downloaded to /www/tabroom (or another
location as long as you change where docker looks for it in
docker-compose.yml).

2. Configurations for the docker apache in /etc/tabroom. Default versions of
files you need are in the conf/ directory of this repo. They will enable
a smaller footprint apache configuration suitable for local use, and will
enable NYT Devel performance profiling that will appear in /www/profiles.

3. A General.pm configuration file in /etc/tabroom. The default skeleton of
this file is in /www/tabroom/web/lib/Tab/General.pm.default. You will need
at minimum to supply a hostname that resolves on your laptop and the
location as long as you set the appropriate .env variables used in
docker-compose.yml). Unless you change the .env variables, you also need to create
./web/tmp and ./web/mason directories in your local copy of the repo and chmod
them to 777

2. Build the local sources.js by installing JavaScript::Minifier:
`sudo apt install libjavascript-minifier-perl`
Then run the build.pl script in the tabroom repo at
/www/tabroom/web/lib/javascript/build.pl

3. If necessary, change default versions of conf files in the conf/ directory
of this repo. By default, they will enable a smaller footprint apache configuration
suitable for local use, and will enable NYT Devel performance profiling that will
appear in /www/profiles.

4. A General.pm configuration file in /etc/tabroom or at the location specified in a
.env file. The default skeleton of this file is in
/www/tabroom/web/lib/Tab/General.pm.default.
You will need at minimum to supply a hostname that resolves on your laptop, the
location of a MariaDB/MySQL database and credentials with the Tabroom
schema.

4. (Optional) The staging container will log to your local machine using
syslog on port 514 TCP, so you should set it to receive those logs if you
want to be able to see them.

schema, and set the data_dir to the location of the mason cache.

5. You can set environment variables in a .env file in the root of the repo to override
variables specified in the docker-compose file.

6. (Optional) The staging container will log to your local machine using
syslog on port 514 TCP, so you should set it to receive those logs if you
want to be able to see them. Otherwise you may need to disable the syslog stanzas in General.pm
2 changes: 2 additions & 0 deletions conf/staging.tabroom.com.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<VirtualHost *:80>
ServerName old.staging.tabroom.com
ServerAlias old.staging staging-old
ServerAlias staging.tabroom.com
ServerAlias local.tabroom.com
ServerAdmin [email protected]

DocumentRoot /www/tabroom/web
Expand Down
27 changes: 27 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3'
services:
tabroom:
container_name: mason
build:
context: .
dockerfile: Dockerfile
image: mason:latest
restart: always
ports:
- 9000:80
env_file: .env
volumes:
- ${TABROOM_WEB:-/www/tabroom/web}:/www/tabroom/web:rw
- ${TABROOM_WEB_MASON:-/www/tabroom/web/mason}:/www/tabroom/web/mason:rw
- ${TABROOM_WEB_TMP:-/www/tabroom/web/tmp}:/www/tabroom/web/tmp:rw
- ${TABROOM_PROFILES:-/www/profiles}:/www/profiles:rw
- ${TABROOM_LOGS:-/var/log/apache2}:/var/log/apache2:rw
- ${TABROOM_GENERAL:-/etc/tabroom/General.pm}:/www/tabroom/web/lib/Tab/General.pm:ro
- ./conf/staging.tabroom.com.conf:/etc/apache2/sites-enabled/staging.tabroom.com.conf:ro
- ./conf/envvars:/etc/apache2/envvars:ro
- ./conf/apache2.conf:/etc/apache2/apache2.conf:ro
- ./conf/perl.conf:/etc/apache2/mods-enabled/perl.conf:ro
- ./conf/mpm_prefork.conf:/etc/apache2/mods-enabled/mpm_prefork.conf:ro
extra_hosts:
- "host.docker.internal:host-gateway"
- "staging-api.tabroom.com:host-gateway"

0 comments on commit 7f89f3e

Please sign in to comment.