SlideShare une entreprise Scribd logo
1  sur  27
CREATING YOUR OWN ATOM DEMO DATA SET
for re-use with Vagrant
What is Vagrant?
Vagrant is a tool for building complete
development environments. With an
easy-to-use workflow and focus on
automation, Vagrant lowers development
environment setup time, increases
development / production parity, and
makes the "works on my machine" excuse
a relic of the past.
Vagrant was started in January 2010 by
Mitchell Hashimoto.
https://www.vagrantup.com/about.html
Vagrant remains and always will be a liberally licensed open
source project. Each release of Vagrant is the work of hundreds
of individuals' contributions to the open source project.
What is VirtualBox?
VirtualBox is an open source, cross-platform
virtualization application.
When we describe VirtualBox as a "virtualization" product, we
refer to "full virtualization", that is, the particular kind of
virtualization that allows an unmodified operating system with
all of its installed software to run in a special environment, on
top of your existing operating system. This environment, called
a "virtual machine", is created by the virtualization software by
intercepting access to certain hardware components and
certain features. The physical computer is then usually called
the "host", while the virtual machine is often called a "guest".
Most of the guest code runs unmodified, directly on the host
computer, and the guest operating system "thinks" it's running
on a real machine.
https://www.virtualbox.org/wiki/Virtualization
The AtoM Vagrant Box
AtoM and all of its
dependencies….
Are packaged as a
Vagrant box…
Which is run by VirtualBox
as a virtual machine…
And accessed via SSH
and/or a web browser.
The AtoM Vagrant Box
The AtoM Vagrant box is an easy way to install
a test instance of AtoM on a local laptop or
personal computer, for testing, development,
and training.
Because the installation environment is
virtualized, you can install and run the AtoM
Vagrant box on almost any local operating
system (e.g. Windows, Mac, Linux, etc).
WARNING: The AtoM Vagrant box is NOT
intended to be used as a production
environment!
AtoM Vagrant Box Installation
Documentation
http://bit.ly/AtoM-Vagrant-docs
Slides
http://bit.ly/AtoM-Vagrant
BUT WE NEED SOME REUSABLE
FOR OUR TEST ENVIRONMENT!
https://pxhere.com/en/photo/1172040
Option 1: Create your own
AtoM Documentation
https://www.accesstomemory.org/docs/latest/
Use the documentation to guide
you as you create new records via
the user interface.
Option 2: Visit some public AtoM sites
AtoM Users
https://wiki.accesstomemory.org/Community/Users
Use the Clipboard and the various
export options to gather some
publicly accessible samples. Check
the AtoM documentation for
export and import instructions.
NOTE: If you intend to use or share this
data publicly, you should contact the site
admins for permission.
AtoM Vagrant database credentials
> nano config/config.php
Use CTRL+X to exit
Default credentials:
• Database name: atom
• Username: atom-user
• Password: ATOMPASSWORD
If you have changed these
defaults or simply want to
check the current credentials,
you will find them listed in
the config/config.php
configuration file.
Back up your database
> mysqldump -u atom-user -pATOMPASSWORD atom > /vagrant/atom2_demo.sql
This will copy the contents of your AtoM MySQL database to a
new database dump, called atom2_demo.sql. The file will be
located in the Vagrant installation directory on your host computer
– that is, the directory where you first ran the vagrant init
command when setting up the AtoM Vagrant box on your local
computer.
Back up your uploads directory
> cp -r /home/vagrant/atom/uploads/ /vagrant/
This will copy the contents of your AtoM uploads directory (digital
object uploads, repository logos and banners) to a new directory
called uploads in the Vagrant installation directory on your local
computer
Deleting your current data
> rm –rf /home/vagrant/atom/uploads
This will purge ALL data in the database, and create a new default
Admin user (username: demo, email: demo@example.com,
password: demo).
> php symfony tools:purge --demo
This will delete everything inside the current uploads directory.
Manually reloading your data
> rsync –av /vagrant/uploads/r /home/vagrant/atom/uploads
This will load the atom2_demo.sql database dump back into
your current AtoM database.
> mysql -u atom-user -pATOMPASSWORD atom < /vagrant/atom2_demo.sql
This will copy the contents of your local uploads directory into
the uploads directory in the AtoM Vagrant box.
Runing maintenance tasks
This will load the atom2_demo.sql database dump back into
your current AtoM database.
> php symfony digitalobject:regen-derivatives
> php symfony search:populate
> sudo systemctl restart php7.0-fpm
> sudo systemctl restart memcached
> sudo systemctl reload nginx
> sudo systemctl restart atom-worker
> php symfony cc
These commands will regenerate the digital object derivatives, re-
populate the search index, restart all services, and clear the
application cache.
https://i.ytimg.com/vi/qJehYddjLJ4/maxresdefault.jpg
Bash scripting to the rescue!
$_
http://onemillionskates.com/inside-edge/a-true-hero-dad-this-ones-for-you
Bash is a Unix shell and command
language written by Brian Fox for
the GNU Project as a free software
replacement for an older
command-line interface called the
Bourne shell. First released in 1989,
it has been distributed widely as
the default login shell for most
Linux distributions and Apple's
macOS (formerly OS X).
Bash scripting to the rescue!
Artefactual has prepared a simple bash script that will purge your current
environment, reload your data, and run the maintenance commands. Get
the script here: http://bit.ly/AtoM-bash
DANGER!!!
This script is provided AS
IS. Artefactual bears no
responsibility for any errors
or unexpected outcomes
caused by this script.
PROCEED AT YOUR OWN RISK
https://steemit.com/health/@kyusho/danger-will-robinson
Setting up the bash script
../atom-vagrant/ ← Wherever you’ve installed Vagrant
├── .vagrant ← The vagrant directory, created during set up
├── atom2_demo.sql ← The AtoM demo data database dump
├── uploads ← The AtoM demo data uploads directory
│ └── r ← Inside the uploads dir, the r dir
├── load-demo.sh ← The bash script
├── Vagrantfile ← The vagrantfile created when you set up Vagrant
Download and unzip the bash script, and place it
in your Vagrant installation directory – AKA
wherever you first ran the vagrant init
command on your local computer. It should be the
same place you now have your database dump
and uploads directory.
Make the script executable
> chmod +x /vagrant/load-demo.sh
This will make the script executable.
chmod is a Unix command used to manage filesystem permissions
– it’s short for “change mode.” The +x tells the filesystem to make
this file executable by all users.
Running the script
> /vagrant/load-demo.sh
Once you execute the script, remember:
• all your previous data will be purged and overwritten!
The script will spit out a bunch of lines as it runs through all of the
commands. Length of time will depend on how much data you have – as an
example, the AtoM public demo data takes about 5 minutes to fully refresh.
That’s it!
What does the script actually do?
php symfony tools:purge --demo
Run the tools:purge command with the demo option. Purge all current data, and create a
new demo user (demo@example.com, p: demo).
rm -rf /home/vagrant/atom/uploads
Recursively delete the current contents of the uploads directory in the AtoM vagrant box.
rsync -av /vagrant/uploads/r /home/vagrant/atom/uploads
Copy the contents of our fresh uploads directory into the AtoM Vagrant box using rsync.
mysql -u atom-user -pATOMPASSWORD -e 'drop database atom; create
database atom character set utf8 collate utf8_unicode_ci;'
Drop and recreate the AtoM database.
What does the script actually do?
mysql -u atom-user -pATOMPASSWORD atom < /vagrant/atom2_demo.sql
Load the AtoM demo database dump into the new AtoM database in Vagrant.
php symfony tools:upgrade-sql -B
Run the sql-upgrade task to make sure that the database schema is up to date.
php symfony digitalobject:regen-derivatives
Regenerate the digital object derivatives from the fresh master digital objects we have loaded.
php symfony search:populate
Repopulate the search index.
What does the script actually do?
sudo systemctl restart php7.0-fpm
Restart PHP-FPM.
sudo systemctl restart memcached
Restart memcached.
sudo systemctl reload nginx
Restart Nginx.
sudo systemctl restart atom-worker
Restart the atom-worker, used by the job scheduler for asynchronous tasks.
php symfony cc
Clear the application cache.
Troubleshooting the script
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace --> FOR DEBUGGING!
The # pound symbol comments out a line
in bash, so it is not executed.
If you uncomment the last line (and make
sure you remove the --> FOR
DEBUGGING! part too!), you can see how
the script runs step by step, which can be
useful for figuring out where something is
going wrong.
Note that in the script on line 6, there is a debug line, currently commented out:
QUESTIONS?
info@artefactual.com

Contenu connexe

Tendances

Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
mohamedmoharam
 
Tomcat Clustering
Tomcat ClusteringTomcat Clustering
Tomcat Clustering
gouthamrv
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
tutorialsruby
 

Tendances (20)

Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
 
Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
 
How to monitor and manage Apache Tomcat
How to monitor and manage Apache TomcatHow to monitor and manage Apache Tomcat
How to monitor and manage Apache Tomcat
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
 
Introduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 PresentationIntroduction to Apache Tomcat 7 Presentation
Introduction to Apache Tomcat 7 Presentation
 
Tomcat tutorail
Tomcat tutorailTomcat tutorail
Tomcat tutorail
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
 
Tomcat
TomcatTomcat
Tomcat
 
Tomcat Clustering
Tomcat ClusteringTomcat Clustering
Tomcat Clustering
 
Getting Started with Docker
Getting Started with Docker Getting Started with Docker
Getting Started with Docker
 
12 Composer #burningkeyboards
12 Composer #burningkeyboards12 Composer #burningkeyboards
12 Composer #burningkeyboards
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Tomcat next
Tomcat nextTomcat next
Tomcat next
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonControlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 

Similaire à Creating your own AtoM demo data set for re-use with Vagrant

BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
moirarandell
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
Puppet
 
How to-simulate-network-devices
How to-simulate-network-devicesHow to-simulate-network-devices
How to-simulate-network-devices
Susant Sahani
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
Ricardo Amaro
 

Similaire à Creating your own AtoM demo data set for re-use with Vagrant (20)

Making environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeMaking environment for_infrastructure_as_code
Making environment for_infrastructure_as_code
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
 
Extracting twitter data using apache flume
Extracting twitter data using apache flumeExtracting twitter data using apache flume
Extracting twitter data using apache flume
 
Security Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-CodeSecurity Testing Using Infrastructure-As-Code
Security Testing Using Infrastructure-As-Code
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Jakarta struts
Jakarta strutsJakarta struts
Jakarta struts
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
Automated Amazon EC2 Cloud deployments with openQRM
Automated Amazon EC2 Cloud deployments with openQRMAutomated Amazon EC2 Cloud deployments with openQRM
Automated Amazon EC2 Cloud deployments with openQRM
 
Orangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User ManualOrangescrum In App Chat Add-on User Manual
Orangescrum In App Chat Add-on User Manual
 
OpenStack Murano introduction
OpenStack Murano introductionOpenStack Murano introduction
OpenStack Murano introduction
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
How to-simulate-network-devices
How to-simulate-network-devicesHow to-simulate-network-devices
How to-simulate-network-devices
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: Vagrant
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with Vagrant
 
Drupalcamp es 2013 drupal with lxc docker and vagrant
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
 
Activemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker dataActivemq installation and master slave setup using shared broker data
Activemq installation and master slave setup using shared broker data
 
Mc sl54 051_ (1)
Mc sl54 051_ (1)Mc sl54 051_ (1)
Mc sl54 051_ (1)
 

Plus de Artefactual Systems - AtoM

Plus de Artefactual Systems - AtoM (20)

CSV import in AtoM
CSV import in AtoMCSV import in AtoM
CSV import in AtoM
 
Things I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchasThings I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchas
 
AtoM Community Update: 2019-05
AtoM Community Update: 2019-05AtoM Community Update: 2019-05
AtoM Community Update: 2019-05
 
Searching in AtoM
Searching in AtoMSearching in AtoM
Searching in AtoM
 
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
 
AtoM Implementations
AtoM ImplementationsAtoM Implementations
AtoM Implementations
 
AtoM Data Migrations
AtoM Data MigrationsAtoM Data Migrations
AtoM Data Migrations
 
Looking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and futureLooking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and future
 
Contributing to the AtoM documentation
Contributing to the AtoM documentationContributing to the AtoM documentation
Contributing to the AtoM documentation
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
AtoM feature development
AtoM feature developmentAtoM feature development
AtoM feature development
 
Constructing SQL queries for AtoM
Constructing SQL queries for AtoMConstructing SQL queries for AtoM
Constructing SQL queries for AtoM
 
Command-Line 101
Command-Line 101Command-Line 101
Command-Line 101
 
An Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsAn Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual Systems
 
National Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshopNational Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshop
 
Introducing Access to Memory
Introducing Access to MemoryIntroducing Access to Memory
Introducing Access to Memory
 
Artefactual and Open Source Development
Artefactual and Open Source DevelopmentArtefactual and Open Source Development
Artefactual and Open Source Development
 
AtoM, Authenticity, and the Chain of Custody
AtoM, Authenticity, and the Chain of CustodyAtoM, Authenticity, and the Chain of Custody
AtoM, Authenticity, and the Chain of Custody
 
Technologie Proche: Imagining the Archival Systems of Tomorrow With the Tools...
Technologie Proche: Imagining the Archival Systems of Tomorrow With the Tools...Technologie Proche: Imagining the Archival Systems of Tomorrow With the Tools...
Technologie Proche: Imagining the Archival Systems of Tomorrow With the Tools...
 
AtoM Community Update 2016
AtoM Community Update 2016AtoM Community Update 2016
AtoM Community Update 2016
 

Dernier

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Dernier (20)

WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 

Creating your own AtoM demo data set for re-use with Vagrant

  • 1. CREATING YOUR OWN ATOM DEMO DATA SET for re-use with Vagrant
  • 2. What is Vagrant? Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development / production parity, and makes the "works on my machine" excuse a relic of the past. Vagrant was started in January 2010 by Mitchell Hashimoto. https://www.vagrantup.com/about.html Vagrant remains and always will be a liberally licensed open source project. Each release of Vagrant is the work of hundreds of individuals' contributions to the open source project.
  • 3. What is VirtualBox? VirtualBox is an open source, cross-platform virtualization application. When we describe VirtualBox as a "virtualization" product, we refer to "full virtualization", that is, the particular kind of virtualization that allows an unmodified operating system with all of its installed software to run in a special environment, on top of your existing operating system. This environment, called a "virtual machine", is created by the virtualization software by intercepting access to certain hardware components and certain features. The physical computer is then usually called the "host", while the virtual machine is often called a "guest". Most of the guest code runs unmodified, directly on the host computer, and the guest operating system "thinks" it's running on a real machine. https://www.virtualbox.org/wiki/Virtualization
  • 4. The AtoM Vagrant Box AtoM and all of its dependencies…. Are packaged as a Vagrant box… Which is run by VirtualBox as a virtual machine… And accessed via SSH and/or a web browser.
  • 5. The AtoM Vagrant Box The AtoM Vagrant box is an easy way to install a test instance of AtoM on a local laptop or personal computer, for testing, development, and training. Because the installation environment is virtualized, you can install and run the AtoM Vagrant box on almost any local operating system (e.g. Windows, Mac, Linux, etc). WARNING: The AtoM Vagrant box is NOT intended to be used as a production environment!
  • 6. AtoM Vagrant Box Installation Documentation http://bit.ly/AtoM-Vagrant-docs Slides http://bit.ly/AtoM-Vagrant
  • 7. BUT WE NEED SOME REUSABLE FOR OUR TEST ENVIRONMENT! https://pxhere.com/en/photo/1172040
  • 8. Option 1: Create your own AtoM Documentation https://www.accesstomemory.org/docs/latest/ Use the documentation to guide you as you create new records via the user interface.
  • 9. Option 2: Visit some public AtoM sites AtoM Users https://wiki.accesstomemory.org/Community/Users Use the Clipboard and the various export options to gather some publicly accessible samples. Check the AtoM documentation for export and import instructions. NOTE: If you intend to use or share this data publicly, you should contact the site admins for permission.
  • 10. AtoM Vagrant database credentials > nano config/config.php Use CTRL+X to exit Default credentials: • Database name: atom • Username: atom-user • Password: ATOMPASSWORD If you have changed these defaults or simply want to check the current credentials, you will find them listed in the config/config.php configuration file.
  • 11. Back up your database > mysqldump -u atom-user -pATOMPASSWORD atom > /vagrant/atom2_demo.sql This will copy the contents of your AtoM MySQL database to a new database dump, called atom2_demo.sql. The file will be located in the Vagrant installation directory on your host computer – that is, the directory where you first ran the vagrant init command when setting up the AtoM Vagrant box on your local computer.
  • 12. Back up your uploads directory > cp -r /home/vagrant/atom/uploads/ /vagrant/ This will copy the contents of your AtoM uploads directory (digital object uploads, repository logos and banners) to a new directory called uploads in the Vagrant installation directory on your local computer
  • 13. Deleting your current data > rm –rf /home/vagrant/atom/uploads This will purge ALL data in the database, and create a new default Admin user (username: demo, email: demo@example.com, password: demo). > php symfony tools:purge --demo This will delete everything inside the current uploads directory.
  • 14. Manually reloading your data > rsync –av /vagrant/uploads/r /home/vagrant/atom/uploads This will load the atom2_demo.sql database dump back into your current AtoM database. > mysql -u atom-user -pATOMPASSWORD atom < /vagrant/atom2_demo.sql This will copy the contents of your local uploads directory into the uploads directory in the AtoM Vagrant box.
  • 15. Runing maintenance tasks This will load the atom2_demo.sql database dump back into your current AtoM database. > php symfony digitalobject:regen-derivatives > php symfony search:populate > sudo systemctl restart php7.0-fpm > sudo systemctl restart memcached > sudo systemctl reload nginx > sudo systemctl restart atom-worker > php symfony cc These commands will regenerate the digital object derivatives, re- populate the search index, restart all services, and clear the application cache.
  • 17. Bash scripting to the rescue! $_ http://onemillionskates.com/inside-edge/a-true-hero-dad-this-ones-for-you Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for an older command-line interface called the Bourne shell. First released in 1989, it has been distributed widely as the default login shell for most Linux distributions and Apple's macOS (formerly OS X).
  • 18. Bash scripting to the rescue! Artefactual has prepared a simple bash script that will purge your current environment, reload your data, and run the maintenance commands. Get the script here: http://bit.ly/AtoM-bash
  • 19. DANGER!!! This script is provided AS IS. Artefactual bears no responsibility for any errors or unexpected outcomes caused by this script. PROCEED AT YOUR OWN RISK https://steemit.com/health/@kyusho/danger-will-robinson
  • 20. Setting up the bash script ../atom-vagrant/ ← Wherever you’ve installed Vagrant ├── .vagrant ← The vagrant directory, created during set up ├── atom2_demo.sql ← The AtoM demo data database dump ├── uploads ← The AtoM demo data uploads directory │ └── r ← Inside the uploads dir, the r dir ├── load-demo.sh ← The bash script ├── Vagrantfile ← The vagrantfile created when you set up Vagrant Download and unzip the bash script, and place it in your Vagrant installation directory – AKA wherever you first ran the vagrant init command on your local computer. It should be the same place you now have your database dump and uploads directory.
  • 21. Make the script executable > chmod +x /vagrant/load-demo.sh This will make the script executable. chmod is a Unix command used to manage filesystem permissions – it’s short for “change mode.” The +x tells the filesystem to make this file executable by all users.
  • 22. Running the script > /vagrant/load-demo.sh Once you execute the script, remember: • all your previous data will be purged and overwritten! The script will spit out a bunch of lines as it runs through all of the commands. Length of time will depend on how much data you have – as an example, the AtoM public demo data takes about 5 minutes to fully refresh. That’s it!
  • 23. What does the script actually do? php symfony tools:purge --demo Run the tools:purge command with the demo option. Purge all current data, and create a new demo user (demo@example.com, p: demo). rm -rf /home/vagrant/atom/uploads Recursively delete the current contents of the uploads directory in the AtoM vagrant box. rsync -av /vagrant/uploads/r /home/vagrant/atom/uploads Copy the contents of our fresh uploads directory into the AtoM Vagrant box using rsync. mysql -u atom-user -pATOMPASSWORD -e 'drop database atom; create database atom character set utf8 collate utf8_unicode_ci;' Drop and recreate the AtoM database.
  • 24. What does the script actually do? mysql -u atom-user -pATOMPASSWORD atom < /vagrant/atom2_demo.sql Load the AtoM demo database dump into the new AtoM database in Vagrant. php symfony tools:upgrade-sql -B Run the sql-upgrade task to make sure that the database schema is up to date. php symfony digitalobject:regen-derivatives Regenerate the digital object derivatives from the fresh master digital objects we have loaded. php symfony search:populate Repopulate the search index.
  • 25. What does the script actually do? sudo systemctl restart php7.0-fpm Restart PHP-FPM. sudo systemctl restart memcached Restart memcached. sudo systemctl reload nginx Restart Nginx. sudo systemctl restart atom-worker Restart the atom-worker, used by the job scheduler for asynchronous tasks. php symfony cc Clear the application cache.
  • 26. Troubleshooting the script set -o errexit set -o nounset set -o pipefail # set -o xtrace --> FOR DEBUGGING! The # pound symbol comments out a line in bash, so it is not executed. If you uncomment the last line (and make sure you remove the --> FOR DEBUGGING! part too!), you can see how the script runs step by step, which can be useful for figuring out where something is going wrong. Note that in the script on line 6, there is a debug line, currently commented out: