-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4cbd79c
commit ff58a1c
Showing
60 changed files
with
362 additions
and
238 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,24 +1,64 @@ | ||
|
||
CMD:=poetry run | ||
client=cd client | ||
up: | ||
docker-compose up --build -d | ||
client:=cd client | ||
server:=cd server | ||
|
||
help: | ||
@echo "\n- Docker: To build and run a specific service, you can do that by executing 'make docker-up service=<service_name>'." | ||
@echo "\n- To run a the backend project, you can do that by executing 'make runserver'." | ||
@echo "\n- To run a the backend client, you can do that by executing 'make runclient'." | ||
|
||
docker-up: | ||
ifeq ($(service), frontend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up frontend --build -d | ||
else ifeq ($(service), backend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up backend --build -d | ||
else ifeq ($(service), postgres) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up postgres --build -d | ||
else | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d | ||
endif | ||
|
||
docker-down: | ||
ifeq ($(service), frontend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down frontend | ||
else ifeq ($(service), backend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down backend | ||
else ifeq ($(service), postgres) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down postgres | ||
else | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down | ||
endif | ||
|
||
docker-logs: | ||
ifeq ($(service), frontend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f frontend | ||
else ifeq ($(service), backend) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f backend | ||
else ifeq ($(service), postgres) | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f postgres | ||
else | ||
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f | ||
endif | ||
|
||
install: | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
poetry install | ||
poetry check | ||
$(server) && poetry install | ||
$(server) && poetry check | ||
$(client) && pnpm i | ||
runserver: | ||
$(CMD) python3 manage.py runserver | ||
$(server) && $(CMD) python3 manage.py runserver | ||
runclient: | ||
$(client) && npm install && npm run dev | ||
$(client) && pnpm i && pnpm dev | ||
test: | ||
$(CMD) python3 manage.py test | ||
$(server) && $(CMD) python3 manage.py test | ||
lint: | ||
$(CMD) black . | ||
$(CMD) flake8 . --exclude=__init__.py | ||
$(server) && $(CMD) black . --exclude=__init__.py | ||
$(server) && $(CMD) flake8 . --exclude=__init__.py | ||
$(client) && pnpm lint | ||
migrate: | ||
$(CMD) python3 manage.py migrate | ||
migrations: | ||
$(CMD) python3 manage.py makemigrations | ||
$(server) && $(CMD) python3 manage.py makemigrations | ||
$(server) && $(CMD) python3 manage.py migrate | ||
user: | ||
$(CMD) python3 manage.py createsuperuser | ||
$(CMD) python3 manage.py sqlmigrate test_tracker 0006 | ||
$(server) && $(CMD) python3 manage.py createsuperuser | ||
data: | ||
$(server) && $(CMD) python3 manage.py create locations users |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# Set the environment variable | ||
ENV DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC | ||
ENV REDIS_HOST=$REDIS_HOST | ||
ENV DJANGO_DEBUG=$DJANGO_DEBUG | ||
ENV EMAIL=$EMAIL | ||
ENV EMAIL_PASSWORD=$EMAIL_PASSWORD | ||
ENV EMAIL_HOST=$EMAIL_HOST | ||
ENV DJANGO_SUPERUSER_EMAIL=$DJANGO_SUPERUSER_EMAIL | ||
ENV DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD | ||
ENV SERVER_DOMAIN_NAME=$SERVER_DOMAIN_NAME | ||
ENV CLIENT_DOMAIN_NAME=$CLIENT_DOMAIN_NAME | ||
ENV ENV=$ENV | ||
ENV DATABASE_NAME=$DATABASE_NAME | ||
ENV DATABASE_USER=$DATABASE_USER | ||
ENV DATABASE_PASSWORD=$DATABASE_PASSWORD | ||
ENV DATABASE_HOST=$DATABASE_HOST | ||
ENV DATABASE_PORT=$DATABASE_PORT | ||
|
||
RUN echo deb http://be.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse >> /etc/apt/sources.list | ||
RUN apt-get -y update && \ | ||
apt-get -y install wget sudo netcat redis vim python3.8 python3-pip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /server | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && \ | ||
chmod +x /sbin/zinit && pip install poetry && poetry --version | ||
|
||
RUN mkdir -p /etc/zinit/ | ||
|
||
COPY ./server /server | ||
COPY ./docker/scripts/backend/zinit /etc/zinit | ||
COPY ./docker/scripts/backend/*.sh /server/scripts/ | ||
COPY ./config /config/ | ||
|
||
RUN chmod +x /server/scripts/*.sh | ||
|
||
EXPOSE 8000 | ||
ENTRYPOINT ["zinit", "init"] |
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# build stage | ||
FROM node:18.18.2 as build-stage | ||
WORKDIR /client | ||
|
||
ENV SERVER_DOMAIN_NAME_API=$SERVER_DOMAIN_NAME_API | ||
|
||
# Copy package.json and package-lock.json separately to leverage Docker cache | ||
COPY ./client/package*.json /client | ||
COPY ./docker/scripts/frontend/build-env.sh /client/scripts/ | ||
|
||
RUN npm i -g pnpm && pnpm install | ||
RUN chmod +x /client/scripts/build-env.sh | ||
COPY ./client /client | ||
RUN pnpm build | ||
|
||
FROM nginx:stable-alpine as production-stage | ||
COPY ./nginx/prod.conf /temp/prod.conf | ||
|
||
RUN envsubst '$SERVER_DOMAIN_NAME_API' < /temp/prod.conf > /etc/nginx/conf.d/default.conf | ||
|
||
# Copy the build artifacts and build-env.sh from the build-stage | ||
COPY --from=build-stage /client/dist /usr/share/nginx/html | ||
COPY --from=build-stage /client/scripts/build-env.sh /usr/share/nginx/html | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["/bin/sh", "-c", "/usr/share/nginx/html/build-env.sh && nginx -g \"daemon off;\""] |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Project Configuration | ||
|
||
After executing | ||
|
||
```sh | ||
make install && make migrate | ||
``` | ||
|
||
Please refer to [.env.template](.././config/.env.template) for all required values. Ensure all values are populated in the `.env` file within the [config](.././config/) directory. |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Runing the project using Docker and Docker Compose | ||
|
||
To run the full project with all instances, follow these steps: | ||
|
||
1. Set Environment Variables | ||
|
||
Create a `.env` file beside the [config](.././config/) directory and set the necessary environment variables. Refer to the previous section for sample environment variable configurations. | ||
|
||
2. Execute Docker Compose | ||
|
||
Run the following command to start the Docker containers: | ||
|
||
```sh | ||
# --> To run all services | ||
|
||
└─(✹)──> docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d | ||
|
||
# --> To stop all services | ||
└─(✹)──> docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down | ||
|
||
``` | ||
|
||
Also, you can excute the command using Make: | ||
|
||
- make docker-up **To run all services** | ||
- make docker-down **To stop all services** | ||
|
||
After executing the command, you should see a confirmation similar to the following: | ||
|
||
3. Verify Successful Deployment | ||
|
||
This indicates that the Docker containers are being created and the services are starting up. |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Installation Process | ||
|
||
To facilitate the installation process, this project utilizes the `poetry` package manager for `Python` and `yarn` for `Node.js`. Follow the steps outlined below for a seamless installation: | ||
|
||
1. Install Poetry: | ||
Execute the following command to install Poetry for Python: | ||
|
||
```sh | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
``` | ||
|
||
2. Install yarn: | ||
To install `yarn` globally for Node.js, run the following command: | ||
|
||
```sh | ||
npm i -g yarn | ||
``` | ||
|
||
After installing these packages you can now install the required packages by executing: | ||
3. Install project Packages | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
By following these steps, you ensure the proper setup of the required package managers for this project. |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
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
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.