-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:NIAEFEUP/tts-be into feature/has…
…hCheckEndpoint
- Loading branch information
Showing
24 changed files
with
624 additions
and
124,844 deletions.
There are no files selected for viewing
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,22 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Upload to NIployments registry | ||
uses: NIAEFEUP/[email protected] | ||
with: | ||
docker_dockerfile: Dockerfile | ||
docker_context: ./django | ||
docker_target: prod | ||
NIPLOYMENTS_REGISTRY_URL: ${{ vars.NIPLOYMENTS_REGISTRY_URL }} | ||
NIPLOYMENTS_REGISTRY_USERNAME: ${{ vars.NIPLOYMENTS_REGISTRY_USERNAME }} | ||
NIPLOYMENTS_REGISTRY_PASSWORD: ${{ secrets.NIPLOYMENTS_REGISTRY_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,9 @@ The data is available at the NIAEFEUP drive (Only for NIAEFEUP members): | |
|
||
https://drive.google.com/drive/folders/1hyiwPwwPWhbAPeJm03c0MAo1HTF6s_zK?usp=sharing | ||
|
||
- The ```00_schema_mysql.sql``` corresponds to the schema for the most recent data. | ||
- The ```00_schema_postgres.sql``` corresponds to the schema for the most recent data. | ||
|
||
- Copy the ```01_data.sql``` and ```00_schema_mysql.sql``` of year and semester you desire to the ```mysql/sql``` folder. | ||
- Copy the ```01_data.sql``` and ```00_schema_postgres.sql``` of year and semester you desire to the ```postgres/sql``` folder. | ||
|
||
## Usage | ||
|
||
|
@@ -44,7 +44,7 @@ In case you have __already build the server before and want to repopulate the da | |
sudo make clean | ||
``` | ||
|
||
We need to clean the database to repopulate it, since the way the mysql container works is that it only runs the `sql` files present in the `mysql/sql` folder if the database is clean. This is way we need to issue `sudo make clean` in order for the insert sql queries to be run. | ||
We need to clean the database to repopulate it, since the way the postgres container works is that it only runs the `sql` files present in the `postgres/sql` folder if the database is clean. This is way we need to issue `sudo make clean` in order for the insert sql queries to be run. | ||
|
||
#### Running the container | ||
|
||
|
@@ -70,8 +70,13 @@ docker compose up | |
|
||
#### Accessing the development database | ||
|
||
We are currently using `phpmyadmin` and you can access it | ||
We are currently using `pgadmin` and you can access it | ||
|
||
1. Go to `localhost:4000` | ||
|
||
2. On the login screen, both the username and password are `root`. This is fine, since this is only a development environment | ||
2. On the login screen, both the credentials are as follows: | ||
|
||
- Email: [email protected] | ||
- Password: admin | ||
|
||
This is fine, since this is only a development environment. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
FROM python:3.8-slim-buster | ||
# deps | ||
FROM python:3.8-slim-buster AS deps | ||
|
||
WORKDIR /usr/src/django/ | ||
|
||
# Get's the output from the django in realtime. | ||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Copy requirements | ||
COPY ./requirements.txt ./requirements.txt | ||
|
||
# Dependencies for mysqlclient | ||
# Dependencies for building the requirements | ||
RUN apt-get update | ||
RUN apt-get -y install build-essential default-libmysqlclient-dev | ||
RUN apt-get -y install build-essential | ||
|
||
# Install mysql command to wait for the database initialization | ||
RUN apt -y install default-mysql-client | ||
# Install postgres dependencies (pgsql client and development files) | ||
COPY ./etc/pgdg.sh /tmp/pgdg.sh | ||
RUN /tmp/pgdg.sh | ||
|
||
RUN apt -y install libpq-dev postgresql-client-16 | ||
RUN apt -y clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install the requirements | ||
RUN pip install -r requirements.txt | ||
|
||
EXPOSE 8000 | ||
|
||
COPY ./entrypoint.sh ./entrypoint.sh | ||
ENTRYPOINT ["sh", "/usr/src/django/entrypoint.sh"] | ||
ENTRYPOINT ["/usr/src/django/entrypoint.sh"] | ||
|
||
# prod | ||
FROM deps AS prod | ||
|
||
COPY tts_be/ ./tts_be | ||
COPY university/ ./university | ||
COPY manage.py tasks.py ./ | ||
|
||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
# Source: https://www.postgresql.org/download/linux/ubuntu/ | ||
|
||
# Import the repository signing key: | ||
apt install -y curl ca-certificates postgresql-common lsb-release | ||
|
||
install -d /usr/share/postgresql-common/pgdg | ||
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | ||
|
||
# Create the repository configuration file: | ||
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | ||
|
||
# Update the package lists: | ||
apt update |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.