Skip to content

Commit

Permalink
Merge pull request #1 from AlanD20/develop
Browse files Browse the repository at this point in the history
Update website content
  • Loading branch information
AlanD20 authored Oct 12, 2024
2 parents d198a1d + ccbf205 commit 8cb9a40
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ [email protected]

ABSTRACT_API_KEY=

DATABASE_URL=file:./db.sqlite
DATABASE_URL=file:./primsa/db.sqlite

GITHUB_ID=
GITHUB_SECRET=
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@ jobs:
lint-build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
node-version: "16"
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- uses: actions/checkout@v3
- name: Create env file
run: cp .env.example .env
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Build CSS
run: yarn css:prod
run: pnpm css:prod
- name: Run nextjs lint
run: yarn lint
run: pnpm lint
- name: Run eslint
run: yarn eslint
run: pnpm eslint
- name: Build project
run: yarn build
run: pnpm build
# deploy:
# needs: [ "lint-build" ]
# runs-on: ubuntu-latest
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### AlanD20 Portfolio

---
Dynamic porfolio with support for admin dashboard to control the website.
Dynamic portfolio with support for admin dashboard to control the website.

To access the dashboard with the features, you must be authorized. Otherwise, you'll be redirected to the main page by taking advantage of Nextjs v12 middlewares.

Expand All @@ -23,13 +23,13 @@ To access the dashboard with the features, you must be authorized. Otherwise, yo
1. Install the packages

```bash
yarn install
pnpm install
```

2. You may generate a secret key for `NEXTAUTH_SECRET` environment variable using the following command. But, make sure you have installed `openssl`.

```bash
yarn generate:secret
pnpm generate:secret
```

3. The following files must be changed during deployment in production:
Expand All @@ -40,19 +40,19 @@ To access the dashboard with the features, you must be authorized. Otherwise, yo
4. Generate the database schema with default seeding

```bash
yarn db:reset
pnpm db:reset
```

5. Finally, build the project and start pm2 config.

```bash
yarn build && yarn pm2
pnpm build && pnpm pm2
```

- For adding new changes, build the project and restart pm2 by passing our application name which we set in `pm2.json` file.

```bash
yarn build && pm2 restart nextjs-portfolio
pnpm build && pm2 restart nextjs-portfolio
```

---
Expand All @@ -62,14 +62,14 @@ To access the dashboard with the features, you must be authorized. Otherwise, yo
1. Install packages

```bash
yarn install
pnpm install
```

2. Define environment variables in .env file with your local environment. You can use .env.sample as a starting point
3. Run the dev server

```bash
yarn dev
pnpm dev
```

4. And everything should work :) Don't forget to checkout [src/config](/src/config/) directory to configure the app.
Expand All @@ -81,35 +81,35 @@ To access the dashboard with the features, you must be authorized. Otherwise, yo
- postcss commands.
```bash
yarn css:dev # Watch for changes during css files for development
yarn css:prod # build minified css files for production
pnpm css:dev # Watch for changes during css files for development
pnpm css:prod # build minified css files for production
```
- Any changes in Prisma schema, you must push it to the database and generate the `prisma/client` file. The following command does both job at once.
```bash
yarn db:push
pnpm db:push
```
- Prisma commands.
```bash
yarn db:reset # Create + Seed with base data
yarn db:push # Create only
yarn db:seed # Seed only
yarn prisma:studio # Start Prisma studio server
pnpm db:reset # Create + Seed with base data
pnpm db:push # Create only
pnpm db:seed # Seed only
pnpm prisma:studio # Start Prisma studio server
```
- You may want to manually run prettier format.
```bash
yarn format
pnpm format
```
- You may want to generate a secret key for *NEXTAUTH_URL*. You need openssl installed on the machine.
```bash
yarn generate:secret
pnpm generate:secret
```
---
Expand Down
93 changes: 44 additions & 49 deletions deploy.sh
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!"
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"author": "AlanD20",
"name": "aland20-portfolio",
"description": "Dyanamic portfolio",
"description": "dynamic portfolio",
"license": "GPL",
"version": "2.2.3",
"version": "2.3.0",
"private": true,
"scripts": {
"dev": "yarn css:prod && next dev",
"build": "yarn css:prod && next build",
"dev": "pnpm css:prod && next dev",
"build": "pnpm css:prod && next build",
"start": "next start",
"lint": "next lint",
"eslint": "eslint pages src",
Expand All @@ -18,10 +18,10 @@
"prisma:studio": "prisma studio",
"db:push": "prisma db push --force-reset && prisma generate",
"db:seed": "prisma db seed",
"db:reset": "yarn db:push && yarn db:seed",
"db:reset": "pnpm db:push && pnpm db:seed",
"generate:secret": "openssl rand -base64 32",
"pm2": "pm2 start pm2.json",
"deploy": "yarn db:reset && yarn build"
"vercel:deploy": "pnpm db:reset && pnpm build"
},
"dependencies": {
"@next-auth/prisma-adapter": "^1.0.7",
Expand Down Expand Up @@ -73,4 +73,4 @@
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
}
}
}
5 changes: 5 additions & 0 deletions pages/contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions pages/faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const FaqPage: NextPage<Props> = ({ faqs }: Props) => (
are the reasons behind my choices. So, let me know if you have any other
questions. I will try to add new ones in the future.
</p>
<p>
You can always try running this website locally and checkout the source
code in the github repository.
</p>

<div className="list w-full">
{faqs.length > 0 ? (
Expand Down
39 changes: 27 additions & 12 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,43 @@ type Props = {

const HomePage: NextPage<Props> = ({ skills }: Props) => (
<main className="page about">
<h2 className="title">Welcome to my portfolio!</h2>
<h2 className="title">Welcome to my personal website!</h2>

<p>
Hey! I&apos;m Aland, working as a software engineer. I obtained my
bachelor of computer engineering degree in Warsaw, Poland in 2023. This is
my personal website where I will showcase my projects and other stuffs
that I work on.
Hey! I&apos;m Aland, working as a software Engineer and Cloud
Infrastructure Engineer. I obtained my bachelor of computer engineering
degree in Warsaw, Poland in 2023. This is my personal website where you
can find my experience, projects, and probably more stuff.
</p>
<p>
Here is a list of technologies I have tried. The list will be updated when
I use any new technologies in my projects or any project I work on.
Although, it may not be up to date with everything I use, but I try my
best to keep them up to date so that in the future, each tech will be
linked to its own projects.
I have experience in leading many complex integration projects that
require leading, designing, implementation decisions for scalability,
maintenance, monitoring, logging, and communication with many teams to
make this integration workflow across multiple products into existence. In
Cloud Infrastructure side, I worked on maintenance, reliability, CI, CD,
monitoring, and logging of the infrastructure. I have been getting into a
lot of enterprise level services particularly with AWS services and
microservice architecture with Event-Driven and Queue System Design.
</p>
<p>
- Experienced in application and web development.
- Experienced in Software Development and led many projects from design to
deployment.
<span className="block">
- Understanding the fundamental of data structure & Algorithms.
</span>
<span className="block">
- Knowledge of Security, Protection, Networking, Database.
- Decently deep understanding of relational databases.
</span>
<span className="block">
- Knowledge of Security, Protection, Networking in advanced level.
</span>
<span className="block">
- Understanding of many scalable architecture such as Event-Driven,
Queue System, monolithic, and microservices.
</span>
<span className="block">
- Understanding of monitoring and logging such as OpenSearch setup,
FilaBeat, Grafana, Prometheus.
</span>
</p>

Expand Down
Loading

0 comments on commit 8cb9a40

Please sign in to comment.