-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
194 additions
and
87 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
#!/bin/bash | ||
set -e | ||
echo "Creating DB" | ||
psql <<- EOSQL | ||
CREATE USER aardwolf_user; | ||
CREATE DATABASE aardwolf; | ||
GRANT ALL PRIVILEGES ON DATABASE aardwolf_user TO aardwolf; | ||
EOSQL | ||
echo "Done Creating DB" | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
# First we should go home | ||
cd ~/ | ||
|
||
# Add PostgreSQL's repository to your system: | ||
echo "Adding PostgreSQL's repository to your system..." | ||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | ||
|
||
# Import the repository signing key: | ||
echo "Importing the PostgreSQL's repository signing key..." | ||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | ||
|
||
# Update the package lists: | ||
echo "Updating package lists..." | ||
sudo apt update | ||
|
||
# Install Rust build tools and dependencies: | ||
echo "Installing development tools and dependencies..." | ||
sudo apt install -y build-essential libssl-dev pkg-config gettext gcc g++ curl git | ||
|
||
# Install PostgreSQL: | ||
echo "Installing PostgreSQL..." | ||
sudo apt install postgresql libpq-dev | ||
|
||
# Install Rust: | ||
echo "Installing Rust..." | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
# Install Rust toolchain: | ||
echo "Installing Rust stable toolchain..." | ||
rustup install stable | ||
|
||
# Install Rust tools: | ||
echo "Installing Rust tools..." | ||
rustup component add rustfmt clippy cargo-watch | ||
cargo install diesel_cli --no-default-features --features "postgres" | ||
|
||
# Setup PostgreSQL | ||
echo "Setting up PostgreSQL..." | ||
sudo systemctl enable postgresql.service | ||
sudo systemctl start postgresql.service | ||
|
||
# Create the aardwolf database | ||
DB_NAME=aardwolf | ||
DB_USER=aardwolf_user | ||
DB_PASS=changeme | ||
|
||
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" | ||
sudo -u postgres psql -c "CREATE DATABASE ${DB_NAME}_testing;" | ||
sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" | ||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE aardwolf TO aardwolf_user;" | ||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE aardwolf_testing TO aardwolf_user;" | ||
|
||
# Set up environment variables for database URLs | ||
echo "Setting up environment variables..." | ||
echo "DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf" > ~/aardwolf/.env | ||
echo "TEST_DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" >> ~/aardwolf/.env | ||
|
||
# Setup aardwolf | ||
echo "Setting up aardwolf..." | ||
cargo run --bin setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# Update the package lists: | ||
echo "Updating package lists..." | ||
brew update | ||
|
||
# Install PostgreSQL: | ||
echo "Installing PostgreSQL..." | ||
brew install postgres | ||
|
||
# Start PostgreSQL, and create default user: | ||
brew service start postgresql@15 | ||
/usr/local/opt/postgresql@15/bin/createuser -s postgres | ||
|
||
# Install Rust: | ||
echo "Installing Rust..." | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
# Install Rust toolchain: | ||
echo "Installing Rust stable toolchain..." | ||
rustup install stable | ||
|
||
# Set RUSTFLAGS to point linker to libpq | ||
echo "Setting RUSTFLAGS for libpq..." | ||
brew link postgresql@15 | ||
export RUSTFLAGS="-L/usr/local/opt/postgresql@15/lib" | ||
|
||
# Install Rust tools: | ||
echo "Installing Rust tools..." | ||
rustup component add rustfmt clippy | ||
cargo instal diesel_cli --no-default-features --features "postgres" | ||
|
||
# Create the aardwolf database | ||
echo "Creating the aardwolf database..." | ||
DB_NAME=aardwolf | ||
DB_USER=aardwolf_user | ||
DB_PASS=changeme | ||
|
||
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" | ||
sudo -u postgres psql -c "CREATE DATABASE ${DB_NAME}_testing;" | ||
sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" | ||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE aardwolf_testing TO aardwolf_user;" | ||
|
||
# Set up environment variables for database URLs | ||
echo "Setting up environment variables..." | ||
echo "DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf" > ~/aardwolf/.env | ||
echo "TEST_DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" >> ~/aardwolf/.env | ||
|
||
# Setup aardwolf | ||
echo "Setting up aardwolf..." | ||
cargo run --bin setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.