Skip to content
Snippets Groups Projects
Commit c92765a1 authored by Janos Bekesi's avatar Janos Bekesi :moyai:
Browse files

added some more stuff

parents 49e20741 5e1b4524
Branches
No related tags found
No related merge requests found
......@@ -31,3 +31,4 @@ db/schema.rb
public/export
public/uploads
coverage/*
dckr-padova/postgresql
\ No newline at end of file
......@@ -71,6 +71,15 @@ where {
}
```
## Re-Sync Triplestore
For MySQL, use:
```
update concepts set rdf_updated_at = NULL where rdf_updated_at IS NOT NULL;
```
And then do a triplestore sync in the admin UI
......
......@@ -59,6 +59,8 @@ class IqTriplestorage2::FusekiAdaptor < IqTriplestorage2::BaseAdaptor2
# only ttl output works this way, nt doesn't
output = []
blanks = []
ntriples.gsub!(/http\:\/\/localhost\:3000\//, Iqvoc.config['site_url'])
Rails.logger.debug("RDF-Sync ntriples: #{ntriples}\n")
ntriples.split("\n").each do |l|
if l.index("_:")
blanks << l
......
......@@ -63,6 +63,21 @@ class RDFSyncService
return !errors
end
def resync
# re-synchronize all of the thesaurus with the triplestore
# comes in handy at development and deployment
#
timestamp = Time.now
errors = false
gather_candidates do |records|
success = sync(records, timestamp)
errors = true unless success
end
return !errors
end
def sync(records, timestamp=nil)
timestamp ||= Time.now
......@@ -121,6 +136,7 @@ class RDFSyncService
# yields batches of candidates for synchronization
def gather_candidates # TODO: rename
Iqvoc::Sync.syncable_classes.each do |klass|
Rails.logger.debug("gather candidates of klass: #{klass}")
self.class.candidates(klass).find_in_batches(batch_size: @batch_size) do |records|
yield records
end
......@@ -129,6 +145,8 @@ class RDFSyncService
# returns one or multiple ActiveRecord::RelationS, depending on whether
# `klass` is provided
## perhaps if we do not use .unsynced, this can be used for the
## re-sync feature (i.e. sync all again)
def self.candidates(klass=nil)
return klass ? klass.published.unsynced :
Iqvoc::Sync.syncable_classes.map { |klass| candidates(klass) }
......
FROM ruby:2.3
RUN apt-get update -y && \
apt-get install -y nodejs vim zip && \
wget https://gitlab.phaidra.org/bekesij9/iqvoc/-/archive/v4.12.2/iqvoc-v4.12.2.zip && \
unzip iqvoc-v4.12.2.zip && \
cd /iqvoc-v4.12.2 && \
bundle install && \
cp config/database.yml.sqlite config/database.yml && \
bundle exec rake db:create && \
rake db:migrate && \
rake db:seed
EXPOSE 3000
WORKDIR /iqvoc-v4.12.2
# the server is the rails built-in "brick" server, not a production server
# which would be "passenger"
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
\ No newline at end of file
# Docker config
Docker config for working with rails sources: quick setup for development
No hassle with db
**ATTN**:
* when mounting /db, bear in mind that this dir holds `migrate` and `seed` data
\ No newline at end of file
version: '3'
services:
web:
build:
dockerfile: Dockerfile
context: .
ports:
- "${EXTERNAL_PORT}:3000"
volumes:
- ${BASE}/app:/iqvoc-v4.12.2/app
- ${BASE}/lib:/iqvoc-v4.12.2/lib
- ${BASE}/log2:/iqvoc-v4.12.2/log
- ${BASE}/db2:/iqvoc-v4.12.2/db
- ${BASE}/config:/iqvoc-v4.12.2/config
environment:
RAILS_ENV: ${RAILS_ENV}
PORT: 3000
DB_HOST: db
DB_NAME: iqvoc_production
DB_USER: iqvoc
DB_PW: iqvoc
SECRET_KEY_BASE: ${SECRET_KEY_BASE}
depends_on:
- fuseki
fuseki:
image: stain/jena-fuseki
volumes:
- ${BASE}/fuseki:/fuseki
- ${BASE}/fuseki-staging:/staging
ports:
- "127.0.0.1:${FUSEKI_EXTERNAL_PORT}:3030"
environment:
ADMIN_PASSWORD: ${FUSEKI_ADMIN_PASSWORD}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment