-
Notifications
You must be signed in to change notification settings - Fork 1
Deployment Documents for April 2023
Janell Huyck edited this page Apr 4, 2024
·
4 revisions
- Confirm in Github that the old "main" branch has been copied over to a new branch "rollback_main".
- Confirm in Github that the "deploy" branch has been copied over to "main".
- SSH into the production server. Navigate to
/etc/postfix/
and make a copy of the main.cf file. - Next, navigate to
/etc/systemd/system/
and make a copy of the postfix.service file.
- Navigate to
/opt/webapps/aaec/static
. - Open the environment variables file with
nano .env.production.local
. - Add the following to the "mail variables" section:
MAIL_SMTP_ADDRESS='libapps.libraries.uc.edu'
- Save and exit nano by pressing Control-X, then Y to confirm the changes, and Enter to close the editor.
- Find out the IP address for the server by typing in
ifconfig
and note down the IP address. - Navigate to
/etc/postfix
and open main.cf with nano by typingsudo nano main.cf
. - Inside the main.cf file, scroll down several pages to find the line that says
inet_interfaces = localhost
. - Change it to
inet_interfaces = 127.0.0.1, ::1, our.ip.address.here
, replacing "our.ip.address.here" with the IP address noted earlier. - Save and exit nano by pressing Control-X, then Y to confirm the changes, and Enter to close the editor.
- Restart postfix with the command:
sudo systemctl restart postfix
. - Ensure aaec will restart on reboot with the following command:
sudo systemctl enable puma-aaec
. - Copy the postfix.service file from
/lib/systemd/system/postfix.service
to/etc/systemd/system/postfix.service
. Leave the old file in place. You can do this with the command:sudo cp /lib/systemd/system/postfix.service /etc/systemd/system/postfix.service
- Change directory to
/etc/systemd/system
and open the file postfix.service with nano (nano postfix.service
) - Change the line
After=syslog.target network.target
to the following two lines:After=syslog.target network-online.target
Wants=network-online.target
- Reload the postfix settings with the command:
sudo systemctl daemon-reload
. - Restart postfix with
sudo systemctl restart postfix
.
- Ensure that other applications running on libapps can still send mail.
- Test this by going to https://libapps.libraries.uc.edu/application_portfolio/users/sign_in and initiating a password reset for Janell's account. This will send her an email, confirming that the mailing capability is functioning as expected.
- Make sure you're using your local terminal, not the SSH terminal.
- From the AAEC project, make sure you are on the branch "main".
- Do a
git pull
to verify you have the most recent version of the branch. - Execute the command
cap production deploy
. This command will deploy the application, restart the server, and run migrations. - We do not need to run the seeds command because the database is already seeded.
- Check the application logs for any immediate errors during startup:
tail -f log/production.log
. - Access the application through http://libapps.libraries.uc.edu/aaec to ensure it's running as expected.
- We should only be able to see the page that states that the time for submissions has passed.
- Perform manual testing by:
- Set the expiration date to something in the future by:
- From the ssh terminal, navigate to
/opt/webapps/aaec/static
. - Open the .env file with
nano .env.production.local
. - Change the line
EXPIRATION_DATE="Jul 15 2020"
to some date in the future. - Save and exit the file
- From the ssh terminal, navigate to
- Restart the server with
sudo systemctl restart puma-aaec
. - Run through the manual testing script found at https://github.com/uclibs/aaec/wiki/Manual-Testing.
- Test the email functionality by entering Janell as a submitter with her correct UC email address, make a submission, and look for an email.
- If everything checks out, return the expiration date to its original value:
- From the ssh terminal, navigate to
/opt/webapps/aaec/static
. - Open the .env file with
nano .env.production.local
. - Change the line back to
EXPIRATION_DATE="Jul 15 2020"
. - Save and exit the file
- From the ssh terminal, navigate to
- Restart the server with
sudo systemctl restart puma-aaec
.
- Set the expiration date to something in the future by:
- Try restarting the puma with
sudo systemctl restart puma-aaec
.
- Deploy the application to our QA server
- Set the mailer config options as done in the Implementation section, only on the libappstest server.
- Ensure all tests are passing
- The libappstest server has an expiration date in the future, so no .env file changes are needed.
- Test using the manual testing script at https://github.com/uclibs/aaec/wiki/Manual-Testing.
- Enter Janell as a submitter with her correct UC email address, make a submission, and look for an email.
- Navigate to
/opt/webapps/aaec/static
. - Open the environment variables file with
nano .env.production.local
. - Remove the following from the "mail variables" section:
MAIL_SMTP_ADDRESS='libapps.libraries.uc.edu'
- Save and exit nano by pressing Control-X, then Y to confirm the changes, and Enter to close the editor.
- Navigate to
/etc/postfix
and open main.cf with nano by typingsudo nano main.cf
. - Inside the main.cf file, scroll down several pages to find the line that says
inet_interfaces = 127.0.0.1, ::1, our.ip.address.here
. - Change it to
inet_interfaces = localhost
. - Save and exit nano by pressing Control-X, then Y to confirm the changes, and Enter to close the editor.
- Restart postfix with the command:
sudo systemctl restart postfix
. - Ensure aaec will restart on reboot with the following command:
sudo systemctl enable puma-aaec
. - Remove the duplicated postfix.service file
/etc/systemd/system/postfix.service
.- Navigate to /etc/systemd/system/ --IMPORTANT--
- Remove the file with
sudo rm postfix.service
. - Do not touch the original postfix.service file at
/lib/systemd/system/postfix.service
- Reload the postfix settings with the command:
sudo systemctl daemon-reload
. - Restart postfix with
sudo systemctl restart postfix
.
- Ensure that other applications running on libapps can still send mail.
- Test this by going to https://libapps.libraries.uc.edu/application_portfolio/users/sign_in and initiating a password reset for Janell's account. This will send her an email, confirming that the mailing capability is functioning as expected.
- Make sure you're using your local terminal, not the SSH terminal.
- From the AAEC project, make sure you are on the branch "rollback_main".
- Do a
git pull
to verify you have the most recent version of the branch. - Execute the command
cap production deploy
. This command will deploy the application, restart the server, and run migrations. - We do not need to run any more migrations at this point because the original migrations will be in place.
At this point, we should only be able to see the page that states that the time for submissions has passed. No errors should be present in the web console. If we manually type in the URL libapps.libraries.uc.edu/aaec/manage, we will get the admin login page. We will be able to log in with the admin name and password, located at https://github.com/uclibs/config_vault/blob/main/aaec/libapps-.env.production.local. From there we should be able to access older publications and user information. There is not currently a manual testing script for the old deployed version.