Skip to content

Commit

Permalink
Docker development adjustments (#1693)
Browse files Browse the repository at this point in the history
* Docker development adjustments

- Fix app home path everywhere
- Add new docker-compose step for solving the volume file permisison issue
- Move dory domain to .test since Google is resolving .docker now
- Solve issue where apartment initializer would not allow migrations before seeds had been run

* Update chart/README.md

Co-authored-by: tamsin johnson <[email protected]>

* thou shalt not do maintenance after midnight

* thou shalt not do maintenance after midnight

* now with more chowning power

* keep tmp/pids

ensures tmp/pids is present and has the same fs permissions as the rest of the
application files.
(Taken from
samvera/hyrax@9efa57d)

* fix dory port

Co-authored-by: tamsin johnson <[email protected]>
Co-authored-by: Chris Colvard <[email protected]>
  • Loading branch information
3 people authored May 4, 2021
1 parent 9fb97d6 commit c15ac3d
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 248 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Hyku, the Hydra-in-a-Box Repository Application

Code:
Code:
[![Build Status](https://circleci.com/gh/samvera/hyku.svg?style=svg)](https://circleci.com/gh/samvera/hyku)
[![Coverage Status](https://coveralls.io/repos/samvera/hyku/badge.svg?branch=master&service=github)](https://coveralls.io/github/samvera/hyku?branch=master)
[![Stories in Ready](https://img.shields.io/waffle/label/samvera/hyku/ready.svg)](https://waffle.io/samvera/hyku)

Docs:
Docs:
[![Documentation](http://img.shields.io/badge/DOCUMENTATION-wiki-blue.svg)](https://github.com/samvera/hyku/wiki)
[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
[![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
Expand All @@ -25,7 +25,7 @@ Jump In: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samv
* [Single Tenant Mode](#single-tenancy)
* [Switching accounts](#switching-accounts)
* [Development dependencies](#development-dependencies)
* [Postgres](#postgres)
* [Postgres](#postgres)
* [Importing](#importing)
* [enable Bulkrax](#bulkrax)
* [from CSV](#from-csv)
Expand All @@ -43,7 +43,7 @@ Jump In: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samv

#### Dory

On OS X or Linux we recommend running [Dory](https://github.com/FreedomBen/dory). It acts as a proxy allowing you to access domains locally such as hyku.docker or tenant.hyku.docker, making multitenant development more straightforward and prevents the need to bind ports locally. You can still run in development via docker with out Dory, but to do so please uncomment the ports section in docker-compose.yml and then find the running application at localhost:3000
On OS X or Linux we recommend running [Dory](https://github.com/FreedomBen/dory). It acts as a proxy allowing you to access domains locally such as hyku.test or tenant.hyku.test, making multitenant development more straightforward and prevents the need to bind ports locally. Be sure to adjust your ~/.dory.yml file to support the .test tld. You can still run in development via docker with out Dory, but to do so please uncomment the ports section in docker-compose.yml and then find the running application at localhost:3000

```bash
gem install dory
Expand All @@ -55,7 +55,7 @@ dory up
```bash
docker-compose up web workers
```
This command starts the whole stack in individual containers allowing Rails to be started or stopped independent of the other services. Once that starts (you'll see the line `Passenger core running in multi-application mode.` to indicate a successful boot), you can view your app in a web browser with at either hyku.docker or localhost:3000 (see above). When done `docker-compose stop` shuts down everything.
This command starts the whole stack in individual containers allowing Rails to be started or stopped independent of the other services. Once that starts (you'll see the line `Passenger core running in multi-application mode.` to indicate a successful boot), you can view your app in a web browser with at either hyku.test or localhost:3000 (see above). When done `docker-compose stop` shuts down everything.

#### Tests in Docker

Expand Down Expand Up @@ -109,15 +109,15 @@ The [samvera-vagrant project](https://github.com/samvera-labs/samvera-vagrant) p

### With Kubernetes

Hyku provides a set of [Helm charts](chart/README.md) for deploying to a Kubernetes cluster. Detailed instructions are provided for deploying locally with Docker for Mac.
Hyku provides a set of [Helm charts](chart/README.md) for deploying to a Kubernetes cluster. Detailed instructions are provided for deploying locally with Docker for Mac.

## Single Tenant Mode

Much of the default configuration in Hyku is set up to use multi-tenant mode. This default mode allows Hyku users to run the equivielent of multiple Hyrax installs on a single set of resources. However, sometimes the subdomain splitting multi-headed complexity is simply not needed. If this is the case, then single tenant mode is for you. Single tenant mode will not show the tenant sign up page, or any of the tenant management screens. Instead it shows a single Samvera instance at what ever domain is pointed at the application.

To enable single tenant, in your settings.yml file change multitenancy/enabled to `false` or set `SETTINGS__MULTITENANCY__ENABLED=false` in your `docker-compose.yml` and `docker-compose.production.yml` configs. After changinig this setting, run `rails db:seed` to prepopulate the single tenant.

In single tenant mode, both the application root (eg. localhost, or hyku.docker) and the tenant url single.* (eg. single.hyku.docker) will load the tenant. Override the root host by setting multitenancy/root_host in settings.yml or `SETTINGS__MULTITENANCY__ROOT_HOST`.
In single tenant mode, both the application root (eg. localhost, or hyku.test) and the tenant url single.* (eg. single.hyku.test) will load the tenant. Override the root host by setting multitenancy/root_host in settings.yml or `SETTINGS__MULTITENANCY__ROOT_HOST`.

To change from single- to multi-tenant mode, change the multitenancy/enabled flag to true and restart the application. Change the 'single' tenant account cname in the Accounts edit interface to the correct hostname.

Expand Down Expand Up @@ -172,7 +172,7 @@ The Samvera community is here to help. Please see our [support guide](./SUPPORT.

## Acknowledgments

This software was developed by the Hydra-in-a-Box Project (DPLA, DuraSpace, and Stanford University) under a grant from IMLS.
This software was developed by the Hydra-in-a-Box Project (DPLA, DuraSpace, and Stanford University) under a grant from IMLS.

This software is brought to you by the Samvera community. Learn more at the
[Samvera website](http://samvera.org/).
Expand Down
2 changes: 1 addition & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ There are equivalent kubectl commands for logs and accessing a shell, eg.
```
kubectl kubectl exec -it POD --namespace NAMESPACE -- /bin/bash
kubectl kubectl logs POD --namespace NAMESPACE
```
```
6 changes: 3 additions & 3 deletions chart/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ rails:

ingress:
tlsSecretName: demoapp-puma-tls
host: hyku.docker
host: hyku.test
# use "0" for unlimited
annotations: {
kubernetes.io/ingress.class: "nginx",
Expand Down Expand Up @@ -104,9 +104,9 @@ env:
SETTINGS__CONTACT_EMAIL: [email protected]
SETTINGS__DEVISE__INVITATION_FROM_EMAIL: [email protected]
SETTINGS__FITS_PATH: /opt/fits/fits.sh
SETTINGS__MULTITENANCY__ADMIN_HOST: hyku.docker
SETTINGS__MULTITENANCY__ADMIN_HOST: hyku.test
SETTINGS__MULTITENANCY__ADMIN_ONLY_TENANT_CREATION: true
SETTINGS__MULTITENANCY__DEFAULT_HOST: "%{tenant}.hyku.docker"
SETTINGS__MULTITENANCY__DEFAULT_HOST: "%{tenant}.hyku.test"
SETTINGS__MULTITENANCY__ENABLED: true

secret:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/setup-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
- name: setup
image: {{ .Values.rails.image.repository }}:{{ .Values.rails.image.tag }}
volumeMounts:
- mountPath: /home/app/webapp/public/assets
- mountPath: /app/samvera/hyrax-webapp/public/assets
name: shared
subPath: assets
command: ["/bin/bash"]
Expand Down
16 changes: 8 additions & 8 deletions chart/templates/sidekiq-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,28 @@ spec:
# initialDelaySeconds: 30
# Use sub-path for individual folders
volumeMounts:
- mountPath: /home/app/webapp/tmp/imports
- mountPath: /app/samvera/hyrax-webapp/tmp/imports
name: shared
subPath: import_path
- mountPath: /home/app/webapp/tmp/exports
- mountPath: /app/samvera/hyrax-webapp/tmp/exports
name: shared
subPath: export_path
- mountPath: /home/app/webapp/tmp/derivatives
- mountPath: /app/samvera/hyrax-webapp/tmp/derivatives
name: shared
subPath: derivatives_path
- mountPath: /home/app/webapp/tmp/network_files
- mountPath: /app/samvera/hyrax-webapp/tmp/network_files
name: shared
subPath: network_files
- mountPath: /home/app/webapp/tmp/uploads
- mountPath: /app/samvera/hyrax-webapp/tmp/uploads
name: shared
subPath: upload_path
- mountPath: /home/app/webapp/public/uploads
- mountPath: /app/samvera/hyrax-webapp/public/uploads
name: shared
subPath: uploads
- mountPath: /home/app/webapp/public/assets
- mountPath: /app/samvera/hyrax-webapp/public/assets
name: shared
subPath: assets
- mountPath: /home/app/webapp/public/branding
- mountPath: /app/samvera/hyrax-webapp/public/branding
name: shared
subPath: branding
envFrom:
Expand Down
16 changes: 8 additions & 8 deletions chart/templates/web-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ spec:
imagePullPolicy: IfNotPresent
# Use sub-path for individual folders
volumeMounts:
- mountPath: /home/app/webapp/tmp/imports
- mountPath: /app/samvera/hyrax-webapp/tmp/imports
name: shared
subPath: import_path
- mountPath: /home/app/webapp/tmp/exports
- mountPath: /app/samvera/hyrax-webapp/tmp/exports
name: shared
subPath: export_path
- mountPath: /home/app/webapp/tmp/derivatives
- mountPath: /app/samvera/hyrax-webapp/tmp/derivatives
name: shared
subPath: derivatives_path
- mountPath: /home/app/webapp/tmp/network_files
- mountPath: /app/samvera/hyrax-webapp/tmp/network_files
name: shared
subPath: network_files
- mountPath: /home/app/webapp/tmp/uploads
- mountPath: /app/samvera/hyrax-webapp/tmp/uploads
name: shared
subPath: upload_path
- mountPath: /home/app/webapp/public/uploads
- mountPath: /app/samvera/hyrax-webapp/public/uploads
name: shared
subPath: uploads
- mountPath: /home/app/webapp/public/assets
- mountPath: /app/samvera/hyrax-webapp/public/assets
name: shared
subPath: assets
- mountPath: /home/app/webapp/public/branding
- mountPath: /app/samvera/hyrax-webapp/public/branding
name: shared
subPath: branding
readinessProbe:
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/0db_created.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def db_created?
::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue false
end
2 changes: 1 addition & 1 deletion config/initializers/apartment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unless ENV['DB_ADAPTER'] == 'nulldb'
if ENV['DB_ADAPTER'] != 'nulldb' && db_created?
# You can have Apartment route to the appropriate Tenant by adding some Rack middleware.
# Apartment can support many different "Elevators" that can take care of this routing to your data.
# Require whichever Elevator you're using below or none if you have a custom one.
Expand Down
200 changes: 0 additions & 200 deletions docker-compose.production.yml

This file was deleted.

Loading

0 comments on commit c15ac3d

Please sign in to comment.