Skip to content

Commit 1e9d0be

Browse files
committed
Merge branch 'nextjs'
2 parents 7fc844f + bb5c7e3 commit 1e9d0be

File tree

106 files changed

+54730
-710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+54730
-710
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
media
2+
node_modules
3+
.*

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Added by Payload
2+
PAYLOAD_SECRET=513c714ef3966627b7e09ad9
3+
DATABASE_URI=file:./vector-portfolio.db

.github/workflows/deploy.yml

Lines changed: 36 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,26 @@ jobs:
2525
uses: actions/checkout@v4
2626
with:
2727
repository: Maypher/Vector-Interior-Design
28-
ref: "development"
28+
ref: "nextjs"
2929
token: "${{ secrets.GITHUB_PAT }}"
3030
- name: Checkout
3131
if: ${{ !env.ACT }}
3232
uses: actions/checkout@v4
3333
- name: Setup ssh key
3434
run: |
35+
ssh_key="${{ secrets.ssh_key }}"
3536
set -e
3637
mkdir -p ~/.ssh
37-
echo "${{ secrets.ssh_key }}" > ~/.ssh/id_rsa
38+
echo "$ssh_key" > ~/.ssh/id_rsa
3839
chmod 600 ~/.ssh/id_rsa
3940
ip=$(echo "${{ secrets.ssh_connection }}" | cut -d'@' -f2)
4041
ssh-keyscan -H "$ip" >> ~/.ssh/known_hosts
4142
- name: Make directories
4243
run: |
4344
ssh -i ~/.ssh/id_rsa ${{ secrets.ssh_connection }} "
4445
set -e
45-
mkdir -p /vectorapp/
46-
cd /vectorapp
47-
mkdir -p app
46+
mkdir -p ~/vectorapp/vector-portfolio
4847
"
49-
- name: "Install htpasswd"
50-
if: ${{ !env.ACT }}
51-
run: sudo apt-get update && sudo apt-get -y install apache2-utils
5248
- name: Install dependencies locally
5349
if: ${{ env.ACT }}
5450
run: |
@@ -65,86 +61,45 @@ jobs:
6561
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
6662
sudo apt-get update
6763
68-
apt-get update && apt-get -y install rsync apache2-utils docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
69-
- name: Update Registry Dockerfile
70-
run: |
71-
cd $GITHUB_WORKSPACE/registry/
72-
73-
# Check if the registry dockerfile has changed
74-
local_checksum=$(sha256sum "Dockerfile" | awk '{print $1}')
75-
remote_checksum=$(ssh "${{ secrets.ssh_connection }}" "sha256sum '/vectorapp/registry/Dockerfile' 2>/dev/null" | awk '{print $1}')
76-
77-
# If so update it and restart the server
78-
if [[ $local_checksum != $remote_checksum ]]; then
79-
80-
# Make a password file
81-
mkdir password
82-
cd password
83-
touch htpasswd
84-
85-
# Generate a bcrypt for the password and store in the file
86-
htpasswd -bnBC 10 "${{ secrets.registry_username }}" "${{ secrets.registry_password }}" | tr -d '\n' > htpasswd
87-
88-
cd ..
89-
90-
# Sync all data to the vps
91-
rsync -aqc . ${{ secrets.ssh_connection }}:/vectorapp/app/registry/
92-
93-
# Rebuild docker image
94-
ssh -i ~/.ssh/id_rsa ${{ secrets.ssh_connection }} "
95-
cd /vectorapp/app/registry
96-
97-
docker stop 'vector-registry' || true
98-
docker rm 'vector-registry' || true
99-
docker build -t 'vector-registry' . --target 'base'
100-
docker run -d --mount "type=bind,src=\${PWD}/password,dst=/auth/htpasswd" -p 127.0.0.1:5000:5000 -v registry-data:/var/lib/registry --name 'vector-registry' 'vector-registry'
101-
"
102-
else
103-
echo "Registry Dockerfile hasn't changed skipping update"
104-
fi
64+
apt-get update && apt-get -y install rsync pigz apache2-utils docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
10565
- name: Copy docker-compose and env variables
10666
run: |
107-
mkdir secrets
108-
cd secrets
109-
echo "${{ secrets.admin_password }}" > "admin_password.txt"
110-
echo "${{ secrets.user_password }}" > "user_password.txt"
111-
echo "${{ secrets.postgres_password }}" > "postgres_password.txt"
112-
echo "${{ secrets.nginx_forward_secret }}" > "nginx_forward_secret.txt"
113-
cd ..
114-
115-
echo "${{ vars.PRODUCTION_VARIABLES }}" | tr -d '\r' > ".env"
116-
117-
rsync -aqc docker-compose.yml docker-compose.prod.yml .env secrets ${{ secrets.ssh_connection }}:/vectorapp/app/compose/
67+
mkdir -p .secrets
68+
rsync -aqc docker-compose.yml ${{ secrets.ssh_connection }}:~/vectorapp/vector-portfolio/
69+
ssh -i ~/.ssh/id_rsa ${{ secrets.ssh_connection }} "
70+
cd ~/vectorapp/vector-portfolio/
71+
72+
mkdir -p .secrets
73+
cd .secrets
74+
touch payload-secret.txt
75+
touch postgres-password.txt
76+
touch email-password.txt
77+
echo '${{ secrets.payload_secret }}' > payload-secret.txt
78+
echo '${{ secrets.postgres_password }}' > postgres-password.txt
79+
echo '${{ secrets.email_password }}' > email-password.txt
80+
"
11881
- name: Build and push changes
11982
run: |
120-
source .env
121-
registry_host="https://$REGISTRY_URL"
122-
echo "${{ secrets.registry_password }}" | docker login $registry_host --username ${{ secrets.registry_username }} --password-stdin
123-
docker compose --profile prod -f docker-compose.yml -f docker-compose.prod.yml --env-file .env build
124-
docker compose --profile prod -f docker-compose.yml -f docker-compose.prod.yml --env-file .env push
83+
docker compose build
84+
docker save -o payload.tar vector-portfolio-payload:latest
85+
docker save -o nginx.tar vector-portfolio-nginx:latest
86+
pigz payload.tar
87+
pigz nginx.tar
88+
rsync -aqc payload.tar.gz ${{ secrets.ssh_connection }}:~/vectorapp/vector-portfolio/
89+
rsync -aqc nginx.tar.gz ${{ secrets.ssh_connection }}:~/vectorapp/vector-portfolio/
12590
- name: Pull changes
12691
run: |
12792
ssh -i ~/.ssh/id_rsa ${{ secrets.ssh_connection }} "
128-
cd /vectorapp/app/compose
129-
130-
source .env
93+
cd ~/vectorapp/vector-portfolio
13194
132-
echo "${{ secrets.registry_password }}" | docker login https://$REGISTRY_URL --username ${{ secrets.registry_username }} --password-stdin
95+
docker load -q -i payload.tar.gz
96+
docker load -q -i nginx.tar.gz
97+
rm payload.tar.gz
98+
rm nginx.tar.gz
13399
134-
docker compose --profile prod pull
135-
docker compose --profile prod -f docker-compose.yml -f docker-compose.prod.yml up --force-recreate -d
100+
export DOMAIN="${{ env.DOMAIN }}"
101+
export EMAIL_USER="${{ env.EMAIL_USER }}"
102+
export SMTP_HOST="${{env.SMTP_HOST}}"
103+
docker compose up -d --no-build
136104
docker image prune -f
137-
"
138-
- name: Install cleanup dependencies
139-
uses: actions/setup-python@v5
140-
with:
141-
python-version: '3.13'
142-
cache: 'pip'
143-
- name: Cleanup registry
144-
run: |
145-
cd registry/cleanup
146-
pip install -r requirements-build.txt
147-
148-
source ../../.env
149-
150-
python registry.py -l "${{ secrets.registry_username }}:${{ secrets.registry_password }}" -r "https://$REGISTRY_URL" --delete --num 5 --keep-tags "latest"
105+
"

.gitignore

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
1-
node_modules
2-
.env
3-
venv
4-
__pycache__
5-
certs
6-
secrets
7-
conf
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
/.idea/*
10+
!/.idea/runConfigurations
11+
12+
# testing
13+
/coverage
14+
15+
# next.js
16+
/.next/
17+
/out/
18+
19+
# production
20+
/build
21+
22+
# misc
23+
.DS_Store
24+
*.pem
25+
26+
# debug
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
31+
# local env files
32+
.env*.local
33+
34+
# vercel
35+
.vercel
36+
37+
# typescript
38+
*.tsbuildinfo
39+
next-env.d.ts
40+
841
.env*
9-
password
10-
.secrets
11-
.vars
42+
.secrets*
43+
44+
/media
45+
46+
*.db
47+
48+
nginx/certificates

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100,
5+
"semi": false
6+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
3+
}

.vscode/launch.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Next.js: debug full stack",
9+
"type": "node",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/node_modules/next/dist/bin/next",
12+
"runtimeArgs": ["--inspect"],
13+
"skipFiles": ["<node_internals>/**"],
14+
"serverReadyAction": {
15+
"action": "debugWithChrome",
16+
"killOnServerStop": true,
17+
"pattern": "- Local:.+(https?://.+)",
18+
"uriFormat": "%s",
19+
"webRoot": "${workspaceFolder}"
20+
},
21+
"cwd": "${workspaceFolder}"
22+
}
23+
]
24+
}

.vscode/settings.json

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
11
{
2-
"python.autoComplete.extraPaths": [
3-
"${workspaceFolder}/backend/src/"
4-
],
5-
"python.analysis.extraPaths": [
6-
"${workspaceFolder}/backend/src/"
7-
],
8-
"terminal.integrated.env.windows": {
9-
"PYTHONPATH": "${workspaceFolder}/backend/src/"
2+
"npm.packageManager": "pnpm",
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"[typescript]": {
5+
"editor.defaultFormatter": "esbenp.prettier-vscode",
6+
"editor.formatOnSave": true,
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit"
109
}
10+
},
11+
"[typescriptreact]": {
12+
"editor.defaultFormatter": "esbenp.prettier-vscode",
13+
"editor.formatOnSave": true,
14+
"editor.codeActionsOnSave": {
15+
"source.fixAll.eslint": "explicit"
16+
}
17+
},
18+
"[javascript]": {
19+
"editor.defaultFormatter": "esbenp.prettier-vscode",
20+
"editor.formatOnSave": true,
21+
"editor.codeActionsOnSave": {
22+
"source.fixAll.eslint": "explicit"
23+
}
24+
},
25+
"[json]": {
26+
"editor.defaultFormatter": "esbenp.prettier-vscode",
27+
"editor.formatOnSave": true
28+
},
29+
"[jsonc]": {
30+
"editor.defaultFormatter": "esbenp.prettier-vscode",
31+
"editor.formatOnSave": true
32+
},
33+
"editor.formatOnSaveMode": "file",
34+
"typescript.tsdk": "node_modules/typescript/lib",
35+
"[javascript][typescript][typescriptreact]": {
36+
"editor.codeActionsOnSave": {
37+
"source.fixAll.eslint": "explicit"
38+
}
39+
}
1140
}

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--install.ignore-engines true

0 commit comments

Comments
 (0)