Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/breatheco-de/apiv2 i…
Browse files Browse the repository at this point in the history
…nto feat/transfer-repositories
  • Loading branch information
jefer94 committed Sep 6, 2024
2 parents b46a962 + 0afe689 commit b25593c
Show file tree
Hide file tree
Showing 108 changed files with 3,171 additions and 4,373 deletions.
57 changes: 34 additions & 23 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
FROM gitpod/workspace-postgres:latest
# https://github.com/gitpod-io/workspace-images/blob/main/chunks/tool-postgresql/Dockerfile
FROM gitpod/workspace-python-3.12

# Dazzle does not rebuild a layer until one of its lines are changed. Increase this counter to rebuild this layer.
ENV TRIGGER_REBUILD=4
ENV PGWORKSPACE="/workspace/.pgsql"
ENV PGDATA="$PGWORKSPACE/data"

# Install PostgreSQL
RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
echo "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - && \
sudo install-packages postgresql-16 postgresql-contrib-16 redis-server

# Setup PostgreSQL server for user gitpod
ENV PATH="/usr/lib/postgresql/16/bin:$PATH"

SHELL ["/usr/bin/bash", "-c"]
RUN PGDATA="${PGDATA//\/workspace/$HOME}" \
&& mkdir -p ~/.pg_ctl/bin ~/.pg_ctl/sockets $PGDATA \
&& initdb -D $PGDATA \
&& printf '#!/bin/bash\npg_ctl -D $PGDATA -l ~/.pg_ctl/log -o "-k ~/.pg_ctl/sockets" start\n' > ~/.pg_ctl/bin/pg_start \
&& printf '#!/bin/bash\npg_ctl -D $PGDATA -l ~/.pg_ctl/log -o "-k ~/.pg_ctl/sockets" stop\n' > ~/.pg_ctl/bin/pg_stop \
&& chmod +x ~/.pg_ctl/bin/*
ENV PATH="$HOME/.pg_ctl/bin:$PATH"
ENV DATABASE_URL="postgresql://gitpod@localhost"
ENV PGHOSTADDR="127.0.0.1"
ENV PGDATABASE="postgres"
COPY --chown=gitpod:gitpod postgresql-hook.bash $HOME/.bashrc.d/200-postgresql-launch

# RUN pyenv install 3.12.3 && pyenv global 3.12.3
# RUN pip install pipenv

SHELL ["/bin/bash", "-c"]

RUN sudo apt-get update \
&& sudo apt-get update \
&& sudo apt-get install -y redis-server \
&& sudo apt-get clean \
&& sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*



# That Gitpod install pyenv for me? no, thanks
# WORKDIR /home/gitpod/
# RUN rm .pyenv -Rf
# RUN rm .gp_pyenv.d -Rf
# RUN curl https://pyenv.run | bash


# RUN pyenv update && pyenv install 3.12.2 && pyenv global 3.12.2
RUN pyenv install 3.12.2 && pyenv global 3.12.2
RUN pip install pipenv yapf

# remove PIP_USER environment
USER gitpod

RUN if ! grep -q "export PIP_USER=no" "$HOME/.bashrc"; then printf '%s\n' "export PIP_USER=no" >> "$HOME/.bashrc"; fi
RUN echo "" >> $HOME/.bashrc
RUN echo "unset DATABASE_URL" >> $HOME/.bashrc
Expand Down
12 changes: 5 additions & 7 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ ports:
tasks:
- command: redis-server
- init: |
pyenv global 3.12.2 &&
python -m scripts.install &&
gp sync-done deps
command: pyenv global 3.12.2 && pipenv run celery
command: pipenv run celery
- init: gp sync-await deps
command: >
pyenv global 3.12.2 &&
(psql -U gitpod -c 'CREATE DATABASE breathecode;' || true) &&
(psql -U gitpod -c 'CREATE EXTENSION unaccent;' -d breathecode || true) &&
pipenv run migrate &&
pipenv run python manage.py loaddata breathecode/*/fixtures/dev_*.json &&
pipenv run python manage.py create_academy_roles &&
pipenv run start;
CACHE=0 pipenv run migrate &&
CACHE=0 pipenv run python manage.py loaddata breathecode/*/fixtures/dev_*.json &&
CACHE=0 pipenv run python manage.py create_academy_roles &&
CACHE=1 pipenv run start;
- init: gp sync-await deps

vscode:
Expand Down
15 changes: 9 additions & 6 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ google-apps-meet = "*"
google-auth-httplib2 = "*"
google-auth-oauthlib = "*"
black = "*"
capy-core = {extras = ["pytest"], version = "*"}

[packages]
django = "*"
Expand Down Expand Up @@ -128,19 +129,21 @@ brotli = "*"
circuitbreaker = "*"
kombu = "*"
zstandard = "*"
psycopg = {extras = ["pool", "binary"], version = "*"}
psycopg = {extras = ["pool", "binary"] }
cryptography = "*"
adrf = "*"
uvicorn = "*"
django-minify-html = "*"
django-storages = {extras = ["google"], version = "*"}
aiohttp = {extras = ["speedups"], version = "*"}
django-storages = {extras = ["google"] }
aiohttp = {extras = ["speedups"] }
aiodns = "*"
eventlet = "*"
linked-services = {extras = ["django", "aiohttp", "requests"], version = "*"}
celery-task-manager = {extras = ["django"], version = "*"}
django-sql-explorer = {extras = ["xls"], version = "*"}
linked-services = {extras = ["django", "aiohttp", "requests"] }
celery-task-manager = {extras = ["django"] }
django-sql-explorer = {extras = ["xls"] }
contextlib2 = "*"
google-apps-meet = "*"
google-auth-httplib2 = "*"
google-auth-oauthlib = "*"
capy-core = {extras = ["django"], version = "*"}
google-api-python-client = "*"
Loading

0 comments on commit b25593c

Please sign in to comment.