Skip to content

Commit

Permalink
add devcontainer support
Browse files Browse the repository at this point in the history
  • Loading branch information
mfall3 committed Oct 24, 2024
1 parent 58d8319 commit 07ada59
Show file tree
Hide file tree
Showing 20 changed files with 1,645 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: "3.7"
name: "databank"

services:
sunspot:
hostname: sunspot
build:
context: ..
dockerfile: .devcontainer/sunspot/Dockerfile
ports:
- "8983:8983"
minio:
image: minio/minio
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
hostname: minio
command: server /data --console-address ":9001"
ports:
- "9000:9000"
- "9001:9001"
sqs-mock:
build:
context: ..
dockerfile: .devcontainer/sqs-mock/Dockerfile
hostname: sqs-mock
ports:
- "9324:9324"
postgres:
image: postgres:12-alpine
environment:
POSTGRES_DB: databank
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
hostname: postgres
ports:
- "5432:5432"
rabbitmq:
build:
context: ..
dockerfile: .devcontainer/rabbitmq/Dockerfile
hostname: rabbitmq
ports:
- "5672:5672"
memcached:
image: memcached
hostname: memcached
ports:
- '11211:11211'
databank:
build:
context: ..
dockerfile: .devcontainer/databank/Dockerfile
depends_on: # docker-compose will NOT actually wait for these to start, hence the `sleep` in the command or setup file
- sunspot
- postgres
- rabbitmq
- memcached
- sqs-mock
- minio
ports:
- "3000:3000"
volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
16 changes: 16 additions & 0 deletions .devcontainer/databank/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:22.04
FROM ruby:3.1.4

ARG rails_env=test
ENV RAILS_ENV=test
ENV RAILS_LOG_TO_STDOUT=true

RUN apt-get update && apt-get install -y \
systemd \
nodejs \
libmemcached-dev \
libmagic-dev \
yarn \
postgresql-client \
memcached \
emacs-nox
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "databank",
"dockerComposeFile": "compose.yaml",
"service": "databank",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root",


// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup"
}
14 changes: 14 additions & 0 deletions .devcontainer/rabbitmq/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# The parent Dockerfile has a lot of layers which may lead to "max depth
# exceeded" messages. This version is known to work.
FROM rabbitmq:3.8.5

ENV RABBITMQ_DEFAULT_USER=databank
ENV RABBITMQ_DEFAULT_PASS=password

# Copy the configuration files
ADD .devcontainer/rabbitmq/rabbitmq.conf /etc/rabbitmq/
ADD .devcontainer/rabbitmq/definitions.json /etc/rabbitmq/

RUN chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.conf /etc/rabbitmq/definitions.json

RUN rabbitmq-plugins enable rabbitmq_management
54 changes: 54 additions & 0 deletions .devcontainer/rabbitmq/definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"users": [
{
"name": "databank",
"password": "password",
"hashing_algorithm": "rabbit_password_hashing_sha256",
"tags": "administrator"
}
],
"vhosts": [
{
"name": "/"
}
],
"permissions": [
{
"user": "databank",
"vhost": "/",
"configure": ".*",
"write": ".*",
"read": ".*"
}
],
"exchanges": [
{
"name": "databank",
"vhost": "/",
"type": "fanout",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
],
"queues": [
{
"name": "databank_to_medusa",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {}
}
],
"bindings": [
{
"source": "databank",
"vhost": "/",
"destination": "databank_to_medusa",
"destination_type": "queue",
"routing_key": "*",
"arguments": {}
}
]
}
2 changes: 2 additions & 0 deletions .devcontainer/rabbitmq/rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
management.load_definitions = /etc/rabbitmq/definitions.json

8 changes: 8 additions & 0 deletions .devcontainer/sqs-mock/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# invocation
# docker build -t sqs-mock .
# docker run --name sqs-mock -p 9324:9324 -d sqs-mock

FROM s12v/elasticmq

# Copy the configuration files
COPY .devcontainer/sqs-mock/elasticmq.conf /etc/elasticmq/
49 changes: 49 additions & 0 deletions .devcontainer/sqs-mock/elasticmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
include classpath("application.conf")

queues {
extractor-to-databank {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
deadLetterQueue {
name: "dead-extractor-to-databank"
maxReceiveCount = 5
}
}
dead-extractor-to-databank {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
}

databank-to-medusa {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
deadLetterQueue {
name: "dead-databank-to-medusa"
maxReceiveCount = 5
}
}
dead-databank-to-medusa {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
}

medusa-to-databank {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
deadLetterQueue {
name: "dead-medusa-to-databank"
maxReceiveCount = 5
}
}
dead-medusa-to-databank {
defaultVisibilityTimeout = 30 seconds
delay = 0 seconds
receiveMessageWait = 0 seconds
}

}
43 changes: 43 additions & 0 deletions .devcontainer/sunspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# invocation
# docker build -t sunspot .
# docker run --name sunspot -p 8984:8983 -d sunspot
# ENV=test
# curl "http://localhost:8984/solr/admin/cores?action=CREATE&name=$ENV&instanceDir=$ENV"

FROM solr:6

USER root

COPY .devcontainer/sunspot/*.* ./

# test env
RUN mkdir -p server/solr/test/conf
RUN cp _rest_managed.json server/solr/test/conf/
RUN cp admin-extra.html server/solr/test/conf/
RUN cp currency.xml server/solr/test/conf/
RUN cp elevate.xml server/solr/test/conf/
RUN cp mapping-ISOLatin1Accent.txt server/solr/test/conf/
RUN cp protwords.txt server/solr/test/conf/
RUN cp schema.xml server/solr/test/conf/
RUN cp scripts.conf server/solr/test/conf/
RUN cp solrconfig.xml server/solr/test/conf/
RUN cp spellings.txt server/solr/test/conf/
RUN cp synonyms.txt server/solr/test/conf/

# development env
RUN mkdir -p server/solr/development/conf
RUN cp _rest_managed.json server/solr/development/conf/
RUN cp admin-extra.html server/solr/development/conf/
RUN cp currency.xml server/solr/development/conf/
RUN cp elevate.xml server/solr/development/conf/
RUN cp mapping-ISOLatin1Accent.txt server/solr/development/conf/
RUN cp protwords.txt server/solr/development/conf/
RUN cp schema.xml server/solr/development/conf/
RUN cp scripts.conf server/solr/development/conf/
RUN cp solrconfig.xml server/solr/development/conf/
RUN cp spellings.txt server/solr/development/conf/
RUN cp synonyms.txt server/solr/development/conf/

RUN chown -R solr server/solr

USER solr
1 change: 1 addition & 0 deletions .devcontainer/sunspot/_rest_managed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"initArgs":{},"managedList":[]}
31 changes: 31 additions & 0 deletions .devcontainer/sunspot/admin-extra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
-->
67 changes: 67 additions & 0 deletions .devcontainer/sunspot/currency.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- Example exchange rates file for CurrencyField type named "currency" in example schema -->

<currencyConfig version="1.0">
<rates>
<!-- Updated from http://www.exchangerate.com/ at 2011-09-27 -->
<rate from="USD" to="ARS" rate="4.333871" comment="ARGENTINA Peso" />
<rate from="USD" to="AUD" rate="1.025768" comment="AUSTRALIA Dollar" />
<rate from="USD" to="EUR" rate="0.743676" comment="European Euro" />
<rate from="USD" to="BRL" rate="1.881093" comment="BRAZIL Real" />
<rate from="USD" to="CAD" rate="1.030815" comment="CANADA Dollar" />
<rate from="USD" to="CLP" rate="519.0996" comment="CHILE Peso" />
<rate from="USD" to="CNY" rate="6.387310" comment="CHINA Yuan" />
<rate from="USD" to="CZK" rate="18.47134" comment="CZECH REP. Koruna" />
<rate from="USD" to="DKK" rate="5.515436" comment="DENMARK Krone" />
<rate from="USD" to="HKD" rate="7.801922" comment="HONG KONG Dollar" />
<rate from="USD" to="HUF" rate="215.6169" comment="HUNGARY Forint" />
<rate from="USD" to="ISK" rate="118.1280" comment="ICELAND Krona" />
<rate from="USD" to="INR" rate="49.49088" comment="INDIA Rupee" />
<rate from="USD" to="XDR" rate="0.641358" comment="INTNL MON. FUND SDR" />
<rate from="USD" to="ILS" rate="3.709739" comment="ISRAEL Sheqel" />
<rate from="USD" to="JPY" rate="76.32419" comment="JAPAN Yen" />
<rate from="USD" to="KRW" rate="1169.173" comment="KOREA (SOUTH) Won" />
<rate from="USD" to="KWD" rate="0.275142" comment="KUWAIT Dinar" />
<rate from="USD" to="MXN" rate="13.85895" comment="MEXICO Peso" />
<rate from="USD" to="NZD" rate="1.285159" comment="NEW ZEALAND Dollar" />
<rate from="USD" to="NOK" rate="5.859035" comment="NORWAY Krone" />
<rate from="USD" to="PKR" rate="87.57007" comment="PAKISTAN Rupee" />
<rate from="USD" to="PEN" rate="2.730683" comment="PERU Sol" />
<rate from="USD" to="PHP" rate="43.62039" comment="PHILIPPINES Peso" />
<rate from="USD" to="PLN" rate="3.310139" comment="POLAND Zloty" />
<rate from="USD" to="RON" rate="3.100932" comment="ROMANIA Leu" />
<rate from="USD" to="RUB" rate="32.14663" comment="RUSSIA Ruble" />
<rate from="USD" to="SAR" rate="3.750465" comment="SAUDI ARABIA Riyal" />
<rate from="USD" to="SGD" rate="1.299352" comment="SINGAPORE Dollar" />
<rate from="USD" to="ZAR" rate="8.329761" comment="SOUTH AFRICA Rand" />
<rate from="USD" to="SEK" rate="6.883442" comment="SWEDEN Krona" />
<rate from="USD" to="CHF" rate="0.906035" comment="SWITZERLAND Franc" />
<rate from="USD" to="TWD" rate="30.40283" comment="TAIWAN Dollar" />
<rate from="USD" to="THB" rate="30.89487" comment="THAILAND Baht" />
<rate from="USD" to="AED" rate="3.672955" comment="U.A.E. Dirham" />
<rate from="USD" to="UAH" rate="7.988582" comment="UKRAINE Hryvnia" />
<rate from="USD" to="GBP" rate="0.647910" comment="UNITED KINGDOM Pound" />

<!-- Cross-rates for some common currencies -->
<rate from="EUR" to="GBP" rate="0.869914" />
<rate from="EUR" to="NOK" rate="7.800095" />
<rate from="GBP" to="NOK" rate="8.966508" />
</rates>
</currencyConfig>
Loading

0 comments on commit 07ada59

Please sign in to comment.