Skip to content

Commit

Permalink
Merge branch 'main' into story/15911_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aslaymoore committed Aug 1, 2024
2 parents b9e3e0b + 6cd94fe commit ee489f3
Show file tree
Hide file tree
Showing 190 changed files with 8,050 additions and 3,968 deletions.
File renamed without changes.
13 changes: 0 additions & 13 deletions .env

This file was deleted.

9 changes: 6 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ RAILS_VERSION=6.1.7.6
VIEW_COMPONENT_VERSION=2.6.6
SOLR_VERSION=9.3.0
ZK_VERSION=3.8.2
NODE_MAJOR_VERSION=16
SOLR_PASS=UALibrariesRawk
SOLR_USER=solr
SOLR_PORT=8984
GOB_PORT=3000
USER=gob
PASS=gobb13
APP_USER=gob
APP_PASS=gobb13
DEPLOY_SSH_KEY_PATH="/home/gob/.ssh/ed25519"
DGID=1000
DUID=1000
DUID=1000
SLACK_WEB_HOOK="" # Get from stache
File renamed without changes.
47 changes: 45 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
.bundle

# Ignore the default SQLite database.
db/*.sqlite3
db/*.sqlite3-*

# Ignore all logfiles and tempfiles.
log/*
tmp/*
!log/.keep
!tmp/.keep

# Ignore pidfiles, but keep the directory.
tmp/pids/*
!tmp/pids/
!tmp/pids/.keep

# Ignore uploaded files in development.
storage/*
!storage/.keep

public/assets
.byebug_history

# Ignore master key for decrypting credentials and more.
config/master.key

public/packs
public/packs-test
node_modules
yarn-error.log
yarn-debug.log*
.yarn-integrity

/config/master.key

# Local development related files and directories to ignore
/.env
/app/tmp/ual-ogm
.DS_Store
/.idea
/.idea
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger


# Include capistrano plugins related to Rails
require "capistrano/rvm"
require "capistrano/bundler"
require "capistrano/passenger"
require 'capistrano/rails'

require 'slackistrano/capistrano'
require_relative 'lib/custom_slack_messaging'

# require "capistrano/rbenv"
# require "capistrano/chruby"

# Not needed if 'capistrano/rails' is required
# require "capistrano/rails/assets"
# require "capistrano/rails/migrations"




# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
14 changes: 12 additions & 2 deletions app/Gemfile → Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '6.1.7.8'
# Use sqlite3 as the database for Active Record
Expand All @@ -17,11 +16,14 @@ gem 'webpacker', '5.4.4'
gem 'turbolinks', '5.2.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '2.12.0'
# Dependencies for ed25519
gem 'ed25519', '1.3.0'
gem 'bcrypt_pbkdf', '1.1.0'
gem 'dotenv', '3.1.2'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

Expand All @@ -34,6 +36,13 @@ group :development, :test do
end

group :development do
# Capistrano is a deployment automation tool. Version 3.18 is specified here.
gem 'capistrano', '3.19.1'
gem 'capistrano-bundler', '2.1.0'
gem 'capistrano-rvm', '0.1.2'
gem 'capistrano-passenger','0.2.1'
gem "capistrano-rails", "1.6.3"
gem 'slackistrano', '4.0.2'
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '4.2.1'
# Display performance information such as SQL time and flame graphs for each request in your browser.
Expand All @@ -42,6 +51,7 @@ group :development do
gem 'listen', '3.9.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '4.2.1'

end

group :test do
Expand Down
43 changes: 42 additions & 1 deletion app/Gemfile.lock → Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
sshkit (>= 1.6.1, != 1.7.0)
autoprefixer-rails (10.4.16.0)
execjs (~> 2)
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.0)
bindex (0.8.1)
blacklight (7.37.0)
deprecation
Expand All @@ -85,6 +88,21 @@ GEM
sassc-rails (>= 2.0.0)
builder (3.3.0)
byebug (11.1.3)
capistrano (3.19.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-passenger (0.2.1)
capistrano (~> 3.0)
capistrano-rails (1.6.3)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capybara (3.40.0)
addressable
matrix
Expand Down Expand Up @@ -113,7 +131,9 @@ GEM
devise-guests (0.8.3)
devise
domain_name (0.6.20240107)
dotenv (3.1.2)
dry-cli (1.1.0)
ed25519 (1.3.0)
erubi (1.13.0)
execjs (2.9.1)
faraday (2.10.0)
Expand Down Expand Up @@ -243,8 +263,13 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0)
net-smtp (0.5.0)
net-protocol
net-ssh (7.2.3)
nio4r (2.7.3)
nokogiri (1.16.6-aarch64-linux)
racc (~> 1.4)
Expand Down Expand Up @@ -340,6 +365,8 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
slackistrano (4.0.2)
capistrano (>= 3.8.1)
solr_wrapper (4.0.2)
http
minitar
Expand All @@ -360,6 +387,11 @@ GEM
sqlite3 (1.7.3-x86-linux)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
sshkit (1.23.0)
base64
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
strscan (3.1.0)
thor (1.3.1)
tilt (2.4.0)
Expand Down Expand Up @@ -410,6 +442,7 @@ GEM
zeitwerk (2.6.16)

PLATFORMS
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
Expand All @@ -420,18 +453,25 @@ PLATFORMS
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
bcrypt_pbkdf (= 1.1.0)
blacklight (= 7.37.0)
bootsnap (= 1.18.3)
bootstrap (= 4.6.2)
byebug (= 11.1.3)
capistrano (= 3.19.1)
capistrano-bundler (= 2.1.0)
capistrano-passenger (= 0.2.1)
capistrano-rails (= 1.6.3)
capistrano-rvm (= 0.1.2)
capybara (= 3.40.0)
devise (= 4.9.4)
devise-guests (= 0.8.3)
dotenv (= 3.1.2)
ed25519 (= 1.3.0)
geo_combine (= 0.9.1)
geoblacklight (= 4.4.0)
jbuilder (= 2.12.0)
Expand All @@ -443,6 +483,7 @@ DEPENDENCIES
rsolr (= 2.6.0)
sass-rails (= 6.0.0)
selenium-webdriver (= 4.10.0)
slackistrano (= 4.0.2)
solr_wrapper (= 4.0.2)
spring (= 4.2.1)
sprockets (= 3.7.3)
Expand Down
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ $ ./dbuild.sh
$ ./start-me-up.sh
```

The GBL app is installed automatically if it does not already exist. This will take a little while and the server is still not started. A list of dependencies should print out as the GBL is installed. All data that matters to the app is statefully preserved on the host machine in the `./app` directory. The GBL RoR app will be in `./app/app` (Yes, two apps for the price of one!)
The GBL app is installed automatically if it does not already exist. This will take a little while and the server is still not started. A list of dependencies should print out as the GBL is installed.

Build scripts set up Apache ZooKeeper and Solr decoupled to propagate search configuration and data in "cloud mode". Search data is located in Docker volumes on startup.

Expand All @@ -56,6 +56,38 @@ See the following URLs:
* `localhost:3000` for the GeoBlacklight application
* `localhost:8984` for the Solr admin (admin is locked down; see the .env file for creds)

## Deployment

We use [Capistrano](https://capistranorb.com/) for deployments. Deployments are easiest to run through the Docker container for local development. You must provide the Slack webhook using the `SLACK_WEB_HOOK` environment variable in the `.env` file in order to deploy. You won't be able to deploy without it. You can find the webhook stored in [Stache](https://stache.arizona.edu) under the "Capistrano Slack App Webhook" entry. You must also provide the path to your SSH key in the `DEPLOY_SSH_KEY_PATH` environment variable in `.env`. **It must be an RSA or ED25519 key**. Lastly, the deployment is executed as the 'deploy' user, so you must have your SSH public key added to the deploy users `authorized_keys` file.

Here are the steps to deploy to production:

0. Make sure you're on the Library network (on site or using VPN)
1. SSH into the `ual_gob_app` service

```shell
docker compose exec ual_gob_app bash
```

2. Change directory to `/geoblacklight/app` inside the container

```shell
cd /geoblacklight/app
```

3. Run the Capistrano deployment command

```shell
cap production deploy
```
This will deploy the `main` branch to production. Alternatively you can provide a branch name to deploy:

```shell
cap production deploy BRANCH=some_branch_name
```

You can check the status of the deployment in the `#tess-dev-deployer` Slack channel in the UAL Slack workspace.

## Optional application container commands

**Stop the Docker network:**
Expand Down Expand Up @@ -119,7 +151,7 @@ Also see the Solr query screen in the Solr admin: https://solr.apache.org/guide/
**Tear-down**
WARNING: This destroys _all_ data, meaning containers and volumes. (It does not remove Docker images, however.) The dialogue will ask if you want to clean up any untracked files. Usually there are generated files that are ignored by git. However, if you have added something and not committed, those files may be deleted permanently. Please take a good look at the list to avoid this.
WARNING: This destroys _all_ data, meaning containers and volumes. (It does not remove Docker images, however.) The dialogue will ask if you want to delete all files in the tmp directory, log directory, and sqlite files.
```shell
$ ./destroy.sh
Expand All @@ -142,7 +174,7 @@ $ ./destroy.sh
## Helpful hints
* Software versions are controlled in `.env`, as are a few other important environment variables.
* Blacklight-core metadata and config are stored in the `app/solr/conf` directory, which is mounted into the Solr container.
* Blacklight-core metadata and config are stored in the `solr/conf` directory, which is mounted into the Solr container.
## Rails Console
Expand Down
File renamed without changes.
Loading

0 comments on commit ee489f3

Please sign in to comment.