This repository contains the image of a fast, secure and maintainable web snippetbox application using the fantastic programming language Go. The idea behind this project is using dependency injection to implement efficient functions, taking into consideration best practices and writing efficient unit and integration tests, scallable project structure, session management, authenticating users, securing the server and uses a MySQL database but structured in a way that makes integration with other databases very easy. The project is designed as intended for usage in a production environment.
To run the container DBPASS, DBUSER and DBNAME enviromental variables representing a database password, user and name needs to be set on the container, the default application port is 4000 and the database conection @tcp(snippetbox_db:3306) here snippetbox_db refers to a running mysql container with same configurations set, an easy way would be to use my docker-compose.yml file to automate the process, of course a .env file containing the enviromental variables would be needed.
version: '3.8'
services:
snippetbox:
image: snippetbox:f7432f7
container_name: snippetbox
restart: unless-stopped
ports:
- '4000:4000'
environment:
- DBUSER=${DBUSER}
- DBPASS=${DBPASS}
- DBNAME=${DBNAME}
snippetbox_db:
image: mysql:5.7
container_name: snippetbox_db
restart: unless-stopped
ports:
- '3306:3306'
environment:
MYSQL_DATABASE: snippetbox
MYSQL_ROOT_PASSWORD: ${DBPASS}
volumes:
- db-data:/var/lib/mysql
volumes:
db-data:
driver: local
Tag 1 logs requests, errors and info to standard output and tag f7432f7 logs them to info and error log files.
Content type
Image
Digest
sha256:009962907…
Size
12 MB
Last updated
over 3 years ago
docker pull ifedayoawe/snippetbox:f7432f7