Skip to content

Commit e68d38f

Browse files
authored
Merge pull request #2 from metacpan/preview
Abe's final handoff tweaks
2 parents 494c67d + f9e044a commit e68d38f

File tree

211 files changed

+106
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+106
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Build deployment container
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- preview
8+
workflow_dispatch:
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-22.04
12+
name: Docker Push
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: create dummy secrets
16+
run: mkdir private-config && touch private-config/.pgpass && chmod 600 private-config/.pgpass
17+
- name: Docker build
18+
run: docker build . -t metacpan/perl5-coresmokedb-api:latest
19+
- name: Run Perl tests
20+
run: docker run -i metacpan/perl5-coresmokedb-api prove -Ilocal/lib/perl5 -lw t
21+
- name: Log in to Docker Hub
22+
uses: docker/login-action@v2
23+
with:
24+
username: ${{ secrets.DOCKER_HUB_USER }}
25+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
26+
- name: Push build to Docker hub
27+
run: docker push metacpan/perl5-coresmokedb-api:latest

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ cpanfile.snapshot
1616
local/
1717
logs/
1818

19+
# carmell
20+
.carmel/
21+
1922
# Devel::Cover
2023
cover_db/
2124

@@ -34,3 +37,6 @@ nytprof.out
3437

3538
# vim
3639
*.swp
40+
41+
# App stuff that does not belong in git
42+
private-config/

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ARG PERL_VERSION=5.36
2+
FROM perl:${PERL_VERSION} as build
3+
4+
RUN apt update && apt upgrade -y && \
5+
apt install -y build-essential libpq-dev
6+
7+
# deploy the application
8+
COPY t /var/lib/coresmokedb-api/t/
9+
COPY lib /var/lib/coresmokedb-api/lib/
10+
COPY bin /var/lib/coresmokedb-api/bin/
11+
COPY environments /var/lib/coresmokedb-api/environments/
12+
COPY vendor /var/lib/coresmokedb-api/vendor/
13+
COPY config.yml /var/lib/coresmokedb-api/
14+
ADD --chmod=0600 private-config/.pgpass /var/lib/coresmokedb-api/environments/
15+
16+
# install dependencies
17+
COPY cpanfile* /var/lib/coresmokedb-api/
18+
WORKDIR /var/lib/coresmokedb-api/
19+
RUN cpanm -L local JSON::PP
20+
RUN cpanm -L local --from $PWD/vendor/cache -qn --installdeps .
21+
22+
CMD [ \
23+
"perl", "-Ilocal/lib/perl5", "local/bin/plackup", "-s", "Starman", "-p", "5050", \
24+
"-E", "docker", "bin/app.psgi" \
25+
]

cpanfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
requires 'Dancer2' => '0.400000';
22
requires 'Dancer2::Plugin::RPC' => '2.02';
3-
requires 'Dancer2::Plugin::RPC::RESTISH' => '2.01_01';
3+
requires 'Dancer2::Plugin::RPC::RESTISH' => '2.02';
44
requires 'Dancer2::Logger::Log4perl';
55
requires 'MooseX::Log::Log4perl' => '0.47';
66
requires 'Date::Parse' => '2.30';
@@ -12,7 +12,9 @@ requires 'DBD::Pg' => '0';
1212
requires 'DBD::SQLite' => '0';
1313
requires 'DBIx::Class' => '0';
1414
requires 'Dancer2::Plugin::DBIC' => '0';
15+
requires 'JSON::PP' => '4.16';
1516
requires 'Moo' => '2';
1617
requires 'Perl5::CoreSmokeDB::Schema' => '1.12';
1718
requires 'namespace::autoclean' => '0';
1819
requires 'Starman' => '0.4015';
20+
requires 'Test::Fatal';

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
version: "3"
3+
services:
4+
perl5_coresmokedb_api:
5+
container_name: dckr-perl5-coresmokedb-api
6+
image: metacpan/perl5-coresmokedb-api:latest
7+
build:
8+
context: .
9+
ports:
10+
- 5050:5050
11+
environment:
12+
PGPASSFILE: /var/lib/coresmokedb-api/environments/.pgpass
13+
restart: unless-stopped

environments/development.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ plugins:
2222
development: &dev
2323
schema_class: Perl5::CoreSmokeDB::Schema
2424
dsn: 'dbi:Pg:host=fidodbmaster;dbname=coresmokedb'
25+
user: abeltje
2526
options:
2627
RaiseError: 1
2728
PrintError: 1

environments/docker.l4p

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
log4perl.rootLogger = DEBUG, SCREEN
2+
log4perl.appender.SCREEN = Log::Log4perl::Appender::ScreenColoredLevels
3+
log4perl.appender.SCREEN.color.ERROR = bold red
4+
log4perl.appender.SCREEN.color.FATAL = bold red
5+
log4perl.appender.SCREEN.color.OFF = bold green
6+
log4perl.appender.SCREEN.stderr = 1
7+
log4perl.appender.SCREEN.layout = Log::Log4perl::Layout::PatternLayout::Multiline
8+
log4perl.appender.SCREEN.layout.ConversionPattern=[%d] %F{2}:%L %c - %m%n

environments/docker.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
log: debug
3+
logger: log4perl
4+
5+
engines:
6+
logger:
7+
log4perl:
8+
config_file: environments/docker.l4p
9+
10+
# cors_allow_origin: http://localhost:5555
11+
cors_allow_origin: "*"
12+
13+
plugins:
14+
DBIC:
15+
docker: &dckr
16+
schema_class: Perl5::CoreSmokeDB::Schema
17+
dsn: 'dbi:Pg:host=dbserver;dbname=coresmokedb'
18+
user: coresmokedb
19+
options:
20+
RaiseError: 1
21+
PrintError: 1
22+
pg_enable_utf8: -1
23+
default: *dckr
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)