Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisIannelloDev authored Sep 16, 2024
0 parents commit 08b939c
Show file tree
Hide file tree
Showing 147 changed files with 29,789 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/devcontainers/python:0-3.10

ENV PYTHONUNBUFFERED 1

# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp

#[Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends postgresql-client



32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/postgres
{
"name": "Python 3 & PostgreSQL",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "lts"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
"forwardPorts": [3000, 3001],

"onCreateCommand": "(cp .env.example .env || echo \".env creation failed\"); (pipenv install || echo \"pipenv install failed\"); (bash database.sh || echo \"database.sh failed\");",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "python docs/assets/greeting.py both > /workspaces/.codespaces/shared/first-run-notice.txt && npm install",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
35 changes: 35 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.8'

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: gitpod
POSTGRES_DB: example
POSTGRES_PASSWORD: postgres

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
postgres-data:
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file includes global variables that will be available inside your project
# 1. In the front end code you can access this variables like this: console.log(process.env.VARIABLE_NAME)
# 1. In the back end code you access the variable by importing os and then typing print(os.getenv('VARIABLE_NAME'))

# Back-End Variables
DATABASE_URL=postgres://gitpod:postgres@localhost:5432/example
FLASK_APP_KEY="any key works"
FLASK_APP=src/app.py
FLASK_DEBUG=1
DEBUG=TRUE

# Front-End Variables
BASENAME=/
#BACKEND_URL=
31 changes: 31 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parser": "@babel/eslint-parser",
"plugins": [
"react"
],
"env": {
"browser": true,
"es6": true
},
"extends": [ "plugin:react/recommended"],
"rules": {
"strict":0,
"no-unused-vars": 0,
"no-console": 1,
"no-mixed-spaces-and-tabs": 0,
"no-debugger": 0,
"semi": ["error", "always"],
"allowImportExportEverywhere": false,
"indent": "off",
"react/jsx-indent": "off",
"react/jsx-indent-props": "off",
"comma-dangle": [1, { //when to use the last comma
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "ignore",
}],
"react/prop-types": [2]
}
}
27 changes: 27 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repository:
has_wiki: false

# Labels: define labels for Issues and Pull Requests
labels:
- name: "bug"
color: c10000
- name: ":nerd_face: 4geeks student"
color: 7057ff
- name: "enhancement"
color: a2eeef
- name: "first-timers-only"
color: 69db89
- name: "good first issue"
color: 7057ff
- name: "help wanted"
color: 008672
- name: ":star: P1"
color: fbca04
- name: ":star: P2"
color: fbca04
- name: ":memo: bc-writter"
color: 98bde2
- name: ":computer: bc-coder"
color: 98bde2
- name: ":beetle: bc-inspector"
color: 98bde2
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# ignore all files starting with .
.*

# track this file .gitignore (i.e. do NOT ignore it)
!.gitignore
!.github
php_errorlog
.log

# do not ignore gitpod and render files
!.gitpod.Dockerfile
!.welcome
!.devcontainer
!.devcontainer/*
!Dockerfile.render
!.gitpod.yml
!render.yml
!.render-buildpacks.json

# track webpack configs (i.e. do NOT ignore it)
!composer.json
!webpack.config.js
!package.json
!webpack.production.js
!webpack.development.js

# track readme.md in the root (i.e. do NOT ignore it)
!README.md

# ignore OS generated files
ehthumbs.db
Thumbs.db

# ignore Editor files
*.sublime-project
*.sublime-workspace
*.komodoproject

# ignore log files and databases
*.log
*.sql
*.sqlite

# ignore compiled files
*.com
*.class
*.dll
*.exe
*.o
*.so

# ignore packaged files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# ignore node/grunt dependency directories
node_modules/

# webpack output
dist/*
!public/
!public/*

# ignore the dist directory were our bundle files are going to be
!.gitkeep
!.htaccess
!.eslintrc
!.env.example
.now

# backend stuff
.venv
database.database
database.db
diagram.png
__pycache__/
27 changes: 27 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM gitpod/workspace-postgres:latest

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.10.7 && pyenv global 3.10.7
RUN pip install pipenv yapf
RUN npm i heroku -g

# 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
RUN echo "export DATABASE_URL" >> $HOME/.bashrc
28 changes: 28 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
image:
file: .gitpod.Dockerfile
ports:
- port: 3000
onOpen: open-browser
visibility: public
- port: 3001
onOpen: open-preview
visibility: public
- port: 5432
onOpen: ignore
tasks:
- init: >
(cp .env.example .env || true) &&
pipenv install &&
psql -U gitpod -c 'CREATE DATABASE example;' &&
psql -U gitpod -c 'CREATE EXTENSION unaccent;' -d example &&
psql -c "ALTER USER gitpod PASSWORD 'postgres';" &&
bash database.sh &&
python docs/assets/greeting.py back
- command: >
npm install &&
python docs/assets/greeting.py front
openMode: split-right
vscode:
extensions:
- esbenp.prettier-vscode
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
}
}
Binary file added 4geeks.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions Dockerfile.render
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:16

RUN apt update \
&& apt install software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& apt install python3.10

WORKDIR /opt/app
COPY --from=build /opt/app/venv /venv

ENV PATH="/opt/app/venv/bin:$PATH"
ENV NODE_ENV=container
37 changes: 37 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
flask = "*"
sqlalchemy = "==1.4.46"
flask-sqlalchemy = "*"
flask-migrate = "*"
flask-swagger = "*"
psycopg2-binary = "*"
python-dotenv = "*"
flask-cors = "*"
gunicorn = "*"
cloudinary = "*"
flask-admin = "*"
typing-extensions = "*"
flask-jwt-extended = "*"
bcrypt = "*"
flask-mail = "*"

[requires]
python_version = "3.10"

[scripts]
start="flask run -p 3001 -h 0.0.0.0"
init="flask db init"
migrate="flask db migrate"
local="heroku local"
upgrade="flask db upgrade"
downgrade="flask db downgrade"
insert-test-data="flask insert-test-data"
reset_db="bash ./docs/assets/reset_migrations.bash"
deploy="echo 'Please follow this 3 steps to deploy: https://github.com/4GeeksAcademy/flask-rest-hello/blob/master/README.md#deploy-your-website-to-heroku' "
Loading

0 comments on commit 08b939c

Please sign in to comment.