Skip to content

Commit 7d61836

Browse files
committed
Init
1 parent 2738b1e commit 7d61836

File tree

29 files changed

+17209
-0
lines changed

29 files changed

+17209
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git/
2+
.cache/
3+
.tmp/
4+
build/
5+
node_modules/
6+
data/
7+
.env*

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[Makefile]
12+
indent_style = tab
13+
indent_size = 4
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.env.example

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Strapi
2+
HOST=0.0.0.0
3+
PORT=1337
4+
DOMAIN=http://localhost:1337
5+
APP_KEYS=strapi
6+
API_TOKEN_SALT=strapi
7+
ADMIN_JWT_SECRET=strapi
8+
JWT_SECRET=strapi
9+
10+
# Database
11+
DATABASE_TYPE=sqlite
12+
DATABASE_URL=postgres://postgres:strapi@0.0.0.0:5432/strapi
13+
14+
# S3
15+
S3_ENABLED=false
16+
S3_ACCESS_KEY_ID=strapi
17+
S3_ACCESS_SECRET=strapi
18+
S3_ENDPOINT=https://s3.yourserver
19+
S3_BUCKET=strapi
20+
21+
# Emails
22+
SMTP_ENABLED=false
23+
SMTP_HOST=smtp.yourserver
24+
SMTP_PORT=587
25+
SMTP_USERNAME=
26+
SMTP_PASSWORD=
27+
28+
# Sentry
29+
SENTRY_ENABLED=false
30+
SENTRY_DSN=sentry

.github/workflows/deploy.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: superfly/flyctl-actions/setup-flyctl@master
17+
- run: flyctl deploy --remote-only

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
############################
2+
# OS X
3+
############################
4+
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
.Spotlight-V100
10+
.Trashes
11+
._*
12+
13+
14+
############################
15+
# Linux
16+
############################
17+
18+
*~
19+
20+
21+
############################
22+
# Windows
23+
############################
24+
25+
Thumbs.db
26+
ehthumbs.db
27+
Desktop.ini
28+
$RECYCLE.BIN/
29+
*.cab
30+
*.msi
31+
*.msm
32+
*.msp
33+
34+
35+
############################
36+
# Packages
37+
############################
38+
39+
*.7z
40+
*.csv
41+
*.dat
42+
*.dmg
43+
*.gz
44+
*.iso
45+
*.jar
46+
*.rar
47+
*.tar
48+
*.zip
49+
*.com
50+
*.class
51+
*.dll
52+
*.exe
53+
*.o
54+
*.seed
55+
*.so
56+
*.swo
57+
*.swp
58+
*.swn
59+
*.swm
60+
*.out
61+
*.pid
62+
63+
64+
############################
65+
# Logs and databases
66+
############################
67+
68+
.tmp
69+
*.log
70+
*.sql
71+
*.sqlite
72+
*.sqlite3
73+
74+
75+
############################
76+
# Misc.
77+
############################
78+
79+
*#
80+
ssl
81+
.idea
82+
nbproject
83+
public/uploads/*
84+
!public/uploads/.gitkeep
85+
86+
############################
87+
# Node.js
88+
############################
89+
90+
lib-cov
91+
lcov.info
92+
pids
93+
logs
94+
results
95+
node_modules
96+
.node_history
97+
98+
############################
99+
# Tests
100+
############################
101+
102+
testApp
103+
coverage
104+
105+
############################
106+
# Strapi
107+
############################
108+
109+
.env
110+
license.txt
111+
exports
112+
*.cache
113+
build
114+
.strapi-updater.json
115+
.docker

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ARG NODE_ENV=production
2+
3+
FROM node:18-slim as builder
4+
5+
ENV NODE_ENV=${NODE_ENV}
6+
7+
8+
RUN apt update && \
9+
apt dist-upgrade -y
10+
11+
WORKDIR /srv
12+
13+
COPY ./package.json ./package-lock.json /srv
14+
15+
RUN npm install --production
16+
17+
# ================================================
18+
19+
ARG NODE_ENV=production
20+
21+
FROM node:18-slim
22+
23+
ENV NODE_ENV=${NODE_ENV}
24+
25+
RUN apt-get update && \
26+
apt-get install -y libvips-dev make curl git tini && \
27+
apt-get clean -y && \
28+
apt-get autoclean -y && \
29+
apt-get remove -y wget curl lsb-release && \
30+
apt-get autoremove -y && \
31+
rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/*
32+
33+
WORKDIR /srv
34+
35+
COPY ./ /srv
36+
COPY --from=builder /srv/node_modules /srv/node_modules
37+
38+
RUN npm run build
39+
40+
EXPOSE 1337
41+
42+
ENTRYPOINT ["tini", "--", "/srv/entrypoint.sh"]

Makefile

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Include variables
2+
-include .env
3+
export
4+
5+
# Variables
6+
DOCKER_VERSION ?= develop
7+
DOCKER_PLATFORM ?= linux/amd64
8+
NODE_ENV ?= production
9+
10+
###################################################
11+
# HELP ############################################
12+
##################################################
13+
all:
14+
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nTargets:\n"}'
15+
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
16+
17+
# ################################################
18+
# Development ####################################
19+
# ################################################
20+
.PHONY: install dev clean start strapi-build strapi-admin
21+
22+
install: ## Install all dependencies
23+
npm ci
24+
25+
dev: ## Start Strapi for local development
26+
NODE_ENV=development npm run develop
27+
28+
clean: ## Clean strapi files
29+
rm -rf .cache
30+
rm -rf build
31+
32+
start: ## Strapi start sequence (build + start)
33+
$(MAKE) strapi-build
34+
npm run start
35+
36+
strapi-build: ## Build Strapi CMS
37+
npm run build
38+
39+
strapi-admin: ## Strapi GUI development
40+
npx strapi develop --watch-admin
41+
42+
# ################################################
43+
# Docker #########################################
44+
# ################################################
45+
.PHONY: docker-up
46+
docker-up: ## Run docker containers
47+
docker-compose up -d
48+
49+
.PHONY: docker-build
50+
docker-build: ## Docker image build
51+
docker buildx \
52+
build \
53+
--build-arg NODE_ENV=${NODE_ENV} \
54+
--platform ${DOCKER_PLATFORM} \
55+
-t ${DOCKER_IMAGE}:${DOCKER_VERSION} \
56+
-f Dockerfile \
57+
.
58+
59+
.PHONY: docker-push
60+
docker-push: ## Push docker image to registry
61+
docker push ${DOCKER_IMAGE}:${DOCKER_VERSION}
62+
63+
.PHONY: docker-dev
64+
docker-dev: ## Run docker image
65+
docker run \
66+
-it \
67+
--rm \
68+
-p 1337:1337 \
69+
-v $(CURDIR):/srv:cached \
70+
${DOCKER_IMAGE}:${DOCKER_VERSION}
71+
72+
.PHONY: docker-mariadb
73+
docker-mariadb: ## Run mariadb container
74+
docker-compose up db
75+
76+
# ################################################
77+
# Deploy #########################################
78+
# ################################################
79+
80+
.PHONY: deploy
81+
deploy: # Deploy to Fly.io
82+
fly deploy

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Strapi
2+
3+
[Strapi](https://strapi.io/) - Open Source Node.js Headless CMS
4+
5+
## Stack
6+
7+
- Strapi 4+
8+
- Node.js 18+
9+
- MariaDB 10.10+
10+
- SQLite (for development)
11+
12+
## Configuration
13+
14+
We use these plugins in Strapi:
15+
16+
- upload ([aws-s3](https://www.npmjs.com/package/@strapi/provider-upload-aws-s3))
17+
- email ([nodemail](https://www.npmjs.com/package/@strapi/provider-email-sendmail))
18+
- sentry ([sentry](https://www.npmjs.com/package/@strapi/plugin-sentry))
19+
20+
## Development
21+
22+
**Makefile**
23+
24+
```
25+
➜ make
26+
Usage:
27+
make <target>
28+
29+
Targets:
30+
clean Clean strapi files
31+
dev Start Strapi for local development
32+
docker-build Docker image build
33+
docker-dev Run docker image
34+
docker-mariadb Run mariadb container
35+
docker-push Push docker image to registry
36+
docker-up Run docker containers
37+
install Install all dependencies
38+
start Strapi start sequence (build + start)
39+
strapi-admin Strapi GUI development
40+
strapi-build Build Strapi CMS
41+
```
42+
43+
**ENV**
44+
45+
```env
46+
# Strapi
47+
HOST=0.0.0.0
48+
PORT=1337
49+
DOMAIN=http://localhost:1337
50+
APP_KEYS=strapi
51+
API_TOKEN_SALT=strapi
52+
ADMIN_JWT_SECRET=strapi
53+
JWT_SECRET=strapi
54+
55+
# Database
56+
DATABASE_TYPE=sqlite
57+
DATABASE_URL=postgres://postgres:strapi@0.0.0.0:5432/strapi
58+
59+
# S3
60+
S3_ENABLED=false
61+
S3_ACCESS_KEY_ID=strapi
62+
S3_ACCESS_SECRET=strapi
63+
S3_ENDPOINT=https://s3.yourserver
64+
S3_BUCKET=strapi
65+
66+
# Emails
67+
SMTP_ENABLED=false
68+
SMTP_HOST=smtp.yourserver
69+
SMTP_PORT=587
70+
SMTP_USERNAME=
71+
SMTP_PASSWORD=
72+
73+
# Sentry
74+
SENTRY_ENABLED=false
75+
SENTRY_DSN=sentry
76+
77+
```

0 commit comments

Comments
 (0)