Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
init-things
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
init-things
Commits
11212c9f
Commit
11212c9f
authored
May 01, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new
parent
896dc7c0
Pipeline
#3084
passed with stages
in 1 minute and 16 seconds
Changes
22
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1079 additions
and
2 deletions
+1079
-2
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
things/nest-init/src/app.service.ts
things/nest-init/src/app.service.ts
+1
-1
things/nest-typeorm-init/.dockerignore
things/nest-typeorm-init/.dockerignore
+42
-0
things/nest-typeorm-init/.gitignore
things/nest-typeorm-init/.gitignore
+38
-0
things/nest-typeorm-init/.gitlab-ci.yml
things/nest-typeorm-init/.gitlab-ci.yml
+64
-0
things/nest-typeorm-init/Dockerfile
things/nest-typeorm-init/Dockerfile
+11
-0
things/nest-typeorm-init/LICENSE
things/nest-typeorm-init/LICENSE
+661
-0
things/nest-typeorm-init/app.controller.spec.ts
things/nest-typeorm-init/app.controller.spec.ts
+22
-0
things/nest-typeorm-init/src/app.controller.spec.ts
things/nest-typeorm-init/src/app.controller.spec.ts
+22
-0
things/nest-typeorm-init/src/app.logger.ts
things/nest-typeorm-init/src/app.logger.ts
+4
-0
things/nest-typeorm-init/src/app.module.ts
things/nest-typeorm-init/src/app.module.ts
+13
-0
things/nest-typeorm-init/src/app.service.ts
things/nest-typeorm-init/src/app.service.ts
+19
-0
things/nest-typeorm-init/src/config.ts
things/nest-typeorm-init/src/config.ts
+20
-0
things/nest-typeorm-init/src/entities/TimeBase.ts
things/nest-typeorm-init/src/entities/TimeBase.ts
+13
-0
things/nest-typeorm-init/src/entities/User.ts
things/nest-typeorm-init/src/entities/User.ts
+3
-0
things/nest-typeorm-init/src/main.ts
things/nest-typeorm-init/src/main.ts
+9
-0
things/nest-typeorm-init/test/app.e2e-spec.ts
things/nest-typeorm-init/test/app.e2e-spec.ts
+24
-0
things/nest-typeorm-init/test/jest-e2e.json
things/nest-typeorm-init/test/jest-e2e.json
+9
-0
things/nest-typeorm-init/tsconfig.json
things/nest-typeorm-init/tsconfig.json
+18
-0
things/nginx/.keep
things/nginx/.keep
+0
-0
things/nginx/conf.d/ssl.conf
things/nginx/conf.d/ssl.conf
+54
-0
things/nginx/docker-compose.yml
things/nginx/docker-compose.yml
+31
-0
No files found.
.gitlab-ci.yml
View file @
11212c9f
...
...
@@ -27,6 +27,6 @@ upload_to_minio:
image
:
python
script
:
-
pip install -U -i https://mirrors.aliyun.com/pypi/simple/ awscli
-
aws s3 --endpoint=https://minio.mycard.moe:9000 sync dist/ s3://nanahira/init
-
aws s3 --endpoint=https://minio.mycard.moe:9000 sync
--delete
dist/ s3://nanahira/init
only
:
-
master
things/nest-init/src/app.service.ts
View file @
11212c9f
...
...
@@ -4,7 +4,7 @@ import { AppLogger } from './app.logger';
@
Injectable
()
export
class
AppService
{
constructor
(
private
log
:
AppLogger
)
{
this
.
log
.
setContext
(
'
Logger Name
'
);
this
.
log
.
setContext
(
'
app
'
);
}
getHello
():
string
{
...
...
things/nest-typeorm-init/.dockerignore
0 → 100644
View file @
11212c9f
# compiled output
/dist
/node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
/data
/output
/config.yaml
.git*
Dockerfile
.dockerignore
things/nest-typeorm-init/.gitignore
0 → 100644
View file @
11212c9f
# compiled output
/dist
/node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
/data
/output
/config.yaml
things/nest-typeorm-init/.gitlab-ci.yml
0 → 100644
View file @
11212c9f
stages
:
-
build
-
combine
-
deploy
variables
:
GIT_DEPTH
:
"
1"
CONTAINER_TEST_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_TEST_ARM_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm
CONTAINER_TEST_X86_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86
CONTAINER_RELEASE_IMAGE
:
$CI_REGISTRY_IMAGE:latest
before_script
:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build-x86
:
stage
:
build
tags
:
-
docker
script
:
-
docker build --pull -t $CONTAINER_TEST_X86_IMAGE .
-
docker push $CONTAINER_TEST_X86_IMAGE
build-arm
:
stage
:
build
tags
:
-
docker-arm
script
:
-
docker build --pull -t $CONTAINER_TEST_ARM_IMAGE .
-
docker push $CONTAINER_TEST_ARM_IMAGE
combine
:
stage
:
combine
tags
:
-
docker
script
:
-
docker pull $CONTAINER_TEST_X86_IMAGE
-
docker pull $CONTAINER_TEST_ARM_IMAGE
-
docker manifest create $CONTAINER_TEST_IMAGE --amend $CONTAINER_TEST_X86_IMAGE --amend $CONTAINER_TEST_ARM_IMAGE
-
docker manifest push $CONTAINER_TEST_IMAGE
deploy_latest
:
stage
:
deploy
tags
:
-
docker
script
:
-
docker pull $CONTAINER_TEST_IMAGE
-
docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
-
docker push $CONTAINER_RELEASE_IMAGE
only
:
-
master
deploy_tag
:
stage
:
deploy
tags
:
-
docker
variables
:
CONTAINER_TAG_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
script
:
-
docker pull $CONTAINER_TEST_IMAGE
-
docker tag $CONTAINER_TEST_IMAGE $CONTAINER_TAG_IMAGE
-
docker push $CONTAINER_TAG_IMAGE
only
:
-
tags
things/nest-typeorm-init/Dockerfile
0 → 100644
View file @
11212c9f
FROM
node:buster-slim
LABEL
Author="Nanahira <nanahira@momobako.com>"
RUN
apt update
&&
apt
-y
install
python3 build-essential
&&
rm
-rf
/var/lib/apt/lists/
*
/tmp/
*
/var/tmp/
*
WORKDIR
/usr/src/app
COPY
./package*.json ./
RUN
npm ci
COPY
. ./
RUN
npm run build
CMD
["npm", "run", "start:prod"]
things/nest-typeorm-init/LICENSE
0 → 100644
View file @
11212c9f
This diff is collapsed.
Click to expand it.
things/nest-typeorm-init/app.controller.spec.ts
0 → 100644
View file @
11212c9f
import
{
Test
,
TestingModule
}
from
'
@nestjs/testing
'
;
import
{
AppController
}
from
'
./app.controller
'
;
import
{
AppService
}
from
'
./app.service
'
;
describe
(
'
AppController
'
,
()
=>
{
let
appController
:
AppController
;
beforeEach
(
async
()
=>
{
const
app
:
TestingModule
=
await
Test
.
createTestingModule
({
controllers
:
[
AppController
],
providers
:
[
AppService
],
}).
compile
();
appController
=
app
.
get
<
AppController
>
(
AppController
);
});
describe
(
'
root
'
,
()
=>
{
/* it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
}); */
});
});
things/nest-typeorm-init/src/app.controller.spec.ts
0 → 100644
View file @
11212c9f
import
{
Test
,
TestingModule
}
from
'
@nestjs/testing
'
;
import
{
AppController
}
from
'
./app.controller
'
;
import
{
AppService
}
from
'
./app.service
'
;
describe
(
'
AppController
'
,
()
=>
{
let
appController
:
AppController
;
beforeEach
(
async
()
=>
{
const
app
:
TestingModule
=
await
Test
.
createTestingModule
({
controllers
:
[
AppController
],
providers
:
[
AppService
],
}).
compile
();
appController
=
app
.
get
<
AppController
>
(
AppController
);
});
describe
(
'
root
'
,
()
=>
{
/* it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
}); */
});
});
things/nest-typeorm-init/src/app.logger.ts
0 → 100644
View file @
11212c9f
import
{
Injectable
,
Scope
,
Logger
}
from
'
@nestjs/common
'
;
@
Injectable
()
export
class
AppLogger
extends
Logger
{}
things/nest-typeorm-init/src/app.module.ts
0 → 100644
View file @
11212c9f
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
AppController
}
from
'
./app.controller
'
;
import
{
AppService
}
from
'
./app.service
'
;
import
{
AppLogger
}
from
'
./app.logger
'
;
import
{
TypeOrmModule
}
from
'
@nestjs/typeorm
'
;
import
{
typeormConfig
}
from
'
./config
'
;
@
Module
({
imports
:
[
TypeOrmModule
.
forRoot
(
typeormConfig
())],
controllers
:
[
AppController
],
providers
:
[
AppService
,
AppLogger
],
})
export
class
AppModule
{}
things/nest-typeorm-init/src/app.service.ts
0 → 100644
View file @
11212c9f
import
{
Injectable
}
from
'
@nestjs/common
'
;
import
{
AppLogger
}
from
'
./app.logger
'
;
import
{
Connection
,
Repository
}
from
'
typeorm
'
;
import
{
InjectConnection
}
from
'
@nestjs/typeorm
'
;
@
Injectable
()
export
class
AppService
{
constructor
(
@
InjectConnection
(
'
waitress
'
)
private
db
:
Connection
,
private
log
:
AppLogger
,
)
{
this
.
log
.
setContext
(
'
app
'
);
}
getHello
():
string
{
return
'
Hello World!
'
;
}
}
things/nest-typeorm-init/src/config.ts
0 → 100644
View file @
11212c9f
import
{
TypeOrmModuleOptions
}
from
'
@nestjs/typeorm
'
;
export
function
dbConfig
()
{
return
{
host
:
process
.
env
.
DB_HOST
,
port
:
process
.
env
.
DB_PORT
?
parseInt
(
process
.
env
.
DB_PORT
)
:
3306
,
username
:
process
.
env
.
DB_USER
,
password
:
process
.
env
.
DB_PASS
,
database
:
process
.
env
.
DB_NAME
,
};
}
export
function
typeormConfig
():
TypeOrmModuleOptions
{
return
{
name
:
'
app
'
,
type
:
'
mysql
'
,
entities
:
[],
// entities here
synchronize
:
true
,
...
dbConfig
(),
};
}
things/nest-typeorm-init/src/entities/TimeBase.ts
0 → 100644
View file @
11212c9f
import
{
CreateDateColumn
,
UpdateDateColumn
}
from
'
typeorm
'
;
export
class
TimeBase
{
@
CreateDateColumn
({
select
:
false
})
createTime
:
Date
;
@
UpdateDateColumn
({
select
:
false
})
updateTime
:
Date
;
toObject
()
{
return
JSON
.
parse
(
JSON
.
stringify
(
this
));
}
}
things/nest-typeorm-init/src/entities/User.ts
0 → 100644
View file @
11212c9f
import
{
TimeBase
}
from
'
./TimeBase
'
;
export
class
User
extends
TimeBase
{}
things/nest-typeorm-init/src/main.ts
0 → 100644
View file @
11212c9f
import
{
NestFactory
}
from
'
@nestjs/core
'
;
import
{
AppModule
}
from
'
./app.module
'
;
async
function
bootstrap
()
{
const
app
=
await
NestFactory
.
create
(
AppModule
);
app
.
enableCors
();
await
app
.
listen
(
3000
);
}
bootstrap
();
things/nest-typeorm-init/test/app.e2e-spec.ts
0 → 100644
View file @
11212c9f
import
{
Test
,
TestingModule
}
from
'
@nestjs/testing
'
;
import
{
INestApplication
}
from
'
@nestjs/common
'
;
import
*
as
request
from
'
supertest
'
;
import
{
AppModule
}
from
'
./../src/app.module
'
;
describe
(
'
AppController (e2e)
'
,
()
=>
{
let
app
:
INestApplication
;
beforeEach
(
async
()
=>
{
const
moduleFixture
:
TestingModule
=
await
Test
.
createTestingModule
({
imports
:
[
AppModule
],
}).
compile
();
app
=
moduleFixture
.
createNestApplication
();
await
app
.
init
();
});
/* it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
}); */
});
things/nest-typeorm-init/test/jest-e2e.json
0 → 100644
View file @
11212c9f
{
"moduleFileExtensions"
:
[
"js"
,
"json"
,
"ts"
],
"rootDir"
:
"."
,
"testEnvironment"
:
"node"
,
"testRegex"
:
".e2e-spec.ts$"
,
"transform"
:
{
"^.+\\.(t|j)s$"
:
"ts-jest"
}
}
things/nest-typeorm-init/tsconfig.json
0 → 100644
View file @
11212c9f
{
"compilerOptions"
:
{
"module"
:
"commonjs"
,
"declaration"
:
true
,
"removeComments"
:
true
,
"emitDecoratorMetadata"
:
true
,
"experimentalDecorators"
:
true
,
"allowSyntheticDefaultImports"
:
true
,
"target"
:
"es2017"
,
"sourceMap"
:
true
,
"outDir"
:
"./dist"
,
"baseUrl"
:
"./"
,
"incremental"
:
true
,
"esModuleInterop"
:
true
},
"compileOnSave"
:
true
,
"allowJs"
:
true
}
things/nginx/.keep
0 → 100644
View file @
11212c9f
things/nginx/conf.d/ssl.conf
0 → 100644
View file @
11212c9f
# Genreated by MyCard cert update.
ssl_prefer_server_ciphers
on
;
ssl_ciphers
CHACHA20
:-
DHE
:
AESGCM
:
AESCCM
+
ECDH
:-
SHA256
:
AES
:+
AES256
:+
DHE
:+
AESCCM8
:+
SHA256
:-
SHA384
:+
SHA
:-
RSA
:-
ECDH
+
ECDSA
+
SHA
:!
DSS
:!
PSK
:!
aNULL
:!
SRP
:!
aECDH
;
ssl_ecdh_curve
X25519
:
prime256v1
:
secp384r1
:
secp521r1
;
resolver
127
.
0
.
0
.
11
;
client_max_body_size
10
g
;
ssl_session_timeout
10
m
;
ssl_session_cache
shared
:
SSL
:
10
m
;
ssl_stapling
on
;
ssl_stapling_verify
on
;
ssl_trusted_certificate
/
etc
/
nginx
/
certs
/
yuzurisa
.
com
/
chain
.
pem
;
ssl_dhparam
/
etc
/
nginx
/
certs
/
yuzurisa
.
com
/
dhparam
.
pem
;
ssl_certificate
/
etc
/
nginx
/
certs
/
yuzurisa
.
com
/
fullchain
.
pem
;
ssl_certificate_key
/
etc
/
nginx
/
certs
/
yuzurisa
.
com
/
privkey
.
pem
;
ssl_protocols
SSLv2
SSLv3
TLSv1
TLSv1
.
1
TLSv1
.
2
TLSv1
.
3
;
gzip
on
;
gzip_vary
on
;
gzip_comp_level
6
;
gzip_disable
msie6
;
gzip_proxied
any
;
gzip_types
text
/
plain
text
/
css
text
/
javascript
application
/
javascript
application
/
json
application
/
x
-
javascript
text
/
xml
application
/
xml
application
/
xml
+
rss
;
proxy_cache_path
/
etc
/
nginx
/
cache
levels
=
1
:
2
keys_zone
=
my_cache
:
10
m
max_size
=
10
g
inactive
=
60
m
use_temp_path
=
off
;
proxy_cache
my_cache
;
proxy_cache_revalidate
on
;
proxy_cache_background_update
on
;
proxy_cache_lock
on
;
proxy_cache_key
$
scheme
://$
host
$
request_uri
;
client_header_buffer_size
128
k
;
client_body_buffer_size
1
m
;
proxy_buffer_size
128
k
;
proxy_buffers
256
128
k
;
proxy_busy_buffers_size
4
m
;
proxy_temp_file_write_size
2
m
;
add_header
X
-
Cache
-
Status
$
upstream_cache_status
;
map
$
http_upgrade
$
connection_upgrade
{
default
upgrade
;
''
close
;
}
log_format
vcombined
'$host:$server_port '
'$remote_addr - $remote_user [$time_local] '
'"$request_method $scheme://$host$request_uri" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$upstream_cache_status" "$upstream_http_cache_control"'
;
things/nginx/docker-compose.yml
0 → 100644
View file @
11212c9f
version
:
'
2.4'
services
:
nginx
:
restart
:
always
image
:
git-registry.mycard.moe/nanahira/docker-nginx-plus
ports
:
-
'
80:80'
-
'
443:443'
-
'
444:443'
volumes
:
-
./conf.d:/etc/nginx/conf.d:ro
-
./certs:/etc/nginx/certs:ro
-
./cache:/etc/nginx/cache
mysql
:
restart
:
always
image
:
mariadb:10
ports
:
-
3306:3306
volumes
:
-
./db:/var/lib/mysql
environment
:
MYSQL_ROOT_PASSWORD
:
change_here
pma
:
restart
:
always
image
:
phpmyadmin
environment
:
PMA_HOSTS
:
mysql
PMA_ABSOLUTE_URI
:
https://change_here
depends_on
:
-
mysql
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment