diff --git a/README.md b/README.md index 4726ab0..222fcb5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,35 @@ # talks-site +## Overview + +I ended up making this for a few reasons. + +1. I couldn't find a simple open source blog site template that was ready to go out of the box. +2. Making this project gives me blog material. +3. I needed an excuse to use PostgreSQL in a project. +4. Every job application asks for a 'personal site' nowadays, so if that's what you need, here you go. + +### Front + +Written in TypeScript (because who uses JS anymore). +The front end is done via React, Vite, and Tailwind. + +To be honest most of the tailwind is likely to be done by a chat bot. I don't particularly care for styling that much. + +### Back + +Written in Python. +The backend is done using FastAPI. For the sole reason that it has a very nice /docs api built in so I don't have to do that. + +### Database + +The database is PostgreSQL, unsure what version -- it shouldn't really matter that much. +Access is done via sqlalchemy orm, migrations via alembic. + +Has an automatic backup on a CRON that outputs to the root volume. + +### How to build? + +The whole thing should run by using docker. +There is a docker-compose file in the root, I would suggest changing the user/password to your db if you ever intend for this to leave your home network. +I'm sure there are a lot of other security measures as well, but at the time of writing this I'm not particular about the security for the web application 2 people might view. diff --git a/backend/README.md b/backend/README.md index 3b952dc..76ac08d 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,64 +1 @@ # Server - -## Useful Links - -- [MongoDB Shell](https://www.mongodb.com/docs/mongodb-shell/) - - `mongosh` -> `db.getMongo()` to return the local ip - -## How to get MongoDB up and running linux - -### Installation - -1. Import the public key - -```bash -sudo apt-get install gnupg curl -``` - -```bash -curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ - sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ - --dearmor -``` - -2. Create the list file - -```bash -echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list -``` - -3. Reload - -```bash -sudo apt-get update -``` - -4. Install MongoDB Community Server - -```bash -sudo apt-get install -y mongodb-org -``` - -### Start Process - -My system uses `systemd` to manage processes. However, if you are not aware which your system uses run `ps --no-headers -o comm 1` and that should tell you which to use. - -1. Start MongoDB - -```bash -sudo systemctl start mongod -``` - -2. Verify Success - -```bash -sudo systemctl status mongod -``` - -2. a. If you want mongo to start after reboot: `sudo systemctl enable mongod` - -[Reference](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/) - -### If Mongo is failing to start with exit code 14 - -[StackExchange](https://askubuntu.com/questions/823288/mongodb-loads-but-breaks-returning-status-14) diff --git a/backend/docs/backup.md b/backend/docs/backup.md new file mode 100644 index 0000000..6af31a0 --- /dev/null +++ b/backend/docs/backup.md @@ -0,0 +1 @@ +# PostgreSQL Automated Backup Using Bash & Docker diff --git a/backend/docs/mongodb.md b/backend/docs/mongodb.md new file mode 100644 index 0000000..1851b0d --- /dev/null +++ b/backend/docs/mongodb.md @@ -0,0 +1,64 @@ +# How to get started with MongoDB on Liunx + +## Useful Links + +- [MongoDB Shell](https://www.mongodb.com/docs/mongodb-shell/) + - `mongosh` -> `db.getMongo()` to return the local ip + +## How to get MongoDB up and running linux + +### Installation + +1. Import the public key + +```bash +sudo apt-get install gnupg curl +``` + +```bash +curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ + sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ + --dearmor +``` + +2. Create the list file + +```bash +echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list +``` + +3. Reload + +```bash +sudo apt-get update +``` + +4. Install MongoDB Community Server + +```bash +sudo apt-get install -y mongodb-org +``` + +### Start Process + +My system uses `systemd` to manage processes. However, if you are not aware which your system uses run `ps --no-headers -o comm 1` and that should tell you which to use. + +1. Start MongoDB + +```bash +sudo systemctl start mongod +``` + +2. Verify Success + +```bash +sudo systemctl status mongod +``` + +2. a. If you want mongo to start after reboot: `sudo systemctl enable mongod` + +[Reference](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/) + +### If Mongo is failing to start with exit code 14 + +[StackExchange](https://askubuntu.com/questions/823288/mongodb-loads-but-breaks-returning-status-14) diff --git a/docker-compose.yaml b/docker-compose.yaml index 6c93478..2affb01 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,6 +9,8 @@ services: POSTGRES_DB: mydatabase volumes: - postgres_data:/var/lib/postgresql/data + ports: + - "5432:5432" networks: - app-network backup: