Commit 0562ee24 authored by Mauritz, Falk Marius's avatar Mauritz, Falk Marius
Browse files

Optimiert Buildprozess

parent cace4417
# SWTII Cal
________________________________________________________________________________
HOW TO SETUP:
Es entsteht c.a. 1GByte Traffic.
Vorbereitung: Die Docker INstanz sollte 2GB RAM haben, 1GB RAM haben, !!!!
Mehr RAM beschleunigt den Prozess da weniger während des Build-Prozesses weniger PAGING auftritt.
Ab einem Punkt, ich weiß nicht wo, beschleunigt mehr RAM den Prozess nicht mehr.
1. Navigieren Sie im Terminal ind das Root_Verzeichnis des Projektes.
2. RUN: docker-compose up --build
3. Machen Sie sich einen Kaffee, kommen Sie in ("1-2"/"5-10")(2/1 GB RAM) Min zurück.
- während des kompilierens sehen Sie etwas wie:
- "[WARNING] No actions completed for 25.0s, waiting on:".
- Dadurch das der Build-Prozess nicht optimiert ist.
- Kompilieren erzeugt "minified" Kompilat
- "minified" bedeutet das auf Länge von Code optimiert wird.
- Auswirkung: z.B. durch minimieren der Funktionsnamen, werden die Dateigrößen kleiner.
4. Rufen Sie diese Adresse auf: www.localhost:8080/calendar/index.html
5. Fertig.
________________________________________________________________________________
Wir (die Gruppe Mittwoch-15:15) haben uns dieses Semester für den Kalender entschieden.
Hierbei liegt der Fokus auf Individualisierung und Übersichtlichkeit des Kalenders, was realisiert wird, indem jeder Tag farbliche Inhalte bekommt, welche Termine repräsentieren.
Diese Idee stammt aus dem vorherigen SWT Semester, indem wir auch schon als Gruppe gearbeitet haben.
......@@ -16,34 +46,4 @@ https://itnext.io/building-restful-web-apis-with-dart-aqueduct-and-postgresql-3c
Desweiteren haben wir uns dazu entschieden, uns immer Dienstags um 12.00 Uhr in der Uni zu treffen, um an dem Projekt weiter zu arbeiten. Weitere Termine Entscheiden wir von Woche zu Woche.
Online https://projects.mylab.th-luebeck.de/calendar/#/login
// Entwicklickung:
!!!!ACHTUNG!!!!
ECHTE Zugangsdaten dürfen !NIEMALS! in einem Repository auftauchen.
Bitte nur zur lokalen Entwicklung nutzen.
SQL zum erstellen einer Datenbank,
'password' und 'user' nach Wahl.
// entfernt alle aktuellen verbindungen zur db
select pg_terminate_backend(pid) from pg_stat_activity where datname='calendar';
// löscht die Database
DROP DATABASE calendar;
----------------------------------------------
CREATE USER cal_user WITH createdb;
ALTER USER cal_user WITH password 'password';
CREATE DATABASE calendar;
GRANT all ON database calendar TO cal_user;
----------------------------------------------
aqueduct auth add-client --id com.calendar.app
// dockercompose
docker-compose up --build
......@@ -5,7 +5,7 @@ services:
build:
context: .
dockerfile: frontend/DockerfileCompose
dockerfile: frontend/Dockerfile
ports:
- "8080:80"
......@@ -15,26 +15,24 @@ services:
image: middleman
build:
context: .
dockerfile: middleman/DockerfileCompose
dockerfile: middleman/Dockerfile
ports:
- "8888:8888"
environment:
- CAL_DB_HOST=postgres
- CAL_DB_PORT=5432
- CAL_DB_USER=docker
- CAL_DB_NAME=calendar
- CAL_DB_NAME=docker
- CAL_DB_PASS=docker
postgres:
image: postgres
build:
context: .
dockerfile: postgres/Dockerfile
image: "postgres"
restart: always
ports:
- "5432:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
POSTGRES_USER: docker
POSTGRES_PASSWORD: docker
POSTGRES_USER: docker
FROM google/dart:2.2 AS builder
ENV PATH="${PATH}:/root/.pub-cache/bin"
WORKDIR /root/build-here
COPY pubspec.yaml /root/build-here/
RUN pub global activate webdev
COPY /frontend/pubspec.yaml /root/build-here/
RUN pub get
COPY . /root/build-here/
COPY /frontend /root/build-here/
RUN pub get
RUN pub run build_runner build --output web:build --release
RUN pub get && webdev build --output web:build
FROM nginx
EXPOSE 80
RUN sed -i -e 's, location / {, location /calendar {,g' /etc/nginx/conf.d/default.conf; \
......
FROM google/dart:2.2 AS builder
ENV PATH="${PATH}:/root/.pub-cache/bin"
WORKDIR /root/build-here
COPY frontend/pubspec.yaml /root/build-here/
RUN pub get
COPY frontend/ /root/build-here/
RUN pub get
RUN pub run build_runner build --output web:build --release
FROM nginx
EXPOSE 80
RUN sed -i -e 's, location / {, location /calendar {,g' /etc/nginx/conf.d/default.conf; \
sed -i -e 's, root /usr/share/nginx/html;, alias /usr/share/nginx/html;,g' /etc/nginx/conf.d/default.conf
COPY --from=builder /root/build-here/build /usr/share/nginx/html
targets:
$default:
builders:
build_web_compilers|entrypoint:
# These are globs for the entrypoints you want to compile.
generate_for:
- web/main.dart
options:
release_options:
compiler: dart2js
dart2js_args:
- --minify
- -Dhost=http://localhost:8888
\ No newline at end of file
......@@ -20,7 +20,7 @@ class RegisterComponent implements OnInit, OnActivate {
final Router _router;
final RegisterService _registerService;
User user = User.zero();
User user = User(0,"cc1","username","surename","name","mail@mail.de","Password123","000010101");
String passwordWh ="";
......
......@@ -14,7 +14,7 @@ dependencies:
angular: ^5.0.0
angular_forms: ^2.0.0
angular_router: ^2.0.0-alpha+19
build_runner: any
build_runner: 1.1.2
build_web_compilers: ^1.0.0
pedantic: ^1.0.0
analyzer: ^0.34.3
......
......@@ -263,8 +263,6 @@ ALTER TABLE ONLY public._user ALTER COLUMN id SET DEFAULT nextval('public._user_
--
COPY public._appointment (id, name, "time", year, month, day, duration, location, note) FROM stdin;
1 ddjjjj 2019 6 11 sss note
2 nnn mmm 2019 6 11 mmm mmm
\.
......@@ -297,16 +295,6 @@ com.calendar.app \N \N \N \N
--
COPY public._authtoken (id, code, accesstoken, refreshtoken, scope, issuedate, expirationdate, type, resourceowner_id, client_id) FROM stdin;
1 \N yrO8mQQAyD66rIKhjuGdP9UdOFcPDxpk \N \N 2019-06-11 10:08:37.086344 2019-06-12 10:08:37.086344 bearer 1 com.calendar.app
2 \N rZhq1AeyCHabdsTjuMe0s41n04JMp69d \N \N 2019-06-11 10:08:52.277794 2019-06-12 10:08:52.277794 bearer 1 com.calendar.app
3 \N 2MlIW2ZiTQzQQrO3ObfwApxaR5BRaneg \N \N 2019-06-11 10:10:47.89723 2019-06-12 10:10:47.89723 bearer 1 com.calendar.app
4 \N ww5iS7iT3lkJyNoB4dAQx2X2tDrqhH5Z \N \N 2019-06-11 10:11:04.181846 2019-06-12 10:11:04.181846 bearer 1 com.calendar.app
5 \N k5OPYamwmFK6rvKanciu9ze5lIEn5izr \N \N 2019-06-11 10:12:57.272299 2019-06-12 10:12:57.272299 bearer 1 com.calendar.app
6 \N d0CiRc2sg8zxEbjbVtGlGQWsY19lnZFr \N \N 2019-06-11 11:33:21.291298 2019-06-12 11:33:21.291298 bearer 1 com.calendar.app
7 \N brBA3j70k5ya9kTgACfeYB19VGNUWMcC \N \N 2019-06-11 11:54:39.23811 2019-06-12 11:54:39.23811 bearer 1 com.calendar.app
8 \N cQpQX7jFjkjcc5h3f8zDCGcngJc0NzZg \N \N 2019-06-18 10:10:33.370172 2019-06-19 10:10:33.370172 bearer 1 com.calendar.app
9 \N 8MMhTBWlf8WO3PnHw4rHEJyC0JCroHhG \N \N 2019-06-18 10:39:17.637679 2019-06-19 10:39:17.637679 bearer 6 com.calendar.app
10 \N SBvSLfRiD8Rf6GTusdB3kHWHdofMjSUE \N \N 2019-06-19 11:26:48.125859 2019-06-20 11:26:48.125859 bearer 6 com.calendar.app
\.
......@@ -327,9 +315,6 @@ COPY public._contact (note, id, contactcode, surname, name, email) FROM stdin;
--
COPY public._user (mobileno, contactcode, surname, name, email, id, username, hashedpassword, salt) FROM stdin;
\N \N surname name email@mail.de 1 username aIRayCsVDbFMr8qWQmMVJULMaxsxiojViprczeMmWCI= 7cV6k3TZjqeBnYFoLgjpQaaRdwy5YpWqMPif+Hu4/n0=
\N \N surname name email2@mail.de 3 username2 l3fF53H4oOnxv5LsVbcTk9vu2bxukvBTHVixa4N7EHM= rRjkhSV+a46YLDMGPI/ot1mVfjA/rny1suFUzIdkFSM=
\N \N felix felix felix@felix.felix 6 felix dvBL5ZnwHTD1uWmj12VhLL/HXec0/ddVrlLrM6C4kww= 5Zn/AS5bc2g7dLXKp6MtXVLwBm6iEmAZF6THXCMsc9I=
\.
......
......@@ -2,9 +2,9 @@ FROM google/dart:2.2 AS builder
ENV PATH="${PATH}:/root/.pub-cache/bin"
RUN pub global activate aqueduct
WORKDIR /app
COPY pubspec.yaml /app/
COPY middleman/pubspec.yaml /app/
RUN pub get
COPY . /app/
COPY middleman/ /app/
RUN pub get
EXPOSE 8888
......
FROM google/dart:2.2 AS builder
ENV PATH="${PATH}:/root/.pub-cache/bin"
RUN pub global activate aqueduct
WORKDIR /app
COPY middleman/pubspec.yaml /app/
RUN pub get
COPY middleman/ /app/
RUN pub get
EXPOSE 8888
ENTRYPOINT ["pub", "run", "aqueduct:aqueduct", "serve", "--port", "8888"]
\ No newline at end of file
host: $CAL_DB_HOST
port: $CAL_DB_PORT
username: $CAL_DB_USER
password: $CAL_DB_PASS
databaseName: $CAL_DB_NAME
\ No newline at end of file
host: localhost
port: 5432
username: docker
password: docker
databaseName: docker
\ No newline at end of file
FROM postgres
COPY 001_data.sql /docker-entrypoint-initdb.d/
RUN chmod a+r /docker-entrypoint-initdb.d/*
\ No newline at end of file
RUN mkdir -p /tmp/psql_data/
COPY init.sql /tmp/psql_data/
\ No newline at end of file
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.3 (Debian 11.3-1.pgdg90+1)
-- Dumped by pg_dump version 11.2
-- Started on 2019-06-19 13:58:47
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 205 (class 1259 OID 49224)
-- Name: _appointment; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._appointment (
id bigint NOT NULL,
name text NOT NULL,
"time" text NOT NULL,
year integer NOT NULL,
month integer NOT NULL,
day integer NOT NULL,
duration text NOT NULL,
location text NOT NULL,
note text NOT NULL
);
ALTER TABLE public._appointment OWNER TO docker;
--
-- TOC entry 204 (class 1259 OID 49222)
-- Name: _appointment_id_seq; Type: SEQUENCE; Schema: public; Owner: docker
--
CREATE SEQUENCE public._appointment_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public._appointment_id_seq OWNER TO docker;
--
-- TOC entry 2949 (class 0 OID 0)
-- Dependencies: 204
-- Name: _appointment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: docker
--
ALTER SEQUENCE public._appointment_id_seq OWNED BY public._appointment.id;
--
-- TOC entry 196 (class 1259 OID 49154)
-- Name: _aqueduct_version_pgsql; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._aqueduct_version_pgsql (
versionnumber integer NOT NULL,
dateofupgrade timestamp without time zone NOT NULL
);
ALTER TABLE public._aqueduct_version_pgsql OWNER TO docker;
--
-- TOC entry 197 (class 1259 OID 49159)
-- Name: _authclient; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._authclient (
id text NOT NULL,
hashedsecret text,
salt text,
redirecturi text,
allowedscope text
);
ALTER TABLE public._authclient OWNER TO docker;
--
-- TOC entry 199 (class 1259 OID 49169)
-- Name: _authtoken; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._authtoken (
id bigint NOT NULL,
code text,
accesstoken text,
refreshtoken text,
scope text,
issuedate timestamp without time zone NOT NULL,
expirationdate timestamp without time zone NOT NULL,
type text,
resourceowner_id bigint NOT NULL,
client_id text NOT NULL
);
ALTER TABLE public._authtoken OWNER TO docker;
--
-- TOC entry 198 (class 1259 OID 49167)
-- Name: _authtoken_id_seq; Type: SEQUENCE; Schema: public; Owner: docker
--
CREATE SEQUENCE public._authtoken_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public._authtoken_id_seq OWNER TO docker;
--
-- TOC entry 2950 (class 0 OID 0)
-- Dependencies: 198
-- Name: _authtoken_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: docker
--
ALTER SEQUENCE public._authtoken_id_seq OWNED BY public._authtoken.id;
--
-- TOC entry 201 (class 1259 OID 49191)
-- Name: _contact; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._contact (
note text,
id bigint NOT NULL,
contactcode text,
surname text NOT NULL,
name text NOT NULL,
email text NOT NULL
);
ALTER TABLE public._contact OWNER TO docker;
--
-- TOC entry 200 (class 1259 OID 49189)
-- Name: _contact_id_seq; Type: SEQUENCE; Schema: public; Owner: docker
--
CREATE SEQUENCE public._contact_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public._contact_id_seq OWNER TO docker;
--
-- TOC entry 2951 (class 0 OID 0)
-- Dependencies: 200
-- Name: _contact_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: docker
--
ALTER SEQUENCE public._contact_id_seq OWNED BY public._contact.id;
--
-- TOC entry 203 (class 1259 OID 49206)
-- Name: _user; Type: TABLE; Schema: public; Owner: docker
--
CREATE TABLE public._user (
mobileno text,
contactcode text,
surname text NOT NULL,
name text NOT NULL,
email text NOT NULL,
id bigint NOT NULL,
username text NOT NULL,
hashedpassword text NOT NULL,
salt text NOT NULL
);
ALTER TABLE public._user OWNER TO docker;
--
-- TOC entry 202 (class 1259 OID 49204)
-- Name: _user_id_seq; Type: SEQUENCE; Schema: public; Owner: docker
--
CREATE SEQUENCE public._user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public._user_id_seq OWNER TO docker;
--
-- TOC entry 2952 (class 0 OID 0)
-- Dependencies: 202
-- Name: _user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: docker
--
ALTER SEQUENCE public._user_id_seq OWNED BY public._user.id;
--
-- TOC entry 2774 (class 2604 OID 49227)
-- Name: _appointment id; Type: DEFAULT; Schema: public; Owner: docker
--
ALTER TABLE ONLY public._appointment ALTER COLUMN id SET DEFAULT nextval('public._appointment_id_seq'::regclass);
--
-- TOC entry 2771 (class 2604 OID 49172)
-- Name: _authtoken id; Type: DEFAULT; Schema: public; Owner: docker
--
ALTER TABLE ONLY public._authtoken ALTER COLUMN id SET DEFAULT nextval('public._authtoken_id_seq'::regclass);
--
-- TOC entry 2772 (class 2604 OID 49194)
-- Name: _contact id; Type: DEFAULT; Schema: public; Owner: docker
--
ALTER TABLE ONLY public._contact ALTER COLUMN id SET DEFAULT nextval('public._contact_id_seq'::regclass);
--
-- TOC entry 2773 (class 2604 OID 49209)
-- Name: _user id; Type: DEFAULT; Schema: public; Owner: docker
--
ALTER TABLE ONLY public._user ALTER COLUMN id SET DEFAULT nextval('public._user_id_seq'::regclass);
--
-- TOC entry 2943 (class 0 OID 49224)
-- Dependencies: 205
-- Data for Name: _appointment; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._appointment (id, name, "time", year, month, day, duration, location, note) FROM stdin;
\.
--
-- TOC entry 2934 (class 0 OID 49154)
-- Dependencies: 196
-- Data for Name: _aqueduct_version_pgsql; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._aqueduct_version_pgsql (versionnumber, dateofupgrade) FROM stdin;
1 2019-06-11 10:02:38.67915
\.
--
-- TOC entry 2935 (class 0 OID 49159)
-- Dependencies: 197
-- Data for Name: _authclient; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._authclient (id, hashedsecret, salt, redirecturi, allowedscope) FROM stdin;
com.calendar.app \N \N \N \N
\.
--
-- TOC entry 2937 (class 0 OID 49169)
-- Dependencies: 199
-- Data for Name: _authtoken; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._authtoken (id, code, accesstoken, refreshtoken, scope, issuedate, expirationdate, type, resourceowner_id, client_id) FROM stdin;
\.
--
-- TOC entry 2939 (class 0 OID 49191)
-- Dependencies: 201
-- Data for Name: _contact; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._contact (note, id, contactcode, surname, name, email) FROM stdin;
\.
--
-- TOC entry 2941 (class 0 OID 49206)
-- Dependencies: 203
-- Data for Name: _user; Type: TABLE DATA; Schema: public; Owner: docker
--
COPY public._user (mobileno, contactcode, surname, name, email, id, username, hashedpassword, salt) FROM stdin;
\.
--
-- TOC entry 2953 (class 0 OID 0)
-- Dependencies: 204
-- Name: _appointment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: docker
--
SELECT pg_catalog.setval('public._appointment_id_seq', 2, true);
--
-- TOC entry 2954 (class 0 OID 0)
-- Dependencies: 198
-- Name: _authtoken_id_seq; Type: SEQUENCE SET; Schema: public; Owner: docker
--
SELECT pg_catalog.setval('public._authtoken_id_seq', 10, true);
--
-- TOC entry 2955 (class 0 OID 0)
-- Dependencies: 200
-- Name: _contact_id_seq; Type: SEQUENCE SET; Schema: public; Owner: docker
--
SELECT pg_catalog.setval('public._contact_id_seq', 1, false);
--
-- TOC entry 2956 (class 0 OID 0)
-- Dependencies: 202
-- Name: _user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: docker
--
SELECT pg_catalog.setval('public._user_id_seq', 6, true);
--
-- TOC entry 2810 (class 2606 OID 49232)
-- Name: _appointment _appointment_pkey; Type: CONSTRAINT; Schema: public; Owner: docker
--
ALTER TABLE ONLY public._appointment
ADD CONSTRAINT _appointment_pkey PRIMARY KEY (id);
--
-- TOC entry 2776 (class 2606 OID 49158)
-- Name: _aqueduct_version_pgsql _aqueduct_version_pgsql_versionnumber_key; Type: CONSTRAINT; Schema: public; Owner: docker
--