/ .devcontainer / setup
setup
1 #!/bin/bash 2 3 set -eu 4 echo "Adding upstream" # [for forks] redundant, but harmless, if cloning archivesspace directly 5 git remote -v | grep -w upstream || git remote add upstream https://github.com/archivesspace/archivesspace.git 6 git remote set-url upstream https://github.com/archivesspace/archivesspace.git 7 8 echo "Copying config files" 9 cp .devcontainer/aliases ~/.bash_aliases 10 11 echo "Resetting gems folder permissions" 12 sudo chown vscode build/gems 13 14 echo "Starting MySQL (MariaDB) and Solr" 15 sudo service mariadb start 16 sudo service solr start 17 18 echo "Creating dev & test Solr cores" 19 sudo su - solr -c "/opt/solr/bin/solr create -p 8983 -c asdev -d /workspaces/archivesspace/solr" 20 sudo su - solr -c "/opt/solr/bin/solr create -p 8983 -c astest -d /workspaces/archivesspace/solr" 21 22 echo "Downloading MySQL connector" 23 wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/$MYSQL_CONNECTOR_VERSION/mysql-connector-j-$MYSQL_CONNECTOR_VERSION.jar && mv mysql-connector-j-$MYSQL_CONNECTOR_VERSION.jar ./common/lib/ 24 25 echo "Creating dev & test DB" 26 sudo mysql -u root <<SQL 27 CREATE USER IF NOT EXISTS 'as'@'localhost' IDENTIFIED BY 'as123'; 28 CREATE DATABASE IF NOT EXISTS asdev DEFAULT CHARACTER SET utf8mb4; 29 CREATE DATABASE IF NOT EXISTS astest DEFAULT CHARACTER SET utf8mb4; 30 GRANT ALL PRIVILEGES ON asdev.* to 'as'@'localhost'; 31 GRANT ALL PRIVILEGES ON astest.* to 'as'@'localhost'; 32 SQL 33 34 gzip -dc build/mysql_db_fixtures/accessibility.sql.gz | sudo mysql -u root asdev 35 36 echo "Running bootstrap" 37 ./build/run bootstrap 38 39 echo "Clearing local indexer state" 40 ./build/run solr:reset 41 42 echo "Running database migrations" 43 ./build/run db:migrate 44 45 echo "Installing development tools" 46 sudo gem install --no-document debug rubocop solargraph