-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AlanD20/develop
Update website content
- Loading branch information
Showing
16 changed files
with
274 additions
and
165 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ [email protected] | |
|
||
ABSTRACT_API_KEY= | ||
|
||
DATABASE_URL=file:./db.sqlite | ||
DATABASE_URL=file:./primsa/db.sqlite | ||
|
||
GITHUB_ID= | ||
GITHUB_SECRET= | ||
|
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,73 +1,68 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
USER= | ||
SCRIPT_PATH= | ||
BASE_PATH= | ||
user=$1 | ||
backup_path=$2 | ||
project_path=$3 | ||
|
||
if [[ $user == "" || $backup_path == "" || $project_path == "" ]]; then | ||
echo "- [x] Args are required: (1) user (2) absolute script path (3) absolute project path" | ||
exit 1 | ||
fi | ||
|
||
# Find bin directory path for global npm packages using 'npm config get prefix' | ||
PATH=$PATH:/home/$USER/.nvm/versions/node/lts/bin | ||
|
||
# Stop portfolio service | ||
pm2 delete nextjs-portfolio && pm2 save -f | ||
|
||
# Copy database file if exists | ||
if [ -f "$BASE_PATH/prisma/db.sqlite" ]; then | ||
cp -f "$BASE_PATH/prisma/db.sqlite" "$SCRIPT_PATH/db.sqlite" | ||
if $?; then | ||
echo "- [x] unable to delete existing project from pm2 list" | ||
exit 1 | ||
fi | ||
|
||
# Copy .env file if exists | ||
if [ -f "$BASE_PATH/.env" ]; then | ||
cp -f "$BASE_PATH/.env" "$SCRIPT_PATH/.env" | ||
fi | ||
files_need_backup=( | ||
"prisma/db.sqlite" # current database | ||
".env" # .env file | ||
"src/config/app.ts" # app configuration | ||
) | ||
|
||
# Copy config app file if exists | ||
if [ -f "$BASE_PATH/src/config/app.ts" ]; then | ||
cp -f "$BASE_PATH/src/config/app.ts" "$SCRIPT_PATH/app.ts" | ||
fi | ||
# Take backups | ||
for file in "${files_need_backup[@]}"; do | ||
if [ -f "$project_path/$file" ]; then | ||
filename=$(basename "$file") | ||
cp -f "$project_path/$file" "$backup_path/$filename" | ||
fi | ||
done | ||
|
||
# Remove Everything in base path | ||
rm -rf $BASE_PATH/* $BASE_PATH/.* | ||
rm -rf "$project_path" | ||
|
||
# Clone Repository | ||
git clone https://github.com/AlanD20/aland20.com.git "$BASE_PATH/." | ||
git clone ssh://git@github.com:AlanD20/aland20.com.git "$project_path/." | ||
|
||
# Recover .env file if exists | ||
if [ -f "$SCRIPT_PATH/.env" ]; then | ||
cp -f "$SCRIPT_PATH/.env" "$BASE_PATH/.env" | ||
if [ -f "$backup_path/.env" ]; then | ||
cp -f "$backup_path/.env" "$project_path/.env" | ||
fi | ||
|
||
# Install dependencies | ||
cd "$BASE_PATH" && yarn && yarn db:reset | ||
# Recover Backups | ||
for file in "${files_need_backup[@]}"; do | ||
filename=$(basename "$file") | ||
if [ -f "$backup_path/$filename" ]; then | ||
cp -f "$backup_path/$filename" "$project_path/$file" | ||
echo "- [x] Successful restore: $file" | ||
continue | ||
fi | ||
|
||
# Recover Config file if exists | ||
if [ -f "$SCRIPT_PATH/app.ts" ]; then | ||
cp -f "$SCRIPT_PATH/app.ts" "$BASE_PATH/src/config/app.ts" | ||
fi | ||
echo "- [x] Failed to restore: $file" | ||
done | ||
|
||
# Recover database if exists | ||
if [ -f "$SCRIPT_PATH/db.sqlite" ]; then | ||
cp -f "$SCRIPT_PATH/db.sqlite" "$BASE_PATH/prisma/db.sqlite" | ||
fi | ||
|
||
# Check Setup Process | ||
if [ -f "$BASE_PATH/.env" ]; then | ||
echo "- [x] Env file copied!" | ||
else | ||
echo "- [x] Failed to copy env file!" | ||
fi | ||
|
||
if [ -f "$BASE_PATH/prisma/db.sqlite" ]; then | ||
echo "- [x] Database restored!" | ||
else | ||
echo "- [x] Failed to restore database!" | ||
fi | ||
# Install dependencies | ||
cd "$project_path" && pnpm && pnpm db:push && pnpm build && pnpm pm2 && pm2 save -f | ||
|
||
if grep -Fq "https://aland20.com" "$BASE_PATH/src/config/app.ts"; then | ||
echo "- [x] Config file updated!" | ||
else | ||
echo "- [x] Failed to update config file!" | ||
if $?; then | ||
echo "- [x] Failed to build project" | ||
exit 1 | ||
fi | ||
|
||
cd "$BASE_PATH" && yarn build && yarn pm2 && pm2 save -f | ||
|
||
echo "- [x] Deployment Successsful!" | ||
echo "- [x] Deployment successful!" |
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 |
---|---|---|
|
@@ -19,6 +19,11 @@ const ContactPage: NextPage = () => ( | |
<span className="marker"> [email protected]</span>. Or, you can submit the | ||
following form to send me an email. | ||
</p> | ||
<p> | ||
<span className="marker">Note:</span> The form might be disabled because I | ||
dont like to configure SMTP server. In this case, send me an email | ||
directly. | ||
</p> | ||
|
||
<ContactForm /> | ||
</main> | ||
|
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
Oops, something went wrong.