Skip to content

Commit

Permalink
Fix deployment and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
robbdimitrov committed Jan 23, 2023
1 parent 0e36777 commit 0e080db
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 37 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ all: backend database frontend

.PHONY: backend
backend:
docker build -t pixelgram/backend src/backend
docker build -t localhost:5000/pixelgram/backend src/backend

.PHONY: database
database:
docker build -t pixelgram/database src/database
docker build -t localhost:5000/pixelgram/database src/database

.PHONY: frontend
frontend:
docker build -t pixelgram/frontend src/frontend
docker build -t localhost:5000/pixelgram/frontend src/frontend
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# Pixelgram

**Pixelgram** is an image-sharing application where users can create,
**Pixelgram** is an image-sharing application where users can create,
browse and like images.

## Screenshots

Feed | Profile
--- | ---
[![Screenshot of feed screen](/docs/img/01_feed.png)](/docs/img/01_feed.png) | [![Screenshot of profile screen](/docs/img/02_profile.png)](/docs/img/02_profile.png)

## Architecture

Service | Language | Description
--- | --- | ---
[backend](/src/backend) | Python | Backend of the app, responsible for users, posts and authentication.
[backend](/src/backend) | JavaScript | Backend of the app, responsible for users, posts and authentication.
[database](/src/database) | SQL | PostgreSQL database with tables, relationships and functions.
[frontend](/src/frontend) | TypeScript | Angular frontend of the app.

Expand All @@ -24,48 +18,48 @@ Service | Language | Description
Clone the repository to your filesystem

```sh
$ git clone [email protected]:robbdimitrov/pixelgram.git
$ cd pixelgram
git clone [email protected]:robbdimitrov/pixelgram.git
cd pixelgram
```

### Build the images

Build all the images

```sh
$ make
make
```

Or build specific images

```sh
$ make backend
$ make database
$ make frontend
make backend
make database
make frontend
```

### Create namespace

Create namespace for the k8s resources

```sh
$ kubectl create namespace pixelgram
kubectl create namespace pixelgram
```

### Create deployments

Create deployments and volumes

```sh
$ kubectl apply -f ./k8s -n pixelgram
kubectl apply -f ./k8s -n pixelgram
```

## Access the frontend

Enable port forwarding

```sh
$ kubectl port-forward service/frontend 8080 -n pixelgram
kubectl port-forward service/frontend 8080 -n pixelgram
```

Open the frontend [here](http://localhost:8080/).
Expand All @@ -75,18 +69,18 @@ Open the frontend [here](http://localhost:8080/).
Delete all resources

```sh
$ kubectl delete -f ./k8s -n pixelgram
kubectl delete -f ./k8s -n pixelgram
```

Delete the namespace

```sh
$ kubectl delete namespace pixelgram
kubectl delete namespace pixelgram
```

## API

The API documentation is available [here](/docs/API.md).
The API documentation is available [here](/API.md).

## License

Expand Down
Binary file removed docs/img/01_feed.png
Binary file not shown.
Binary file removed docs/img/02_profile.png
Binary file not shown.
3 changes: 1 addition & 2 deletions k8s/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ spec:
spec:
containers:
- name: backend
image: pixelgram/backend
imagePullPolicy: Never
image: localhost:5000/pixelgram/backend
ports:
- containerPort: 8080
resources:
Expand Down
3 changes: 1 addition & 2 deletions k8s/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ spec:
spec:
containers:
- name: database
image: pixelgram/database
imagePullPolicy: IfNotPresent
image: localhost:5000/pixelgram/database
ports:
- containerPort: 5432
env:
Expand Down
3 changes: 1 addition & 2 deletions k8s/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ spec:
spec:
containers:
- name: frontend
image: pixelgram/frontend
imagePullPolicy: Never
image: localhost:5000/pixelgram/frontend
ports:
- containerPort: 8080
resources:
Expand Down
1 change: 0 additions & 1 deletion src/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ RUN npm run build
FROM nginx:1.23-alpine
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]
10 changes: 5 additions & 5 deletions src/frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"frontend": {
"pixelgram": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
Expand All @@ -20,7 +20,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/frontend",
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
Expand Down Expand Up @@ -72,10 +72,10 @@
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "frontend:build:production"
"browserTarget": "pixelgram:build:production"
},
"development": {
"browserTarget": "frontend:build:development"
"browserTarget": "pixelgram:build:development"
}
},
"options": {
Expand All @@ -86,7 +86,7 @@
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "frontend:build"
"browserTarget": "pixelgram:build"
}
},
"test": {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"build": "ng build",
"lint": "ng lint"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</ng-template>
</button>

<span class="bold">{{image.likes}} {{image.likes == 1 ? "like" : "likes"}}</span>
<span class="bold">{{image.likes}} {{image.likes === 1 ? "like" : "likes"}}</span>
</div>

<div class="content">
Expand Down

0 comments on commit 0e080db

Please sign in to comment.