Commit 01df942f authored by Aral Balkan's avatar Aral Balkan
Browse files

Now setting up the git account, cloning the data for site repository and...

Now setting up the git account, cloning the data for site repository and cloning the working copy to be served by nginx. Alterned the clone path for the working copy to be in the ubuntu home folder.
parent 98f9d2ed
[user]
name = {GIT_ACCOUNT_NAME}
email = {GIT_ACCOUNT_EMAIL}
......@@ -76,7 +76,7 @@ echo -e "1. Configuration options (all defaults are for better.fyi).\n"
# Note: defaults are Bash 3-compatible on purpose.
#
# The server names
# The server names to use in /etc/nginx/sites-available/(http.conf|https.conf)
#
# In your DNS configuration, create an A record (IP address) for www.better.fyi
# and an alias (A record; IP address) to point to www.better.fyi.
......@@ -84,10 +84,66 @@ echo -e "1. Configuration options (all defaults are for better.fyi).\n"
read -e -p " Server names (better.fyi www.better.fyi): " serverNames
serverNames=${serverNames:-better.fyi www.better.fyi}
# Better generated data repository URL
read -e -p " Better generated site data Git repository domain (data.better.fyi): "
generatedSiteDataGitRepositoryDomain=${generatedSiteDataGitRepositoryDomain:-data.better.fyi}
read -e -p " Better generated site data Git account name (generated): "
generatedSiteDataGitAccountName=${generatedSiteDataGitAccountName:-generated}
generatedSiteDataCloneURL="git@${generatedSiteDataGitRepositoryDomain}:${generatedSiteDataGitAccountName}/site.git"
# Git account name to use in ~/.gitconfig
read -e -p " Git account name (Better): " gitAccountName
serverNames=${serverNames:-better.fyi www.better.fyi}
gitAccountName=${gitAccountName:-Better}
# Git account email to use in ~/.gitconfig
read -e -p " Git account email (hello+better+site@ind.ie): " serverNames
serverNames=${serverNames:-better.fyi www.better.fyi}
read -e -p " Git account email (hello+better+site@ind.ie): " gitAccountEmail
gitAccountEmail=${gitAccountEmail:-hello+better+site@ind.ie}
# Get the public key (This is used by the Builder to push updates to the site.)
read -e -p " Public key (default is better.fyi’s): " publicKey
publicKey=${publicKey:-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCoeMcQpU1XaSkv9AZtvUOg0bYEoRXTQ4MREGXoAZCR0pFWfzbzG0+av6WyNulu+MU5JF87u3YnwAAB6FB92mMbRS1xMtuV0Bu5TwPj5MjUqbznm8Sd+XO7A37g0oBPWrCKe24G+dGAmRVHZjT9qisTQhKpbEW1TxdvbNxDYALTzBuUFmhCJnMYorTpOVXL0SkUX89AkoVXdjVCq55sf3MGG+AN9OomSvveZ8tK0FwGOlT9w5niNktBfVicNpQFpURSbKFCqjZp7qkDLDRebKI1grgDUELhQWYj32vNkMX3lzqC/AIqwVkEO11Y9DSalray4f7O9X9YR3hB1MPRcBSw6DD36lCtVA6cASGdzvxDMX1f7gFoq22gfGJMVVYn+uHClrlrTiXl+ueZr3+DgC2Zc+/pWhqBsJ7NdxeWRYQWVmrOAPWLthxoPKxnlgbuRR9xBugWB+F73ipNZ5/iS6/eYoqmvaC07Uta6vXoYxncSxZR2GBrE1sI0eQKtbWZKP0w6Rb44QglX+atwxNLo5CcTHqJw5OkOJf1imeh4vfQSnENkjAK72iM/mgGzBY/AfIBxUswY+L9hEFxhfbH72WVO75G1k3mqB52wdj4Sjjz8kGDpppz9LNGIBeuSmrgJl0e05F4Vw9hz2vhg4i2pFwSlGZFx/J1WfI3ZH5YicIPJQ== hello+blockdown_builder@ind.ie}
#
# Prompt for the secrets
#
echo -e "\n2. Secrets\n"
echo " Private key (paste and press return): "
privateKey=$(sed '/^$/q')
echo -e "Thank you, I have all the information I need to set up the Better web site.\n"
echo -e "Configuring the Better web site…\n"
#
#
#
echo -e "Setting up the git account…"
# Create the git account
sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git
# Configure the git account
#sudo -u git git config --global user.name ${gitAccountName}
#sudo -u git git config --global user.email ${gitAccountEmail}
# Save the SSH keys
sudo -u git mkdir /home/git/.ssh
sudo -u git bash -c "echo \"$publicKey\" > /home/git/.ssh/id_rsa.pub"
sudo -u git bash -c "echo \"$privateKey\" > /home/git/.ssh/id_rsa"
# Restrict the permissions on the private ssh key
sudo -u git chmod 600 /home/git/.ssh/id_rsa
# Create the repo
# TODO: Do you get the authenticity warning for actual Let’s Encrypt URLs also?
#  * Generate actual cert for data.better.fyi and try again.
sudo -u git git clone --bare "${generatedSiteDataCloneURL}" /home/git/data.git
# Check out the working copy to be served by nginx.
sudo git clone /home/git/data.git /home/ubuntu/site
......@@ -9,7 +9,7 @@ server {
ssl_certificate_key /srv/letsencrypt/certs/better.fyi/privkey.pem;
# Serve the site from the git repository.
root /home/git/site/;
root /home/ubuntu/site/;
index index.html index.htm;
# Make site accessible from http://localhost/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment