The console commands below assume you are developing on a Debian-based Linux system and were tested with Ubuntu 22.04.1; modify to suit your particular setup.
To run this code, you will need:
sudo apt -y install curl
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt update
sudo apt -y install git nodejs mysql-server
git clone https://github.com/agolden/cck-volunteer-web-app
cd cck-volunteer-web-app
npm install
We suggest installing and using Chromium as your principal browser for development purposes.
sudo apt install -y chromium-browser
We suggest installing and using Visual Studio Code as your integrated development environment (IDE).
To successfully run this application, you must set several environment variables.
The .env.local file must be present in the root of the directory. You can use the example environment variables file as a starting point:
cp example.env.local .env.local
ln -s .env.local .env
In this file, there are several default variables that may be changed (and several others that may be added):
A series of (optional) scripts are provided that will simplify the process of setting up your local development environment. Execute them in the following sequence:
A script has been provided to randomly generate passwords for your .env.local file:
./scripts/generate-passwords.sh
A script has been provided to update the database's root user's password from the .env.local file:
sudo ./scripts/update-master-db-password.sh
A script has been provided to create the application's database and database user:
./scripts/create-db.sh
The package.json defines a number of scripts for use in development:
Run the scripts as follows:
npm run <<script>>
For example:
npm run update-schema
The AWS cloudformation stack can be created / updated / deleted using the AWS CLI, for example:
aws cloudformation create-stack --stack-name my-awesome-stack-name --template-body file://aws/aws-cloudformation.yml --capabilities CAPABILITY_NAMED_IAM
aws cloudformation update-stack --stack-name my-awesome-stack-name --template-body file://aws/aws-cloudformation.yml --capabilities CAPABILITY_NAMED_IAM
aws cloudformation delete-stack --stack-name my-awesome-stack-name
Once the stack has been successfully deployed, the relevant secrets can be retrieved as follows:
aws secretsmanager get-secret-value --secret-id aws-arn:aws:secretsmanager:eu-west-2:myaccountid:secret:my-credential-id
Here is an example of backing up the contents of the MySQL server:
mysqldump -h "myawesome.database.instance.com" --all-databases --triggers --routines --events --user=admin -p > dump.sql