Fakultas Ilmu Komputer UI

Commit 0eafbe11 authored by Ryan Karyadiputera's avatar Ryan Karyadiputera
Browse files

test3

parent 6fad8f76
Pipeline #81499 passed with stage
in 3 minutes and 56 seconds
FROM python:3.8
# pull official base image
FROM python:3.9.1-alpine
ENV PYTHONUNBUFFERED 1
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV http_proxy=http://proxy.cs.ui.ac.id:8080/
ENV https_proxy=http://proxy.cs.ui.ac.id:8080/
ENV ftp_proxy=http://proxy.cs.ui.ac.id:8080/
RUN mkdir /app
WORKDIR /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY .env .env.production
COPY . /app/
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
# RUN chmod +x docker-entrypoint.sh
# copy project
COPY . .
# ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
CMD [ "gunicorn", "sip.wsgi:application", "--bind", "0.0.0.0:8000" ]
\ No newline at end of file
web: DJANGO_SETTINGS_MODULE=sip.settings.staging gunicorn sip.wsgi --log-file -
release: chmod 777 migrate.sh && ./migrate.sh
\ No newline at end of file
......@@ -42,7 +42,10 @@ POSTGRES_DB=postgres_db_name
```
### __How To Run on Local Development__
1. Buat .env di folder sip/settings/ dengan secret key-nya
1. Buat .env di folder sip/settings/ dengan secret key-nya. Tambahin line ini di file-nya:
```bash
DJANGO_SECRET_KEY="s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337"
```
2. Lakukan makemigrations dan migrate
```bash
python manage.py makemigrations --settings=sip.settings.dev
......@@ -54,5 +57,6 @@ POSTGRES_DB=postgres_db_name
```
### __Pipelines and Coverage__
[![pipeline status](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend/badges/staging/pipeline.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend) [![coverage report](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend/badges/staging/coverage.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend)
[![pipeline status](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/badges/staging/pipeline.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/commits/staging/)
[![coverage report](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/badges/staging/coverage.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/commits/staging/)
This diff is collapsed.
......@@ -60,7 +60,6 @@ pdfkit==0.6.1
Pillow==8.0.1
pipenv==2018.11.26
pluggy==0.13.1
psycopg2==2.8.6
psycopg2-binary==2.8.6
py==1.8.1
pycodestyle==2.6.0
......
......@@ -24,7 +24,6 @@ from authentication.models import (
from lembaga.models import (
Institusi,
Tema,
LingkupKerja,
Lembaga,
)
from laporan_praktikum.models import (
......@@ -80,15 +79,6 @@ def seed_tema(tema_number):
print('seeding tema..... [SUCCESS]')
def seed_lingkup_kerja(lingkup_kerja_number):
for i in range(lingkup_kerja_number):
LingkupKerja.objects.create(
nama='nama_lingkup_kerja_' + str(i)
)
print('seeding lingkup kerja..... [SUCCESS]')
def get_image_file(name='test.png', ext='png', size=(50, 50), color=(256, 0, 0)):
file_obj = BytesIO()
image = Image.new("RGBA", size=size, color=color)
......@@ -100,7 +90,6 @@ def get_image_file(name='test.png', ext='png', size=(50, 50), color=(256, 0, 0))
def seed_lembaga(lembaga_number):
all_institusi = Institusi.objects.all()
all_tema = Tema.objects.all()
all_lingkup_kerja = LingkupKerja.objects.all()
jenis_pelayanan_list = [
'Perusahaan',
'Pemerintahan',
......@@ -117,7 +106,6 @@ def seed_lembaga(lembaga_number):
beneficaries="test_beneficaries_" + str(i),
alamat="test_alamat_" + str(i)
)
lembaga.lingkup_kerja.add(all_lingkup_kerja[i])
lembaga.gambar = get_image_file()
lembaga.save()
print('seeding lembaga..... [SUCCESS]')
......@@ -488,7 +476,6 @@ if __name__ == "__main__":
seed_institusi(lembaga_number)
seed_tema(lembaga_number)
seed_lingkup_kerja(lembaga_number)
seed_lembaga(lembaga_number)
seed_periode()
......
......@@ -13,7 +13,6 @@ from laporan_praktikum.models import (
from lembaga.models import (
Institusi,
Tema,
LingkupKerja,
Lembaga,
)
from authentication.models import (
......@@ -77,18 +76,9 @@ def seed_tema(tema_number):
print('seeding tema..... [SUCCESS]')
def seed_lingkup_kerja(lingkup_kerja_number):
for i in range(lingkup_kerja_number):
LingkupKerja.objects.create(
nama='nama_lingkup_kerja_' + str(i)
)
print('seeding lingkup kerja..... [SUCCESS]')
def seed_lembaga(lembaga_number):
all_institusi = Institusi.objects.all()
all_tema = Tema.objects.all()
all_lingkup_kerja = LingkupKerja.objects.all()
jenis_pelayanan_list = [
'Perusahaan',
'Pemerintahan',
......@@ -105,7 +95,6 @@ def seed_lembaga(lembaga_number):
beneficaries="test_beneficaries_" + str(i),
alamat="test_alamat_" + str(i)
)
lembaga.lingkup_kerja.add(all_lingkup_kerja[i])
lembaga.save()
print('seeding lembaga..... [SUCCESS]')
......@@ -478,7 +467,6 @@ if __name__ == "__main__":
seed_institusi(lembaga_number)
seed_tema(lembaga_number)
seed_lingkup_kerja(lembaga_number)
seed_lembaga(lembaga_number)
seed_periode()
......
DJANGO_SECRET_KEY="s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337"
\ No newline at end of file
DJANGO_SECRET_KEY="s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337"
SQL_ENGINE="django.db.backend.postgresql"
SQL_DATABASE="dgbaqjatoqbvt"
SQL_USER="jhkyaejkkhttzj"
SQL_PASSWORD="7ecdf594cf5c652869b1da87032cd58998c922f19ed5368fa3e58499810f25bd"
SQL_HOST="ec2-54-211-176-156.compute-1.amazonaws.com"
SQL_PORT="5432"
\ No newline at end of file
......@@ -2,3 +2,9 @@ DJANGO_SECRET_KEY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
SQL_ENGINE
SQL_DATABASE
SQL_USER
SQL_PASSWORD
SQL_HOST
SQL_PORT
\ No newline at end of file
DJANGO_SECRET_KEY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
SQL_ENGINE
SQL_DATABASE
SQL_USER
SQL_PASSWORD
SQL_HOST
SQL_PORT
\ No newline at end of file
DJANGO_SECRET_KEY="s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337"
AWS_ACCESS_KEY_ID="AKIAZQWXBKG5M6KKHZSP"
AWS_SECRET_ACCESS_KEY="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"
AWS_STORAGE_BUCKET_NAME="sipraktikum-storage"
\ No newline at end of file
......@@ -14,6 +14,8 @@ import environ
import os
import dj_database_url
from datetime import timedelta
import mimetypes
mimetypes.add_type("text/css", ".css", True)
# Environ Setup
......
......@@ -105,9 +105,13 @@ REST_FRAMEWORK = {
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": env("SQL_ENGINE"),
"NAME": env("SQL_DATABASE"),
"USER": env("SQL_USER"),
"PASSWORD": env("SQL_PASSWORD"),
"HOST": env("SQL_HOST"),
"PORT": env("SQL_PORT"),
}
}
......@@ -219,10 +223,10 @@ JWT_AUTH = {
'JWT_AUTH_COOKIE': None,
}
SUCCESS_SSO_AUTH_REDIRECT = "http://sipraktikum-frontend-2020-a.herokuapp.com/"
SUCCESS_SSO_AUTH_REDIRECT = "http://ppl-berkah.herokuapp.com/"
CORS_ORIGIN_WHITELIST = [
"http://sipraktikum-frontend-2020-a.herokuapp.com",
"http://ppl-berkah.herokuapp.com/",
"http://localhost:8000",
"http://127.0.0.1:8000",
]
......
......@@ -15,7 +15,11 @@ import os
# import sys
import dj_database_url
from datetime import timedelta
import mimetypes
mimetypes.add_type("text/css", ".css", True)
#env = environ.Env()
#environ.Env.read_env() # Reading .env file
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -24,7 +28,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY")
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', "s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
......@@ -172,7 +176,7 @@ AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_LOCATION = 'static'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [
'static/',
os.path.join(BASE_DIR, "static"),
......@@ -231,7 +235,7 @@ JWT_AUTH = {
'JWT_AUTH_COOKIE': None,
}
SUCCESS_SSO_AUTH_REDIRECT = "http://sipraktikum-frontend-2020-a.herokuapp.com/"
SUCCESS_SSO_AUTH_REDIRECT = "http://ppl-berkah.herokuapp.com/"
CORS_ORIGIN_ALLOW_ALL = True
# CORS_ORIGIN_WHITELIST = [
......
......@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sip.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sip.settings.production')
application = get_wsgi_application()
......@@ -28,4 +28,4 @@ sonar.scm.provider=git
sonar.sourceEncoding=UTF-8
## Branch analysis
##sonar.branch.name=$CI_COMMIT_REF_NAME
\ No newline at end of file
sonar.branch.name=$CI_COMMIT_REF_NAME
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment