- Go:
1.19 - PostgreSQL:
15.2 - Memcached:
1.6.17 - Redis:
6.0.17 - Google and Github keys
Server is ready immediately after containers are up
make compose #docker-compose upmake docker-build #docker build -t social-network .
make docker-run #docker run social-network- Go to the Developer settings
- Create Application
- Enable
User permissions->Email addresses->Read Onlyin the Permissions - Generate secret token
- Enter the
URIsthat are allowed to be redirect-URIs (e.g.https://localhost:3000/oauth/github/callback) - Paste both
Client IDandClient Secretto thegithub_secret.json
- Go to the Google Cloud Console
- Create project (add content to the consent screen like title and logo) or use existing
Credentials->Create Credentials->Oauth Client ID- Choose the
Web Applicationtype and give it a name - Enter the
URIsthat are allowed to be redirect-URIs (e.g.https://localhost:3000/oauth/google/callback) - Paste both
Client IDandClient Secretto thegoogle_secret.json
-
Port
:6379PasswordpasswordDatabase0 -
Port
:5431UserpostgresPasswordpg_passwordDatabasesocial-network
It is possible to additionally configure the app using environment variables
environment:
POSTGRES_IP: 127.0.0.1 # connect to local database
HOST_PORT: 8082 # change server portgit clone https://github.com/Kl1ck9r/go-social-network.git
cd social-network
make build
make run server -http # or httpsmigrate -database ${POSTGRESQL_URL} -path migrate/ upmigrate -database ${POSTGRESQL_URL} -path migrate/ down- Mocks
- Unit
make test # File (default logger.txt)
[ERROR]: 16002-216-216 216:216:216 - [memcache: cache miss Failed to get value of the memcached]
[INFO]: 12002-212-212 212:212:212 - [database connected successfully]
[INFO]: 16002-216-216 216:216:216 - protocol[http method GET path /favicon.ico Duration 769.2µs Status Code 200 Status text OK]
[INFO]: 16002-216-216 216:216:216 - protocol[http method GET path /login Duration 512.6µs Status Code 200 Status text OK]
[FATAL]: 16002-216-216 216:216:216 - [listen tcp :3000: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.]