Skip to content

Commit

Permalink
update repo with current basic deployment details
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansan committed May 8, 2021
1 parent c7377ba commit 7812d33
Show file tree
Hide file tree
Showing 83 changed files with 107 additions and 16,566 deletions.
5 changes: 0 additions & 5 deletions .dockerignore

This file was deleted.

10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Dependencies
marvinjs/
piwik/
joomla/
webservices/
docker_volumes/

# Data
.DS_Store
*.sql

# Admin
PROD.*
db.env
public-html/custom/common/xhr/php/
*.env
9 changes: 0 additions & 9 deletions Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions EXAMPLE_db.env

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Copyright 2018 - Roger Linington
43 changes: 29 additions & 14 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
# NPAtlas_website
# The Natural Products Atlas

Reposistory for the new Dockerized deployment of the NP Atlas website www.npatlas.org.
Hosted at www.npatlas.org

Custom HTML/CSS/JS are contained in the `public-html` folder, with modules being copied into the Joomla CMS.
AUTHOR: Jeff van Santen

#### Status
Contained is a bare bones `docker-compose` deployment for the NP Atlas.
The required Docker images are currently not publically available.

**Beta** - requires significant development and cleanup of legacy code and dependencies. Website versioning to be removed and re-factored.
This repo exists primarily for **Issue Tracking**.

#### Setup
#### Environment files

Deployment is controlled with Docker and Docker Compose. Development `docker-compose.yml` is provided with commented out dependencies (some currently missing).
As specified in the `docker.compose.yml` two environment files need to be configured.
Here are the required files for the REST api and the webapp, respectively.

Requirements:
api.env

- a Joomla instance with the NP Atlas specific data (SQL + Filesystem, not included in this repo).
- the JChem webservices to be installed (example in `docker-compose.yml`)
- replace ServerName in `/sites-enabled/npatlas.conf` for Joomla Apache.
- `public-html/marvinjs/` for chemical drawing util.
```
LOG_LEVEL=debug
MODULE_NAME=atlas.main
DATABASE_URL=postgresql://jvansan:jvansan@127.0.0.1/np_atlas_2020_06
#AUTH_DATABASE_URL=postgresql://jvansan:jvansan@127.0.0.1/authentication # Only used with DEV_DEPLOYMENT == true
DEV_DEPLOYMENT=false
REDIS_URL=redis
```

`/public-html/custom/` contains Joomla modules in HTML/JS with extra CSS. These require changing of API URL from localhost to deployed URL with the correct API Key.
app.env

Set the variables in `EXAMPLE_db.env` and move to `db.env`.
```
ATLAS_APIKEY=<REPLACEME>
ATLAS_URL=http://api/api/v1
ATLAS_VERSION=2020_06
SECRET_KEY=<REPLACEME>
DEV=false
ALLOWED_HOSTS=<REPLACEME>
EMAIL_HOST_USER=<REPLACEME>
EMAIL_HOST_PASSWORD=<REPLACEME>
```
156 changes: 75 additions & 81 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,87 @@
version: "3"

services:
# traefik:
# image: traefik:2.1
# command:
# - "--log.level=DEBUG"
# - "--providers.docker"
# - "--api.dashboard=true"
# - "--accesslog"
# - "--entrypoints.web.address=:80"
# #- "--entrypoints.web.proxyProtocol.trustedIPs=127.0.0.1/32,96.54.173.75"
# # - "--entrypoints.websecure.address=:443"
# # - "--certificatesresolvers.myresolver.acme.email=jvansant@sfu.ca"
# # - "--certificatesresolvers.myresolver.acme.storage=/etc/traefik/acme.json"
# ## used during the challenge
# # - "--certificatesresolvers.myresolver.acme.httpChallenge.entryPoint=websecure"
# ## used during the challenge
# #- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
# ## Staging for testing
# #- "--certificatesresolvers.myresolver.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory"
# labels:
# - "traefik.http.routers.api.entrypoints=web"
# - "traefik.http.routers.api.rule=Host(`traefik.localhost`)"
# - "traefik.http.routers.api.service=api@internal"
# # - "traefik.http.routers.api.middlewares=auth"
# # - "traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/"
# # - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# # - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
# # - "traefik.http.routers.http-catchall.entrypoints=web"
# # - "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
# ports:
# # The HTTP port
# - "80:80"
# # The HTTPS port
# - "443:443"
# # - "8080:8080"
# volumes:
# # So that Traefik can listen to the Docker events
# - /var/run/docker.sock:/var/run/docker.sock
# logging:
# driver: "json-file"
# options:
# max-size: "200k"
# max-file: "10"
traefik:
image: traefik:2.2
restart: always
command:
--api.insecure=true
--providers.docker
--entryPoints.web.address=:80
--entryPoints.websecure.address=:443
--certificatesResolvers.le.acme.email=jvansant@sfu.ca
--certificatesResolvers.le.acme.storage=/acme/acme.json
--certificatesResolvers.le.acme.tlsChallenge=true
--entrypoints.web.http.redirections.entryPoint.to=websecure
--entrypoints.web.http.redirections.entryPoint.scheme=https
# --log.level=DEBUG
# --certificatesResolvers.le.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory
ports:
# The HTTP port
- "80:80"
# The HTTPS port
- "443:443"
# The Web UI enabled by --api.insecure=true
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- "./docker_volumes/acme/:/acme/"
environment:
- HTTP_PROXY=http://bby-nsx-proxy.its.sfu.ca:8080
- HTTPS_PROXY=http://bby-nsx-proxy.its.sfu.ca:8080
- NO_PROXY=www.npatlas.org,127.0.0.0/8,172.24.0.0/8

webservices:
image: webservices:latest
build: ./webservices
# separate static file server
static:
image: nginx
restart: always
# pass location of static files
volumes:
- ${PWD}/webservices/ws-config.xml:/usr/local/tomcat/.chemaxon/ws-config.xml
- "./static_deploy:/usr/share/nginx/html/static"
labels:
- "traefik.http.routers.webservice.entrypoints=web"
- "traefik.http.routers.webservice.rule=Host(`${DOMAIN?Variable DOMAIN not set}`) && PathPrefix(`/webservices2`)"
- traefik.http.routers.static.rule=Host(`www.npatlas.org`)&&PathPrefix(`/static`)
- traefik.http.routers.static.tls=true
- traefik.http.routers.static.tls.certresolver=le

site:
build: .
image: joomla-site
api:
image: npatlas_api:0.0.11
restart: always
volumes:
- ./public-html:/var/www/html:cached
- ./sites-enabled:/etc/apache2/sites-enabled
environment:
- JOOMLA_DB_HOST=mysqlserver
env_file:
- ./db.env
- api.env
labels:
- "traefik.http.routers.joomla.entrypoints=web"
- "traefik.http.routers.joomla.rule=Host(`${DOMAIN?Variable DOMAIN not set}`) && (PathPrefix(`/joomla`) || PathPrefix(`/custom`) || PathPrefix(`/marvinjs`) || Path(`/`) || Path(`/robots.txt`))"
- "traefik.http.middlewares.joomla-gzip.compress=true"
- "traefik.http.routers.joomla.middlewares=joomla-gzip@docker"
- traefik.http.routers.atlas-api.rule=Host(`www.npatlas.org`)&&PathPrefix(`/api`)
- traefik.http.routers.atlas-api.tls=true
- traefik.http.routers.atlas-api.tls.certresolver=le

# Dont expose ports - no auth
redis:
image: redis
# Enable persistent data
volumes:
- "./docker_volumes/redis:/data"
command: ["redis-server", "--appendonly", "yes"]

# analytic:
# image: matomo
# volumes:
# - /data/docker/matomo:/var/www/html
# environment:
# - MATOMO_DATABASE_HOST=mysql
# - MATOMO_ENABLE_PROXY_URI_HEADER=yes
# - VIRUAL_HOST=
# env_file:
# - ./db.env
# labels:
# - "traefik.http.routers.matomo.entrypoints=web"
# - "traefik.http.routers.matomo.rule=Host(`${DOMAIN?Variable DOMAIN not set}`) && PathPrefix(`/piwik`)"
# - "traefik.http.middlewares.matomo-path.stripprefix.prefixes=/piwik"
# - "traefik.http.middlewares.matomo-path.stripprefix.forceslash=true"
# - "traefik.http.routers.matomo.middlewares=matomo-path@docker"

networks:
default:
external:
name: atlas_network
marvinws:
image: marvinws:latest
restart: always
labels:
- "traefik.http.routers.webservice.rule=Host(`www.npatlas.org`)&&PathPrefix(`/webservices2`)"
- "traefik.http.middlewares.wsstrip.stripprefix.prefixes=/webservices2"
- traefik.http.routers.webservice.middlewares=wsstrip@docker
- traefik.http.routers.webservice.tls=true
- traefik.http.routers.webservice.tls.certresolver=le

app:
image: npatlas:2.0.6
restart: always
env_file:
- app.env
# Persistent SQLite DB
volumes:
- "./db:/usr/src/app/db"
labels:
- traefik.http.routers.atlas.rule=Host(`www.npatlas.org`)&&PathPrefix(`/`)
- traefik.http.routers.atlas.tls=true
- traefik.http.routers.atlas.tls.certresolver=le
18 changes: 0 additions & 18 deletions public-html/.htaccess

This file was deleted.

19 changes: 0 additions & 19 deletions public-html/archive/joomla_tricks.txt

This file was deleted.

Loading

0 comments on commit 7812d33

Please sign in to comment.