Skip to content

Commit e04cdee

Browse files
committed
Completed server
1 parent d232928 commit e04cdee

File tree

11 files changed

+411
-100
lines changed

11 files changed

+411
-100
lines changed

.dockerignore

+292
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
sql
2+
scripts
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.nox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
*.py,cover
53+
.hypothesis/
54+
.pytest_cache/
55+
cover/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
.pybuilder/
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
# For a library or package, you might want to ignore these files since the code is
90+
# intended to run in multiple environments; otherwise, check them in:
91+
# .python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# poetry
101+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102+
# This is especially recommended for binary packages to ensure reproducibility, and is more
103+
# commonly ignored for libraries.
104+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105+
#poetry.lock
106+
107+
# pdm
108+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109+
#pdm.lock
110+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111+
# in version control.
112+
# https://pdm.fming.dev/#use-with-ide
113+
.pdm.toml
114+
115+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116+
__pypackages__/
117+
118+
# Celery stuff
119+
celerybeat-schedule
120+
celerybeat.pid
121+
122+
# SageMath parsed files
123+
*.sage.py
124+
125+
# Environments
126+
.venv
127+
env/
128+
venv/
129+
ENV/
130+
env.bak/
131+
venv.bak/
132+
133+
# Spyder project settings
134+
.spyderproject
135+
.spyproject
136+
137+
# Rope project settings
138+
.ropeproject
139+
140+
# mkdocs documentation
141+
/site
142+
143+
# mypy
144+
.mypy_cache/
145+
.dmypy.json
146+
dmypy.json
147+
148+
# Pyre type checker
149+
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
#.idea/
163+
164+
# Logs
165+
logs
166+
*.log
167+
npm-debug.log*
168+
yarn-debug.log*
169+
yarn-error.log*
170+
lerna-debug.log*
171+
.pnpm-debug.log*
172+
173+
# Diagnostic reports (https://nodejs.org/api/report.html)
174+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
175+
176+
# Runtime data
177+
pids
178+
*.pid
179+
*.seed
180+
*.pid.lock
181+
182+
# Directory for instrumented libs generated by jscoverage/JSCover
183+
lib-cov
184+
185+
# Coverage directory used by tools like istanbul
186+
coverage
187+
*.lcov
188+
189+
# nyc test coverage
190+
.nyc_output
191+
192+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
193+
.grunt
194+
195+
# Bower dependency directory (https://bower.io/)
196+
bower_components
197+
198+
# node-waf configuration
199+
.lock-wscript
200+
201+
# Compiled binary addons (https://nodejs.org/api/addons.html)
202+
build/Release
203+
204+
# Dependency directories
205+
node_modules/
206+
jspm_packages/
207+
208+
# Snowpack dependency directory (https://snowpack.dev/)
209+
web_modules/
210+
211+
# TypeScript cache
212+
*.tsbuildinfo
213+
214+
# Optional npm cache directory
215+
.npm
216+
217+
# Optional eslint cache
218+
.eslintcache
219+
220+
# Optional stylelint cache
221+
.stylelintcache
222+
223+
# Microbundle cache
224+
.rpt2_cache/
225+
.rts2_cache_cjs/
226+
.rts2_cache_es/
227+
.rts2_cache_umd/
228+
229+
# Optional REPL history
230+
.node_repl_history
231+
232+
# Output of 'npm pack'
233+
*.tgz
234+
235+
# Yarn Integrity file
236+
.yarn-integrity
237+
238+
# dotenv environment variable files
239+
.env.development.local
240+
.env.test.local
241+
.env.production.local
242+
.env.local
243+
244+
# parcel-bundler cache (https://parceljs.org/)
245+
.cache
246+
.parcel-cache
247+
248+
# Next.js build output
249+
.next
250+
out
251+
252+
# Nuxt.js build / generate output
253+
.nuxt
254+
dist
255+
256+
# Gatsby files
257+
.cache/
258+
# Comment in the public line in if your project uses Gatsby and not Next.js
259+
# https://nextjs.org/blog/next-9-1#public-directory-support
260+
# public
261+
262+
# vuepress build output
263+
.vuepress/dist
264+
265+
# vuepress v2.x temp and cache directory
266+
.temp
267+
.cache
268+
269+
# Docusaurus cache and generated files
270+
.docusaurus
271+
272+
# Serverless directories
273+
.serverless/
274+
275+
# FuseBox cache
276+
.fusebox/
277+
278+
# DynamoDB Local files
279+
.dynamodb/
280+
281+
# TernJS port file
282+
.tern-port
283+
284+
# Stores VSCode versions used for testing VSCode extensions
285+
.vscode-test
286+
287+
# yarn v2
288+
.yarn/cache
289+
.yarn/unplugged
290+
.yarn/build-state.yml
291+
.yarn/install-state.gz
292+
.pnp.*

.env

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# Project
22
PROJECT_NAME=fastapi-react-graphql
33

4+
# Python
5+
PYTHON_TAG=3.11.4-buster
6+
PYTHON_POETRY_VERSION=1.7.1
7+
SERVER_PORT=3000
8+
49
# Postgres
510
POSTGRES_TAG=15.3-bullseye
611
DB_NAME=iris
712
DB_USER=user
813
DB_PASSWORD=password
914
DB_PORT=5432
10-
POSTGRES_DB_URL=postgresql://${DB_USER}:${DB_PASSWORD}@localhost:5432/${DB_NAME}
15+
POSTGRES_DB_URL=postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
1116

1217
# MetaBase
1318
METABASE_TAG=v0.48.0
@@ -30,4 +35,7 @@ ELASTICSEARCH_HOST=http://elasticsearch:9200
3035

3136
# Adminer
3237
ADMINER_TAG=4.7.9-standalone
33-
ADMINER_PORT=8081
38+
ADMINER_PORT=8081
39+
40+
# Image Repository
41+
APP_VERSION=0.0.1

docker-compose.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
version: "3.9"
22

33
services:
4+
server:
5+
image: fastapi-server:${APP_VERSION}
6+
container_name: ${PROJECT_NAME}-server
7+
hostname: server
8+
restart: unless-stopped
9+
stop_grace_period: 10s
10+
env_file: .env
11+
command: gunicorn -b 0.0.0.0:3000 -w 4 -k uvicorn.workers.UvicornH11Worker main:app
12+
build:
13+
context: server
14+
args:
15+
PYTHON_TAG: $PYTHON_TAG
16+
PYTHON_POETRY_VERSION: $PYTHON_POETRY_VERSION
17+
environment:
18+
ELASTICSEARCH_HOST: $ELASTICSEARCH_HOST
19+
POSTGRES_DB_URL: $POSTGRES_DB_URL
20+
REDIS_INTERNAL_HOST: $REDIS_INTERNAL_HOST
21+
REDIS_INTERNAL_PORT: $REDIS_INTERNAL_PORT
22+
ports:
23+
- ${SERVER_PORT}:3000
24+
425
postgres:
526
image: postgres:${POSTGRES_TAG}
627
container_name: ${PROJECT_NAME}-postgres

scripts/build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
docker compose build server

scripts/deploy.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
bash scripts/down.sh
4+
bash scripts/build.sh
5+
bash scripts/up.sh

0 commit comments

Comments
 (0)