Revert long naming for CrisisCleanup
This commit is contained in:
parent
c5e55e7f2e
commit
a15a716066
@ -10,7 +10,7 @@ ${SOURCE_DIR}/basic.sh
|
||||
|
||||
# Install applications
|
||||
${SOURCE_DIR}/ckan.sh
|
||||
# ${SOURCE_DIR}/ccleanup.sh
|
||||
# ${SOURCE_DIR}/crisiscleanup.sh
|
||||
# ${SOURCE_DIR}/cts.sh
|
||||
${SOURCE_DIR}/flsms.sh
|
||||
${SOURCE_DIR}/gnuhealth.sh
|
||||
|
40
ccleanup.sh
40
ccleanup.sh
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ccleanup
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
docker image ls | grep -q ruby || $(realpath $(dirname "${0}"))/ruby.sh
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t ccleanup ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/ccleanup /etc/init.d/ccleanup
|
||||
rc-update -u
|
||||
|
||||
# Create database
|
||||
export CCLEANUP_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Copy existing config files into persistent storage
|
||||
mkdir -p /srv/ccleanup/conf
|
||||
chown 8005:8005 /srv/ccleanup/conf
|
||||
docker run --rm -v /srv/ccleanup/conf:/mnt/conf ccleanup cp -rp /srv/ccleanup/config/. /mnt/conf
|
||||
chown root:root /srv/ccleanup/conf
|
||||
|
||||
# Configure CrisisCleanup
|
||||
export CCLEANUP_ADMIN_USER="Admin"
|
||||
export CCLEANUP_ADMIN_EMAIL="admin@example.com"
|
||||
export CCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/srv/ccleanup/conf/database.yml >/srv/ccleanup/conf/database.yml
|
||||
cp ${SOURCE_DIR}/srv/ccleanup/conf/boot.rb /srv/ccleanup/conf/boot.rb
|
||||
cp ${SOURCE_DIR}/srv/ccleanup/conf/initializers/devise.rb /srv/ccleanup/conf/initializers/devise.rb
|
||||
cp ${SOURCE_DIR}/srv/ccleanup/conf/environments/production.rb /srv/ccleanup/conf/environments/production.rb
|
||||
spotter-appmgr update-login ccleanup "${CCLEANUP_ADMIN_EMAIL}" "${CCLEANUP_ADMIN_PWD}"
|
||||
|
||||
# Populate database
|
||||
envsubst <${SOURCE_DIR}/srv/ccleanup/db/seeds.rb >/tmp/seeds.rb
|
||||
docker run --rm -h ccleanup --link postgres -v /srv/ccleanup/conf:/srv/ccleanup/config ccleanup rake db:schema:load
|
||||
docker run --rm -h ccleanup --link postgres -v /srv/ccleanup/conf:/srv/ccleanup/config -v /tmp/seeds.rb:/srv/ccleanup/db/seeds.rb ccleanup rake db:seed
|
||||
rm /tmp/seeds.rb
|
@ -1,6 +0,0 @@
|
||||
CREATE ROLE ccleanup NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${CCLEANUP_PWD}';
|
||||
CREATE DATABASE ccleanup;
|
||||
REVOKE ALL ON DATABASE ccleanup FROM public;
|
||||
ALTER DATABASE ccleanup OWNER TO ccleanup;
|
||||
\c ccleanup
|
||||
CREATE EXTENSION hstore;
|
@ -1,29 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Crisis Cleanup docker container"
|
||||
|
||||
depend() {
|
||||
need docker postfix postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ccleanup \
|
||||
-h ccleanup \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
-v /srv/ccleanup/conf:/srv/ccleanup/config \
|
||||
ccleanup
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/spotter-appmgr register-proxy ccleanup
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy ccleanup
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ccleanup
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
production:
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
database: ccleanup
|
||||
pool: 5
|
||||
host: postgres
|
||||
username: ccleanup
|
||||
password: ${CCLEANUP_PWD}
|
40
crisiscleanup.sh
Executable file
40
crisiscleanup.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/crisiscleanup
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
||||
docker image ls | grep -q ruby || $(realpath $(dirname "${0}"))/ruby.sh
|
||||
service postgres start
|
||||
|
||||
# Build Docker container
|
||||
docker build -t crisiscleanup ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/crisiscleanup /etc/init.d/crisiscleanup
|
||||
rc-update -u
|
||||
|
||||
# Create database
|
||||
export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Copy existing config files into persistent storage
|
||||
mkdir -p /srv/crisiscleanup/conf
|
||||
chown 8005:8005 /srv/crisiscleanup/conf
|
||||
docker run --rm -v /srv/crisiscleanup/conf:/mnt/conf crisiscleanup cp -rp /srv/crisiscleanup/config/. /mnt/conf
|
||||
chown root:root /srv/crisiscleanup/conf
|
||||
|
||||
# Configure CrisisCleanup
|
||||
export CRISISCLEANUP_ADMIN_USER="Admin"
|
||||
export CRISISCLEANUP_ADMIN_EMAIL="admin@example.com"
|
||||
export CRISISCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/srv/crisiscleanup/conf/database.yml >/srv/crisiscleanup/conf/database.yml
|
||||
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb
|
||||
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb
|
||||
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb
|
||||
spotter-appmgr update-login crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}"
|
||||
|
||||
# Populate database
|
||||
envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/tmp/seeds.rb
|
||||
docker run --rm -h crisiscleanup --link postgres -v /srv/crisiscleanup/conf:/srv/crisiscleanup/config crisiscleanup rake db:schema:load
|
||||
docker run --rm -h crisiscleanup --link postgres -v /srv/crisiscleanup/conf:/srv/crisiscleanup/config -v /tmp/seeds.rb:/srv/crisiscleanup/db/seeds.rb crisiscleanup rake db:seed
|
||||
rm /tmp/seeds.rb
|
@ -19,33 +19,33 @@ RUN \
|
||||
# Install build dependencies
|
||||
apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers postgresql-dev yarn zlib-dev \
|
||||
# Clone CrisisCleanup
|
||||
&& git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/ccleanup \
|
||||
&& git clone --depth 1 https://github.com/CrisisCleanup/crisiscleanup /srv/crisiscleanup \
|
||||
# Hackfix ruby dependency versions
|
||||
&& sed -i 's/2\.2\.5/2.3.6/' /srv/ccleanup/Gemfile \
|
||||
&& sed -i 's/rdoc (4\.2\.0)/rdoc (4.3.0)/' /srv/ccleanup/Gemfile.lock \
|
||||
&& sed -i 's/2\.2\.5/2.3.6/' /srv/crisiscleanup/Gemfile \
|
||||
&& sed -i 's/rdoc (4\.2\.0)/rdoc (4.3.0)/' /srv/crisiscleanup/Gemfile.lock \
|
||||
# Install Ruby and NodeJS dependencies
|
||||
&& cd /srv/ccleanup \
|
||||
&& cd /srv/crisiscleanup \
|
||||
&& bundle config build.nokogiri --use-system-libraries \
|
||||
&& bundle install \
|
||||
&& npm install \
|
||||
&& yarn \
|
||||
# Create CrisisCleanup secret
|
||||
&& echo -e "production:\n secret_key_base: $(rake secret)" >/srv/ccleanup/config/secrets.yml \
|
||||
&& echo -e "production:\n secret_key_base: $(rake secret)" >/srv/crisiscleanup/config/secrets.yml \
|
||||
# Generate static resources
|
||||
&& rake assets:precompile \
|
||||
# Create OS user
|
||||
&& addgroup -S -g 8005 ccleanup \
|
||||
&& adduser -S -u 8005 -h /srv/ccleanup -s /bin/false -g ccleanup -G ccleanup ccleanup \
|
||||
&& chown -R ccleanup:ccleanup /srv/ccleanup \
|
||||
&& addgroup -S -g 8005 cc \
|
||||
&& adduser -S -u 8005 -h /srv/crisiscleanup -s /bin/false -g cc -G cc cc \
|
||||
&& chown -R cc:cc /srv/crisiscleanup \
|
||||
# Cleanup
|
||||
&& apk --no-cache del .deps \
|
||||
&& find /srv/ccleanup -name '.git*' -exec rm -rf {} + \
|
||||
&& find /srv/crisiscleanup -name '.git*' -exec rm -rf {} + \
|
||||
&& rm -rf /usr/local/share/.cache \
|
||||
&& rm -rf /root/.bundle /root/.config /root/.npm
|
||||
|
||||
VOLUME ["/srv/ccleanup/config"]
|
||||
VOLUME ["/srv/crisiscleanup/config"]
|
||||
EXPOSE 8080
|
||||
|
||||
USER ccleanup
|
||||
WORKDIR /srv/ccleanup
|
||||
USER cc
|
||||
WORKDIR /srv/crisiscleanup
|
||||
CMD ["rails", "server"]
|
6
crisiscleanup/createdb.sql
Normal file
6
crisiscleanup/createdb.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE ROLE crisiscleanup NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${CRISISCLEANUP_PWD}';
|
||||
CREATE DATABASE crisiscleanup;
|
||||
REVOKE ALL ON DATABASE crisiscleanup FROM public;
|
||||
ALTER DATABASE crisiscleanup OWNER TO crisiscleanup;
|
||||
\c crisiscleanup
|
||||
CREATE EXTENSION hstore;
|
29
crisiscleanup/etc/init.d/crisiscleanup
Executable file
29
crisiscleanup/etc/init.d/crisiscleanup
Executable file
@ -0,0 +1,29 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Crisis Cleanup docker container"
|
||||
|
||||
depend() {
|
||||
need docker postfix postgres
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name crisiscleanup \
|
||||
-h crisiscleanup \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
-v /srv/crisiscleanup/conf:/srv/crisiscleanup/config \
|
||||
crisiscleanup
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/spotter-appmgr register-proxy crisiscleanup
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/spotter-appmgr unregister-proxy crisiscleanup
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop crisiscleanup
|
||||
}
|
8
crisiscleanup/srv/crisiscleanup/conf/database.yml
Normal file
8
crisiscleanup/srv/crisiscleanup/conf/database.yml
Normal file
@ -0,0 +1,8 @@
|
||||
production:
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
database: crisiscleanup
|
||||
pool: 5
|
||||
host: postgres
|
||||
username: crisiscleanup
|
||||
password: ${CRISISCLEANUP_PWD}
|
@ -10,7 +10,7 @@ Devise.setup do |config|
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = 'ccleanup@spotter.ngo'
|
||||
config.mailer_sender = 'crisiscleanup@spotter.ngo'
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = 'Devise::Mailer'
|
@ -19,5 +19,5 @@ Legacy::LegacySite.create!([
|
||||
{address: "200 Epcot Center Drive", blurred_latitude: 28.3849506927356, blurred_longitude: -81.5443968549352, case_number: "A7", city: "Orlando", claimed_by: 2, legacy_event_id: 1, latitude: 28.383045, longitude: -81.5485919, name: "Timothy Schmidt", phone1: "1234567890", reported_by: 2, requested_at: nil, state: "Florida", status: "Open, unassigned", work_type: "Debris", data: {"email"=>"", "notes"=>"", "habitable"=>"n", "assigned_to"=>"", "electricity"=>"n", "prepared_by"=>"", "rent_or_own"=>"", "unsafe_roof"=>"n", "cross_street"=>"", "status_notes"=>"", "time_to_call"=>"", "older_than_60"=>"n", "other_hazards"=>"", "roof_collapse"=>"n", "special_needs"=>"", "num_trees_down"=>"0", "num_wide_trees"=>"0", "chainsaw_needed"=>"n", "first_responder"=>"n", "autofill_disable"=>"", "electrical_lines"=>"n", "total_volunteers"=>"", "destruction_level"=>"", "meal_location_poc"=>"", "do_not_work_before"=>"", "meal_serving_times"=>"", "structural_problems"=>"n", "required_daily_meals"=>"", "work_without_resident"=>"n", "interior_debris_removal"=>"n", "unsalvageable_structure"=>"n", "heavy_machinary_required"=>"n", "vegitative_debris_removal"=>"n", "hours_worked_per_volunteer"=>"", "initials_of_resident_present"=>"", "nonvegitative_debris_removal"=>"n", "member_of_assessing_organization"=>"n"}, request_date: "2017-09-18", appengine_key: nil, zip_code: "32821", county: "Orange County", phone2: "", work_requested: "", name_metaphone: "TM0 SXMTT", city_metaphone: "ORLNT", county_metaphone: "ORNJ KNT", address_metaphone: " EPKT SNTR TRF", user_id: 2}
|
||||
])
|
||||
User.create!([
|
||||
{email: "${CCLEANUP_ADMIN_EMAIL}", password: "${CCLEANUP_ADMIN_PWD}", name: "${CCLEANUP_ADMIN_USER}", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, legacy_organization_id: 1, current_sign_in_at: "2016-07-15 03:45:59", last_sign_in_at: "2016-06-08 16:56:37", current_sign_in_ip: "1.1.1.1", last_sign_in_ip: "173.164.56.105", referring_user_id: nil, admin: true, role: nil, mobile: nil, accepted_terms: true, accepted_terms_timestamp: "2017-09-18 20:46:31", title: nil}
|
||||
{email: "${CRISISCLEANUP_ADMIN_EMAIL}", password: "${CRISISCLEANUP_ADMIN_PWD}", name: "${CRISISCLEANUP_ADMIN_USER}", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, legacy_organization_id: 1, current_sign_in_at: "2016-07-15 03:45:59", last_sign_in_at: "2016-06-08 16:56:37", current_sign_in_ip: "1.1.1.1", last_sign_in_ip: "173.164.56.105", referring_user_id: nil, admin: true, role: nil, mobile: nil, accepted_terms: true, accepted_terms_timestamp: "2017-09-18 20:46:31", title: nil}
|
||||
])
|
Loading…
Reference in New Issue
Block a user