-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Apillon/feature/docker
docker fixes & docs
- Loading branch information
Showing
9 changed files
with
160 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
node_modules | ||
npm-debug.log | ||
.npm | ||
logs | ||
*.log | ||
tmp | ||
.DS_Store | ||
.git | ||
.gitignore | ||
README.md | ||
LICENSE | ||
.dockerignore | ||
dockerfile | ||
.nyc_output | ||
.coverage | ||
.vscode | ||
*.md | ||
*.yml | ||
.env* | ||
dist | ||
*.tar | ||
docker-compose.* | ||
build-image.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Pre-built solution for Sign-up Email Airdrop via Apillon API (backend) | ||
|
||
//TODO: description | ||
|
||
## Environment variables | ||
|
||
For local development and running app you will need to configure some environment variables. List of all supported vars can be found in [`src/config/env.ts`](/src/config/env.ts). | ||
|
||
For local development you should create `.env` file. To run this app in Docker, you can create `.env.deploy` and `.env.sql.deploy` and use provided [`docker-compose.yml`](/docker-compose.yml) | ||
|
||
### .env | ||
|
||
For running locally, create new `.env` file in project root folder (`backend/`) and set at least all the variables (probably with different values) as in `.env.deploy` file described bellow. | ||
|
||
### .env.deploy | ||
|
||
For running a docker image with [`docker-compose.yml`](/docker-compose.yml) you should create `.env.deploy` file like this: | ||
|
||
```sh | ||
|
||
MYSQL_HOST: mysql # DB host (container name or ip/url) | ||
MYSQL_DB: airdrop | ||
MYSQL_USER: root | ||
MYSQL_PASSWORD: Pa55worD?! # set your DB password (same as in .env.sql.deploy) | ||
|
||
APP_URL: 'http://your-custom-url.com' # set URL of your frontend application | ||
ADMIN_WALLET: # your EVM wallet address | ||
|
||
# Apillon configuration | ||
# Create (free) account at https://apillon.io to and setup API key and NFT collection | ||
APILLON_KEY: # Apillon api key | ||
APILLON_SECRET: # Apillon api key secret | ||
COLLECTION_UUID: # Apillon NFT collection UUID | ||
|
||
# Your email server configuration | ||
SMTP_HOST: | ||
SMTP_PORT: '465' | ||
SMTP_USERNAME: | ||
SMTP_PASSWORD: | ||
SMTP_EMAIL_FROM: | ||
SMTP_NAME_FROM: 'NFT Airdrop' | ||
|
||
# API configuration (you can just live it as it is or appropriate fix dockerfile and compose) | ||
API_HOST: 0.0.0.0 | ||
API_PORT: 3000 | ||
|
||
# To Enable hCaptcha, register and get a secret. Remove or use blank if you don't need it. | ||
CAPTCHA_SECRET: | ||
|
||
#Number of hours user have to claim NFT, before they are removed from line and become un eligible to claim | ||
CLAIM_EXPIRES_IN: # default 72 | ||
``` | ||
|
||
### .env.sql.deploy | ||
|
||
For running a mysql docker image with [`docker-compose.yml`](/docker-compose.yml) you should create `.env.sql.deploy` file like this: | ||
|
||
```sh | ||
MYSQL_ROOT_PASSWORD: Pa55worD?! # set your DB password (same as in .env.deploy) | ||
MYSQL_DATABASE: airdrop | ||
|
||
``` | ||
## Deploying with docker | ||
|
||
Build docker image with script [`./build-image.sh`](/build-image.sh) script or by running docker build command, for example: | ||
|
||
```sh | ||
docker build -t ps-signup-email-airdrop . | ||
docker tag ps-signup-email-airdrop ps-signup-email-airdrop:latest | ||
``` | ||
|
||
If you correctly setup .env files, you can run app in docker by running | ||
|
||
```sh | ||
docker compose up -d | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/i0e4n2k8 | ||
docker build -t ment-airdrop:latest . | ||
docker tag ment-airdrop:latest public.ecr.aws/i0e4n2k8/ment-airdrop:latest | ||
docker push public.ecr.aws/i0e4n2k8/ment-airdrop:latest | ||
set -e | ||
|
||
docker build -t ps-signup-email-airdrop . | ||
docker tag ps-signup-email-airdrop ps-signup-email-airdrop:latest | ||
# docker save -o ps-signup-email-airdrop.tar ps-signup-email-airdrop:latest |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
##### | ||
# This is an example of docker compose file for Apillon pre-built solutions. You are encouraged to change it according to your needs. | ||
##### | ||
|
||
version: '3.8' | ||
|
||
services: | ||
airdrop_db: | ||
image: mysql | ||
container_name: airdrop_db | ||
|
||
## Enviroment variables can be set in .env files or from build environment | ||
## Here is how you can use .env file (note: should be separate for each container) | ||
env_file: | ||
- .env.sql.deploy | ||
|
||
## If you want to read variables from build environment comment out above section and uncomment below | ||
# environment: | ||
# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
# MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
|
||
ports: | ||
- '3306:3306' | ||
restart: always | ||
volumes: | ||
- mysql-data:/var/lib/mysql | ||
networks: | ||
- db | ||
|
||
airdrop_app: | ||
image: public.ecr.aws/i0e4n2k8/ment-airdrop:latest | ||
image: ps-signup-email-airdrop:latest | ||
container_name: airdrop_app | ||
depends_on: | ||
- airdrop_db | ||
|
||
## Enviroment variables can be set in .env files or from build environment | ||
## Here is how you can use .env file (note: should be separate for each container) | ||
env_file: | ||
- .env.deploy | ||
restart: always | ||
networks: | ||
- web | ||
- db | ||
|
||
volumes: | ||
mysql-data: | ||
|
||
networks: | ||
db: | ||
web: | ||
name: web | ||
external: true | ||
ports: | ||
- '8080:3000' | ||
restart: always |
Oops, something went wrong.